Forums » Tutorial and setups »
MUX names generated from M3U file breaking EPG
Added by James A over 5 years ago
Hi everyone,
I've been searching and reading everywhere for a solution to this and am now tearing my hair out over it - I really hope someone here can help me.
I've managed to get everything working (EPG, Watching TV, Recording etc etc), but I'm having to manually rename all of my channels (a lot), because TVH cannot match the channel name to the EPG data.
I'm using an IPTV service that supplies an M3U playlist and an XMLTV EPG feed. The MUX names pulled in from the M3U when I first add the Network (and therefore subsequently the Service names and the Channel names) are full of garbage.
That leaves me with channel names that look like this:
tvg-id="somechannel.uk" tvg-logo="https://upload.wikimedia.org/wikipedia/commons/thumb/f/fb/somelogo.png" tvg-name="Some Channel" group-title="UK Free To Air",Some Free to Air Channel
If I manually change that channel name to just "Some Channel" then POW! the EPG is matched and everything works fine.
I'm after a solution so that I don't have to go through many, many channels manually and do this.
My provider's M3U file looks like this:
#EXTM3U
#EXTINF:-1 tvg-id="somechannel.uk" tvg-name="Some Channel 1" tvg-logo="http://icons.com/305529.png" group-title="UK Free to Air",Some Channel 1
http://this.that:81/live/sfsfsfsfdfs/sdfsdfdfsdf/123.m3u8
#EXTINF:-1 tvg-id="anotherchannel.uk" tvg-name="Some Channel 2" tvg-logo="http://icons.com/302329.png" group-title="UK Free to Air",Some Channel 2
http://this.that:81/live/sfsfsfsfdfs/sdfsdfdfsdf/456.m3u8
Here's a screenshot:
Thank you so much for helping!
Replies (4)
RE: MUX names generated from M3U file breaking EPG - Added by K Shea over 5 years ago
I don't understand exactly which field you are trying to change but irregardless this looks like a job for the Linux sed command. I am not a Linux expert but basically you can use sed to change all occurrences of a particular string to another string in the same file. For example, I use a line line this to change a channel name in an XML file from "Foo" to "Foo East":
sed -i 's/<display-name>Foo<\/display-name>/<display-name>Foo East<\/display-name>/' ~/xml/listings.xml
This searches for every occurrence of <display-name>Foo</display-name> (note the use of the backward slash to escape the forward slash) and changes it to <display-name>Foo East</display-name> within the .xml file. You do need to be careful to not make the search string too generic or you may wind up making unintended changes.
You could use something like this in a shell script to automatically change your channel names after retrieving the playlist (using one sed line for each channel name that needs to be changed).
RE: MUX names generated from M3U file breaking EPG - Added by James A over 5 years ago
Hi,
Thanks for the reply, but this won't help I'm afraid. I cannot do a find and replace, although I could do some sort of macro to keep only text after the last comma (,). However, all of that requires me to be able to get access to where the names are stored in the first place and I can't seem to find that either.
The field I'm trying to change (or preferably get it in the correct format when it's created in the first place) is the Channel Name.
I want to replace this:
tvg-id="somechannel.uk" tvg-logo="https://upload.wikimedia.org/wikipedia/commons/thumb/f/fb/somelogo.png" tvg-name="Some Channel" group-title="UK Free To Air", Some Free to Air Channel
with just:
Some Free to Air Channel
I've looked in the file structure to see if I can find a place to do this, but the files (presumably one per channel) here: /home/hts/.hts/tvheadend/channel/config# don't contain the channel's names.
Thanks,
James.
RE: MUX names generated from M3U file breaking EPG - Added by K Shea over 5 years ago
Okay, sorry that didn't help, it was just a thought.
I will say this: Normally you don't make this association in the Services tab. Normally you map your services to channels, and you import your XMLTV EPG feed, and then you go into the Channel/EPG tab and then the Channels tab and then associate each channel with an EPG source. Once you have done that you re-import your XMLTV EPG feed because now it will know which listings go with which channels. Refresh your browser after EPG import operations or it might not work. In the Channels tab you can also change the channel name to something more user-friendly. But anyway that is where you match each channel to an EPG listing. I get that it's nice when it happens automatically but unfortunately things don't always work that way.
All the channel information is stored in a database and I'm afraid I don't know enough about Tvheadend to tell you how to access that.
The real problem may be if the IPTV service mixes up its service names and every time you download you get a different list. Tvheadend SHOULD still keep all the channel associations for any channels that haven't changed but every time you map new services to channels you will probably have to go through this process again. When I was talking about sed I was assuming you'd use it on one of the files you get from your IPTV provider, but I'm not sure if that would work because I don't use IPTV; all my channels are from over-the-air and satellite sources (except for a handful of live streams I added manually), also I am running a somewhat older version of Tvheadend so yours may deal with IPTV completely differently. It's entirely possible someone else can give you better or more current advice than I am able to provide.
RE: MUX names generated from M3U file breaking EPG - Added by James A over 5 years ago
Don't be sorry - appreciate your trying to help
I fixed it - woohoo!....
Basically I was using a tool called "M3U_Iptv_Editor" to remove categories and channels I didn't want from my provider's M3U file and produce a new standalone M3U. It turns out, for some unknown reason, that this program was sticking a comma (,) after the #EXTINF:0. This was causing TVH to think the text immediately following was the Channel Name. I did a find-and-replace on this file to remove the extra comma and voila! Problem solved.
Thanks so much for trying to help me. I hope this follow-up solution helps someone else
Cheers,
James.