[Feature Requests] Network Encoders and XMLTV guide import

Would love to see some API exposed so we could develop some network encoders that worked with Plex. Personally Ive done some of this for the SageTV Plataform, I was able to integrate a Slingbox as a Tuner within the DVR, and a network encoder for DVB-S that integrates to the SageTV too. I would love to do the same with Plex. This could open endless posibilities of tuners we could integrate to our Plex.

Another nice feature it would be to be able to import our own XMLTV guides for these tuners (so we can get world wide support + any kinda of tunner as long was we can get our guide in xmltv)

Just my .2 cents :slight_smile:

So…there is fledging support for XMLTV in there (just one of several little easter eggs). I’ll leave you this slightly mysterious HTTP endpoint. The lineup encodes the path to the XMLTV file, as well as the title of the lineup.

Without a DVR setup, issue this request:

POST http://localhost:32400/livetv/dvrs?device=device%3A%2F%2Ftv.plex.grabbers.hdhomerun%2F123032B8&lineup=lineup%3A%2F%2Ftv.plex.providers.epg.xmltv%2FUsers%2Felan%2FDownloads%2Ffreeview.xml%23Freeview&language=eng

Let us know how it works; I only really tested with a single file, but it should be easy to tweak :slight_smile:

The fact that the first part of the URL scheme says ‘livetv’ makes me happy :stuck_out_tongue:

@elan said:

POST http://localhost:32400/livetv/dvrs?device=device%3A%2F%2Ftv.plex.grabbers.hdhomerun%2F123032B8&lineup=lineup%3A%2F%2Ftv.plex.providers.epg.xmltv%2FUsers%2Felan%2FDownloads%2Ffreeview.xml%23Freeview&language=eng

@elan said:
So…there is fledging support for XMLTV in there (just one of several little easter eggs). I’ll leave you this slightly mysterious HTTP endpoint. The lineup encodes the path to the XMLTV file, as well as the title of the lineup.

Without a DVR setup, issue this request:

POST http://localhost:32400/livetv/dvrs?device=device%3A%2F%2Ftv.plex.grabbers.hdhomerun%2F123032B8&lineup=lineup%3A%2F%2Ftv.plex.providers.epg.xmltv%2FUsers%2Felan%2FDownloads%2Ffreeview.xml%23Freeview&language=eng

Let us know how it works; I only really tested with a single file, but it should be easy to tweak :slight_smile:

Thanks!
Altho the answer is somewhat cryptic, but i guess i gotta go figure out how to do manual posts to the server now :stuck_out_tongue:

edit://
Fiddling around a bit led to the following:

  1. Go to your HDHomeRun’s webpage, in my case http://192.168.1.216/
  2. Find your HDHomeRuns DeviceID
  3. Generate yourself an XMLTV file (In my case i used /usr/bin/tv_grab_se_swedb after installing some stuff, and configured it to dump the generated file with all channels into /tmp/xmltv.xml)
  4. Get your Plex Token, and use X-Plex-Token as the key, and your token as the value in your post
  5. Fix your url so it looks somewhat like this:
    http://192.168.1.2:32400/livetv/dvrs?device=device://tv.plex.grabbers.hdhomerun/&lineup=lineup://tv.plex.providers.epg.xmltv&language=
    (Example: http://192.168.1.2:32400/livetv/dvrs?device=device://tv.plex.grabbers.hdhomerun/1843324D&lineup=lineup://tv.plex.providers.epg.xmltv/tmp/xmltv.xml&language=dk
  6. Enjoy :wink:

@elan is the id (123032B8) fixed or user specific ? :smiley:

Getting “Unauthorized” on a HTTP POST

@karbowiak

Nevermind :smiley:

@elan is there a way to make it accept ALL channels when using the xmltv method? because right now it’s only adding a handful of channels after the post :frowning:

and looking through the posted data when i manually set it up the regular way - isn’t yielding many clues

@mm98 said:
@elan is the id (123032B8) fixed or user specific ? :smiley:

That’s your device uuid, look in media_provider_resources table or ask for /media/grabbers/devices

@karbowiak said:
@elan is there a way to make it accept ALL channels when using the xmltv method? because right now it’s only adding a handful of channels after the post :frowning:

It should add them all. Feel free to post the XMLTV file :slight_smile:

This is awesome! … Got everything matched now! Thanks @elan !!

Hope there are future plans for external (web) download of XML =)

Now i just need a way to let Plex DVR find all my HDHomeRun channels. They are currently mixed in the difference channel providers. Where i only can “select” one provider.

I have 64 active (unencryptet) channels, but only got about 41 of these visible in Plex.

The HTTP Post to http://localhost:32400/livetv/dvrs?device=device:// … gives an XML response. The XML response contains a list of channels. Seams like this list is skipping some channel numbers.

@elan said:

@karbowiak said:
@elan is there a way to make it accept ALL channels when using the xmltv method? because right now it’s only adding a handful of channels after the post :frowning:

It should add them all. Feel free to post the XMLTV file :slight_smile:

Right i’ve tried two ways now.

  1. Altering the url you posted, replacing the ID with my HDHR’s ID, and the correct path. That added 28 channels.
  2. I tried taking the XML that is posted across when manually adding it the usual way (via the UI) and enabled all channels: <?xml version="1.0" encoding="UTF-8"?><MediaContainer size="1"> <Dvr key= - Pastebin.com
    And posted it as raw data (I’m guessing it needs to be form-data, but i cannot find the key it needs to be set to)
    This also yielded 28 channels being enabled

Either way ads 28 channels, out of a total of 83 :frowning:

edit:// forgot the xml file: https://karbowiak.dk/xmltv.xml (zipped: https://karbowiak.dk/xmltv.zip)

Well, that was too early to say it worked. Every channel is mapped to the XML file (attached). But the Program Guide doesn’t populate. Hmmm.
This file is also used on a Dreambox, without any problem.

@mm98 said:
Well, that was too early to say it worked. Every channel is mapped to the XML file (attached). But the Program Guide doesn’t populate. Hmmm.
This file is also used on a Dreambox, without any problem.

Seems we’re formatting our xmltv file the same way - and having the same problem, i tried letting mine have fun with the 28 channels it does map - and my EPG was also empty.

Could be that our xmltv file is malformed compared to what the plugin expects

edit://
Mine also works fine in both TVHeadEnd and Emby

I generate mine by the XMLTV specs (get the data from the yousee stream). Have been thinking - we define a “lang” param in the URL, we might need to define a lang XML attribute somewhere in the XML. But the XMLTV specs defines a 2 letter ISO code, and we define a 3 letter language code in the URL. So I’m not sure …

@elan what does the “lang” param define?

@mm98 said:
I generate mine by the XMLTV specs (get the data from the yousee stream). Have been thinking - we define a “lang” param in the URL, we might need to define a lang XML attribute somewhere in the XML. But the XMLTV specs defines a 2 letter ISO code, and we define a 3 letter language code in the URL. So I’m not sure …

@elan what does the “lang” param in the query-string define?

I generate it from the http://xmltv.xmltv.se/ data using the generator from tvheadend - but it’s the same end result really. But yeah, i noticed that aswell, tried setting language to en and eng when adding the hdhr to Plex, neither ended with EPG being populated.
Altering the xml isn’t really all that feasible, i mean, i can do it once - but doing it programmatically is a pain in the ass

Did find a error in the Plex Server Logs:

Sep 01, 2016 22:29:50.968 [0xe9559b90] ERROR - EPG[xmltv]: Caught exception during data chunk load: basic_string::substr

Could this possibly be an encoding error (xml is UTF8) … European special characters as Æ, Ø and Å ?

I actually have lots of (SQLITE3) errors in the log (attached):
Sep 01, 2016 22:29:39.738 [0xe9559b90] ERROR - SQLITE3:0x8c0e0e4, 1, no such table: spellfix_metadata_titles
Sep 01, 2016 22:29:39.739 [0xe9559b90] ERROR - SQLITE3:0x8c0e0e4, 1, no such table: spellfix_tag_titles
Sep 01, 2016 22:29:39.741 [0xe9559b90] ERROR - SQLITE3:0x8c0e0e4, 1, no such table: fts4_metadata_titles
Sep 01, 2016 22:29:39.743 [0xe9559b90] ERROR - SQLITE3:0x8c0e0e4, 1, no such trigger: fts4_metadata_titles_before_update
Sep 01, 2016 22:29:39.744 [0xe9559b90] ERROR - SQLITE3:0x8c0e0e4, 1, no such trigger: fts4_metadata_titles_before_delete
Sep 01, 2016 22:29:39.744 [0xe9559b90] ERROR - SQLITE3:0x8c0e0e4, 1, no such trigger: fts4_metadata_titles_after_update
Sep 01, 2016 22:29:39.745 [0xe9559b90] ERROR - SQLITE3:0x8c0e0e4, 1, no such trigger: fts4_metadata_titles_after_insert
Sep 01, 2016 22:29:39.746 [0xe9559b90] ERROR - SQLITE3:0x8c0e0e4, 1, no such table: fts4_tag_titles
Sep 01, 2016 22:29:39.748 [0xe9559b90] ERROR - SQLITE3:0x8c0e0e4, 1, no such trigger: fts4_tag_titles_before_update
Sep 01, 2016 22:29:39.749 [0xe9559b90] ERROR - SQLITE3:0x8c0e0e4, 1, no such trigger: fts4_tag_titles_before_delete
Sep 01, 2016 22:29:39.750 [0xe9559b90] ERROR - SQLITE3:0x8c0e0e4, 1, no such trigger: fts4_tag_titles_after_update
Sep 01, 2016 22:29:39.750 [0xe9559b90] ERROR - SQLITE3:0x8c0e0e4, 1, no such trigger: fts4_tag_titles_after_insert
Sep 01, 2016 22:29:39.754 [0xe9559b90] ERROR - SQLITE3:0x8c0e0e4, 1, no such index: index_metadata_items_on_original_title
Sep 01, 2016 22:29:39.949 [0xe9559b90] ERROR - SQLITE3:0x8c0e0e4, 1, no such index: index_metadata_item_views_on_grandparent_guid

@mm98 so i figured out how to enable all channels.

  1. Make a put request with a URL like so: https://192.168.1.2:32400/media/grabbers/devices/1/channelmap?channelsEnabled=1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30&channelMapping[1]=001&channelMapping[2]=002&channelMapping[3]=003&channelMapping[4]=004&channelMapping[5]=005&channelMapping[6]=006&channelMapping[7]=007&channelMapping[8]=008&channelMapping[9]=009&channelMapping[10]=010&channelMapping[11]=011&channelMapping[12]=012&channelMapping[13]=013&channelMapping[14]=014&channelMapping[15]=015&channelMapping[16]=016&channelMapping[17]=017&channelMapping[18]=018&channelMapping[19]=019&channelMapping[20]=020&channelMapping[21]=021&channelMapping[22]=022&channelMapping[23]=023&channelMapping[24]=024&channelMapping[25]=025&channelMapping[26]=027&channelMapping[27]=028&channelMapping[28]=029&channelMapping[29]=030
  2. Then make a post request like before

This should enable channels 1 through 30, and map them to those channelIDs in the HDHomeRun.

Bit of a hack, but it works

When I have a chance I’ll download the XMLTV you guys posted and make sure it works :slight_smile: Like I said, I only had a chance to try it with a single file…

@karbowiak I don’t think your channels numbers matches mine :smiley: … but does this give you an populated Program Guide ?

We should call this thread “Tips, tricks and Hacks for DVR” :smiley: