A tool to extract Channel ID mappings

This is the first of a two-parter. This collects the mapping from a channel name to a tvc-guide-stationid so that I can write a second tool to post-process M3U playlists to insert those tvc-guide-stationid tags automagically, using the file this tool generates to provide the mapping.

Provided sooner rather than later in case it makes someone else's custom scripts a little easier to write. It'll be more useful when used in combination with the second tool.


Note: This depends on the Private API of the Channels DVR. Fancy Bits LLC is free to change this unpublished API at their discretion at any time without notice, and such changes could cause this tool to break.

If this happens, complain to me, not Fancy Bits LLC. They have been quite clear that this API is for their own use, and there are no guarantees that it will remain unchanged.

What Does This Do?

extractChannelIDs is a tool to generate a tab-separated file of channel names and the associated GraceNote Channel ID. It does this by pulling the 'On Now' listing from the Channels DVR using the private API, then parses the JSON information that is returned to extract most of the information it contains about each channel.

Each line of the output file contains:
{channel name}\t{channel number}\t{station id}\t{callsign}\n

for example, the line output for one of my local stations is:

PBS     54.1    44690   KQEHDT

Note that the file it creates lists all your channels in the guide, whatever the source - HDHomeRun, TVEverywhere, Custom Channels, etc.

Why Do I Need This?

If you don't use 'Custom Channels' as a source for your Channels DVR, you don't.

If you do, I'll be writing another tool that post-processes a 'Custom Channels' M3U file obtained elsewhere to insert the Channels DVR-specific tvc-guide-stationid tag. This means that Channels DVR can associate the M3U playlist channel with a tvc-guide-stationid tag automatically with the correct Gracenote guide data.

This tool is separate from the tag-insertion tool, as I expect people will want to run the latter every time they update their M3U playlist. This tool would be run once, or at most infrequently, to generate a file that contains the mapping that the tag-insertion tool will read each time. This mapping may need to be manually edited to match your preferences or correct errors (e.g. if a station's name changes in the M3U playlist).


Thanks to the good folk at Fancy Bits LLC for providing great DVR software, and passing along snippets of information even about private APIs.

Thanks also to Dave Gamble for creating the open source cJSON library, without which this would have been a lot more tedious to write.


That's great! Thanks for making this and sharing your work. I'm looking forward to the second part.

It'll be added to mungeM3U (https://github.com/Channels-DVR-Goodies/mungeM3U).

I haven't added the tag support, or documented mungeM3U yet. I wouldn't expect others to be able to use it without at least some hints :slight_smile: I've been working on it for a while now, and it does a great job of filtering the 'noise' in a typical M3U file out, to extract only the channels you care about.

mungeM3U Disclaimer: You are responsible for determining the legality of what you are using this tool for. There is no method I, or the tool, could use to determine this - it simply processes text, it is in no way involved in the actual streaming of content. There are sources of M3U files that contain channels you can stream legally.