NextPVR Forums
  • ______
  • Home
  • New Posts
  • Wiki
  • Members
  • Help
  • Search
  • Register
  • Login
  • Home
  • Wiki
  • Members
  • Help
  • Search
NextPVR Forums Public Developers v
« Previous 1 2 3 4 5 … 93 Next »
How to extract M3U8 and get matching XMLTV guide data from NPVR

 
  • 0 Vote(s) - 0 Average
How to extract M3U8 and get matching XMLTV guide data from NPVR
almightyj
Offline

Junior Member

Posts: 1
Threads: 1
Joined: Oct 2018
#1
2018-10-23, 07:24 AM
Hi Devs. I was doing some IPTV testing and wanted to use my OTA tuner via NPVR as my source. Naturally I saw that http://127.0.0.1:8866/channels creates a functional .m3u8 playlist of known channels... BUT it is missing the crucial "tvg-id" element used to reference epg data in most IPTV apps.

So in an attempt to automate I tinkered with v4.1.1 and found you can easily alter the code base to dynamically create a proper M3U8 playlist AND XMLTV files with matching epg data from the tuner. Much like NPVR does already with json just using a slightly different format.

To make NextPVR output both web-accessible IPTV files (playlist.m3u8 and latest epg.xml in xmltv format) I did this:

1) Copy IPTVServiceController.cs (attached file) to C:\Users\Public\NPVR\web\App_Code\

2) Manually add web routes to "LoadGuideService()" method within the C:\Users\Public\NPVR\web\App_Code\Routes.cs text file to point to your new IPTV Service Controller.


Code:
Logger.Debug("\n\n$$$$$$$$$$$$$$$$\n"+"Setting IPTV Service Controller for dynamic M3U");
RouteTable.Routes.MapHttpRoute(
    "IPTVServiceGetChannelsM3U",
    "public/m3u", new { Controller = "IPTVService", Action = "GetChannelsM3U" }, new { httpMethod = new HttpMethodConstraint("Get")
    //IMPORTANT: a folder separator is required to allow autologin feature to work, there must be a folder before /public/file.m3u
});

Logger.Debug("\n\n$$$$$$$$$$$$$$$$\n"+"Setting IPTV Service Controller for dynamic XMLTV");
RouteTable.Routes.MapHttpRoute(
    "IPTVServiceGetGuideXML",
    "public/epg", new { Controller = "IPTVService", Action = "GetGuideXML" }, new { httpMethod = new HttpMethodConstraint("Get")
});


3) That's it, restart the nextpvr service.

Now you can use your favourite IPTV app to stream OTA channels from nextpvr (no transcoding) as if it were an IPTV server AND gather 72 hours of epg data in proper xmltv format.

http://192.168.0.100:8866/public/m3u

returns dynamically populated m3u file loaded with whatever host was requested:

Code:
#EXTM3U
#EXTINF:0 tvg-id="7168", 91 - ABC HD
http://192.168.0.100:8866/live?channel=91

http://127.0.0.1:8866/public/epg

returns dynamically populated XMLTV file from internal EPG data:

Code:
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE DocType>
<tv source-info-name="NEXTPVR">
<channel id="7168">
  <display-name>ABC HD</display-name>
</channel>
<programme id="1075182" start="20180501120500 +0100" stop="20180501130500 +0100" channel="7168">
  <title>Beauty And The Beach</title>
  <desc>Meagan was bullied as a child, and has low self-esteem about her breasts since giving birth. Ginger is unhappy with her body since the birth of her son. But will the culture shock of Phuket put them too far out of their comfor..</desc>
</programme>
</tv>


NOTE: there is no tvg-group element. Sources appear under one group called "Tuner" the rest are "Recordings". Hopefully this helps someone in the same boat I was in.

I'm still fairly new to NextPVR and loving the many use cases for it. Obviously this is experimental and unsupported although this little hack has worked perfect so far as there is hardly any new code.

If more experienced devs think a full compiled plugin would be simpler or better could you please advise how to go about that.
« Next Oldest | Next Newest »

Users browsing this thread: 1 Guest(s)



Possibly Related Threads…
Thread Author Replies Views Last Post
  Way to tell programmatically if channel load in from NPVR has finished... gdogg371 3 2,325 2021-03-11, 03:59 PM
Last Post: mvallevand
  Plugins and NPVR. Where do we start? sub 80 68,073 2020-11-26, 10:02 PM
Last Post: mandai
  Test/Development environment for npvr.db3 scJohn 10 4,191 2020-09-04, 09:14 PM
Last Post: scJohn
  XMLTV Channel Number Option gdogg371 12 6,610 2018-07-18, 04:32 PM
Last Post: sub
  Getting more than 24 hours of Guide Data scJohn 4 3,556 2018-05-16, 04:20 AM
Last Post: sub
  ios app to control npvr ui idea jnbooker15 4 3,556 2015-09-21, 10:19 PM
Last Post: sub
  ios app to control npvr ui idea jnbooker15 0 2,437 2015-09-21, 06:39 PM
Last Post: jnbooker15
  Skin - view further into the future, scale the guide Vitenka 5 3,231 2014-11-26, 07:28 PM
Last Post: Vitenka
  Attention Sub: Open TV / Custom Data Grabber plugin Benoire 2 2,863 2014-11-14, 02:05 AM
Last Post: Benoire
  Couple of questions about hacking npvr.db3 drmargarit 6 4,210 2014-09-08, 02:22 AM
Last Post: sub

  • View a Printable Version
  • Subscribe to this thread
Forum Jump:

© Designed by D&D, modified by NextPVR - Powered by MyBB

Linear Mode
Threaded Mode