Locast and PlutoTV interface (appliance)

Added by G Kazaroth 10 months ago

Cabernet for (Cable Network) version 0.9.2 (9/14/2021)
Currently works with PlutoTV and Locast (Locast provider is no more :( )
Working on getting a service that will take the Locast server stream, clean it and feed it into TVHeadend and other DVRs (Also tested on Emby and Plex). It works on the subscription and free versions. Also it runs on Linux and Windows as a service. Windows has a installer. Once installed, setup is easy with TVHeadend.
1) Setup the automatic IPTV network (recommend new URL is http://[host]:6077/Locast/channels.m3u)

Make sure to set the "Maximum # input streams". Locast has a max of 4 and tvheadend uses 2 per tuner during initial screening. Doing a force scan will create the mux and service values. Also, turn View level to Advanced and set the Re-fetch period (mins) to 1460. TVheadend has a tenancy to cause issues when channels change (Changed Services will not be mapped to channels). Doing a Force Scan every few weeks ensures control. Lastly, locast may have delays on its stream, to keep tvheadend from timing out and stopping the stream, update the Maximum Timeout to 60 seconds.
2) Next you can setup the grabber. I use a URL grabber written in Unix bash and is an extremely small file. It can be found in the github repo at called tv_grab_url
Place the grabber file in the same location as the other TVHeadend tv_grab* files, change the permissions to executable and restart TVHeadend. This should allow TVHeadend to pickup the new grabber. While in the grabber list, make sure and disable any OTA grabbers. Stations no longer send this information and will only cause TVHeadend to use a tuner for scanning. Displaying the log window by clicking the three ^ in the bottom right is helpful at this time.

Have the grabber run and populate the EPG data into the EPG Grabber Channels tab. The log should show a quantity of channels were detected.
Pop over to the EPG Grabber tab and disable the OTA grabber cron. Also, update/replace the Internal grabber cron schedule using something like below. The example will pull the TV guide at 6:04am and 5:52pm. Add more if you need. It is recommended to use static cron times.

4 6 * * *
52 17 * * *

3) In the Channel view, select Map all channels.

This will tie the services, EPG and channels together, automatically. After this, re-grab the EPG data. This will populate the EPG tab with shows. I also updated the Number column with the channel number.
4) Display the TVGUIDE. This appliance has special features which maps the tvheadend genre, giving colors on tvguides. It also has enhanced guide descriptions and optional additional channel notations if you use many streams. Below is the Kodi tvguide using the pvr.hts plugin.

For Kodi, go to the settings for PVR and turn on the General setting "Use channel numbers from backend".

Replies (278)

RE: Locast and PlutoTV interface (appliance) - Added by Sean Micklem 3 days ago

Just wanted to say thanks for this, I have enabled PTS resync and now it works much better. I can now actually record the entire show (including the beginning) and still skip around within the show and not have it go back to the beginning!

As for using ffmpeg, the interactions between ffmpeg and Tvheadend are always a wonder to behold. Sometimes ffmpeg fixes problems but occasionally it causes them.

For example there are a small group of streams from a particular source; I don't want to name that source specifically because I don't know anything about the source or the intended usage but I will just say that a few of the streams from that source (though not necessarily the most interesting ones) appear in the huge list at , anyway the weird thing about those streams is this:

- If you play them in VLC, they play just fine, no problems at all.
- If you put the exact same URL into Tvheadend (in an IPTV network), it will play BUT what you see might be anywhere from a few minutes to several hours behind. Yes, it appears that Tvheadend has invented a form of time travel to the past! And that would be great if there were a fixed amount of time difference between when the show was aired and when you start watching, but there isn't, it seems pretty much totally random. And that ONLY happens in Tvheadend!
- But if you put that same URL into a ffmpeg pipe such as "pipe:///usr/local/bin/ffmpeg -loglevel fatal -i https://address_of_stream.m3u8 -c copy -metadata service_provider=Stream_Name -metadata service_name=Stream_Name -f mpegts pipe:1" and put THAT into Tvheadend, then it plays what is currently airing, same as in VLC, however in Tvheadend the audio and video can be significantly out of sync on some streams, and if you try to play those streams live in Kodi it sometimes thinks they are audio only and doesn't show the video. But if you record such a stream then Kodi will play it just fine, except that the audio and video might still be out of sync.

If there were a way to send PM's on this board I would offer to send you a link so you could see what I mean, if you are at all interested, but as far as I can tell there's no way to send PM's here. But I just thought I'd mention that because both Tvheadend and ffmpeg can be a little weird sometimes, as I'm sure you have discovered.

RE: Locast and PlutoTV interface (appliance) - Added by G Kazaroth 3 days ago

Finishing up XUMO. Its kinda like the movie... The Good, The Bad, and The Ugly.

1) Good part is it provides a 24 hour EPG. Ugly part is it is based on UTC within a single day. Not bad until you realize midnight UTC in the US is in the evening, so you do not get the epg update until then. As an example, if you are Central Time, then the EPG will end at 7:00pm (with no data after that) and you can update the EPG between 7p and 8p to get the full next day's programming (which for central would be from 7p to 7p the next day.

2) Channels are either live or VOD. The bad is that the live ones do not have programming data. The good is that the VOD channels will play whatever is currently playing from the start, even if you start it at the end! The ugly is if you start the recording 3 minutes prior, you will get the previous movie instead of the one you wanted. Not sure how this plays into TVH, but it will be interesting.

3) Some of the channels have a tiny resolution, (less than 480) while others have 1080. From what I have seen, the VOD channels will change resolutions between movies. Cabernet will probably have a fit when that happens. Have not tested what happens at the end of a movie on a VOD channel.

4) Have not seen any commercials, but I am sure they are there. The URL filter is easy to manage, so I may leave it blank and allow users to tune it.

I have it into TVH and playing fine. Working on cleaning up the code and then probably release something on Thursday.

RE: Locast and PlutoTV interface (appliance) - Added by G Kazaroth 2 days ago

NOTE: While working with the new XUMO, I found that python's multiprocessing Process is NOT thread safe. I could not believe it, so I ran a number of tests and it cannot launch multiple process at the same time. Once launched, everything is OK. This happens when I do a Force Scan with tuners set to 4 or 5 in TVH. The result is a failed channel and hanging processes. I have fixed this is the new version, but be aware of launching multiple channels at the exact same time.

This reminds me of a time when our company's server was crashing every 3-6 hours with a Java dump. Found out the Oracle file for connecting to their database was not thread safe. At the time, I thought it was crazy for a company like Oracle who is big on multi-threaded process to develop software that was not thread safe.