HDHRUtil utilities - A few useful (python3) scripts for those using the HDHR ecosystem

*IMPORTANT NOTE* Most of these utilities utilize undocumented features/functions of the various HDHR components which have been reverse engineered. In addition to potentially failing to do the correct thing today, at any future point SiliconDust may decide to change or alter their systems such that these utilities fail to work at that time. Caveat Emptor. Because these use undocumented capabilities, some of which may be considered proprietary, trade secret, or under other covenants, if SiliconDust asks me to remove the public repo I will do so.

*MORE IMPORTANT NOTE* Some of these utilities (especially those that manipulate metadata) may be able to screw up your recordings in ways that may make them unplayable, or may result in future episodes not being record, or may cause duplicate recordings, or may cause the entire universe to explode. Please try not to make the universe explode.

More complete documentation on each script (typically including an example) can be found in the docs/ subdirectory of the repo

Quick summary of current utilities:

HDHRUtil-DVR-fileMetadata - Display, update, set a files metadata
HDHRUtil-DVR-fileImport - Import an existing file into a DVR file with specified metadata
HDHRUtil-Tuner-channelScan - Report status, or start or stop a channel scan
HDHRUtil-Tuner-channelSetting - Set the channel status for a HDHR device
HDHRUtil-Tuner-channelSettingDuplicate - Copy the channel status from one HDHR to another

in the importers/ subdirectory is an example script to import selected recordings from MythTV.

Since I'm not a coder, I don't know if the following suggestions are possible with variants of your scripts or even as they stand now, but they would be useful.

1) An additive scan of a user-selectable range of channels, i.e. keeping all previously-found channels. A special case would be to add a single channel, which could just be a range where the high and low channels are the same. Adding channels is useful where an antenna must be moved to get different channels. Setting a range helps where the local spread is much less than the US default of 2-69, 2-51 or (soon) 2-36.

2) The ability to remove unwanted channels found in a scan. Even better: a channel blacklist to keep those channels from showing up in future scans.

Since I'm not a coder, I don't know if the following suggestions are possible with variants of your scripts or even as they stand now, but they would be useful.

As I understand your suggestion, those are functions of the actual device channel scan itself, and nothing these scripts can do about those functions. There have been suggestions that some changed scan functionality will be available RSN with some beta firmware. Perhaps some of those pending changes will help your use case (none of us will know until the firmware ships and people try it out).

It threw 1.2TB of recordings into the right place. I had a couple of errors with corrupted recordings being messed up in the DB and not existing which made it choke (it could probably just cycle over them). Am missing artwork, which is probably to be expected. But I'm happy with the results.

There was a typo in it which I had to edit. I think it was trying to search for the mythbackend on localhost. instead of localhost
Otherwise it's great.

I successfully migrated all my MythTV recordings to SDDVR. I did tweak it a bit to add the SD SeriesID versus the MythTV SeriesID, and add the image link where I had the correct information. For the recordings where I had this information they look as if they were recorded by the SDDVR with the correct artwork and information.

Thanks for this - I've been thinking of writing a small perl or python script to add a DVR recording from TitanTV - basically a small Windows program associated with .tvpi files that will add the recording to the HDHR DVR. This allows adding a recording via the TitanTV grid. The code you have for discovery could come in handy.

I'm not sure the whole think will work all that well since I don't think the HDHR DVR supports a specific channel/time/duration, which is what TitanTV provides. I'd have to jury rig a search for the name, and assuming it was an exact match use that series ID with a specified start time.

I had a couple of errors with corrupted recordings being messed up in the DB and not existing which made it choke (it could probably just cycle over them).

I added a comment in the README that one should run the MythTV find_orphans.py script to first clean up your MythTV database (GIGO problem). Improved error handling may get done eventually, but likely not high on the list.

Am missing artwork, which is probably to be expected.

There is no good way to automate artwork for there is no good source of unencumbered artwork to try to do proper matching. It was my belief that it was better for individuals to choose how to acquire or reference artwork.

I think it was trying to search for the mythbackend on localhost. instead of localhost

I addressed that in some recent commit. But one can also (and I think I always did for my tests) explicitly specify the backend.

... script to add a DVR recording from TitanTV - basically a small Windows program associated with .tvpi files that will add the recording to the HDHR DVR. This allows adding a recording via the TitanTV grid.

back in 2006 i wrote some applescript/javascript/python/cgi-bin/shell/webaccess to display/play/record eyetv via tvpi...still works 12 yrs later;-) then i got the hdhr prime cc & used mythtv for a while & integrated it with my webaccess code...until my server died:-\ so got a rasp pi to run osmc frontend & hdhr_record backend, but osmc got corrupted (& it wasn't that great @ playback)-: so now i just play recordings in vlc...all i need is the sekrit incantation to program hdhr...so where's the api?