Python & Windows scripts for HDHR DVR recordings

Want to write your own code to work with a HDHomeRun or work with the HDHomeRun DVR? We are happy to help with concepts, APIs, best practices.
bdbauer
Posts: 60
Joined: Mon Jul 09, 2018 10:07 am

Python & Windows scripts for HDHR DVR recordings

Postby bdbauer » Mon Sep 03, 2018 5:46 pm

I've put together a few small Python scripts to play with the HDHR DVR API. These allow you to do most things via command line.

*WARNING* - some of these scripts can add or delete recordings. While I've never had any accidental deletions, I do not guarantee you won't (though if you start with the "tasks" scripts you will at least have the Series IDs to add back in should you need them). I also can't guarantee these won't break if the API changes in the future.

Github repository: https://github.com/blainebauer/hdhr_dvr_scripts

Included scripts:
  • tasks - A list of your DVR tasks, including the Task (Rule) ID and Series ID
  • search - Search for a series; will return the Series ID
  • addseries - Add a task for the series ID. Defauts to zero seconds start padding, but you can change that
  • deletetask - Delete a task (get the Task ID using tasks)
  • upcoming - List upcoming episodes for a Series ID
  • allupcoming - List upcoming episodes for all series
I have compiled the Python scripts into Windows executables, so you can run these programs in the Windows command line without installing Python. These are in the file hdhr-dvr-scripts-windows.zip.

Ken.F
Posts: 1833
Joined: Fri Apr 05, 2013 9:20 am
Location: West Rockhill, PA

Re: Python & Windows scripts for HDHR DVR recordings

Postby Ken.F » Thu Sep 06, 2018 11:18 am

I can't get any of these scripts to work on Linux. I keep getting errors like this:

Code: Select all

File "allupcoming", line 111 print qstring ^ SyntaxError: Missing parentheses in call to 'print'

signcarver
Expert
Posts: 7492
Joined: Wed Jan 24, 2007 1:04 am

Re: Python & Windows scripts for HDHR DVR recordings

Postby signcarver » Thu Sep 06, 2018 3:09 pm

I believe in python 3 print became a function rather than a statement and as a result one would put () around what would be printed

Ken.F
Posts: 1833
Joined: Fri Apr 05, 2013 9:20 am
Location: West Rockhill, PA

Re: Python & Windows scripts for HDHR DVR recordings

Postby Ken.F » Thu Sep 06, 2018 4:28 pm

I believe in python 3 print became a function rather than a statement and as a result one would put () around what would be printed
Thanks, but I'm not sure what to do with that information.

signcarver
Expert
Posts: 7492
Joined: Wed Jan 24, 2007 1:04 am

Re: Python & Windows scripts for HDHR DVR recordings

Postby signcarver » Thu Sep 06, 2018 5:19 pm

I believe in python 3 print became a function rather than a statement and as a result one would put () around what would be printed
Thanks, but I'm not sure what to do with that information.
I am not at a location I can look at the scripts but from what was reported, I believe line 111 in the file allupcoming (probably allupcoming.py) states " print qstring " if that is the case make it say print(qstring)

In other words use the parentheses like the error message stated. A function requires the items passed to be enclosed inside parentheses, while a statement has no such requirement and python "used" to be a very heavy statement/interpretive language but since version 3 some traditional statements were turned into functions.

Ken.F
Posts: 1833
Joined: Fri Apr 05, 2013 9:20 am
Location: West Rockhill, PA

Re: Python & Windows scripts for HDHR DVR recordings

Postby Ken.F » Thu Sep 06, 2018 5:36 pm

Thanks. I fixed the one on line 111 but then I got another one on line 117, and then one on line 124. I'm out of time tonight so I'll have to continue some other time.

gtb
Expert
Posts: 3625
Joined: Thu Oct 06, 2011 1:00 pm
Location: Sunnyvale, CA USA

Re: Python & Windows scripts for HDHR DVR recordings

Postby gtb » Thu Sep 06, 2018 7:18 pm

Thanks. I fixed the one on line 111 but then I got another one on line 117, and then one on line 124. I'm out of time tonight so I'll have to continue some other time.
There are a number of (semi-)automated tools to assist in conversion of legacy (obsolete) python2 scripts to python3. Only those stuck in the past, and accept obsolescence in less than 18 months still write anything in python2. There still exist many such people.


Return to “Development Support”

Who is online

Users browsing this forum: No registered users and 1 guest