bebo-dot-dev / m3u-epg-editor

a python m3u / epg optimizer
120 stars 27 forks source link

Add option to preserve case on EPG output #38

Closed alpe12 closed 4 years ago

alpe12 commented 4 years ago

My use case: My IPTV provider have MANY channels that are 24h the same program. And all these uncessarly have epg. Kodi takes forever to load.

I wanted to use this script to keep the epg only on actual channels. But I also want to use the original, unmodified M3U. So I only want the EPG output from this script. python2 m3u-epg-editor.py --no_tvg_id --m3uurl http://127.0.0.1/iptv.php --epgurl http://127.0.0.1/iptv.php?epg --groups "'FILMES E SERIES','CANAIS H265/HEVC','CULTURA','CANAIS LEGENDADOS E DUAL','INFANTIL','CANAIS ABERTOS','NOTICIAS','ESPORTES','USA & CANADA','SPORTS WORLD','GLOBOSAT FILMES','GRADE ALTERNATIVA 2W','ESPORTES ESPECIAIS','VARIEDADES','CANAIS RECORD TV','CANAIS GLOBO','REDE HBO','NFL & NBA PAYPERVIEW','PREMIERE'" --outdirectory '/media/tmpfs/iptvepg2' --outfilename iptv2

It works on my main TV. But don't on my old TV which uses an old Kodi version (on Android 4.4), which is the one that needs this the most.

I compared the outputed epg with the original and I noted that on the generated epg all names are lower case. Eg: Original is: channel="GloboPremium.pt" Generated is: channel="globopremium.pt"

Maybe this is the problem? If so, please add a way to make the generated EPG have the same case as the input.

Thanks.

bebo-dot-dev commented 4 years ago

Hi there,

There was a time when this script preserved the original case-sensitivity from both the source M3U and EPG files through to the generated target M3U and EPG files.

At that time somebody raised this issue as a bug since some providers have a tendency to mismatch the casing between the M3U file they supply and the EPG they supply resulting in an EPG that doesn't work with some software that relies on the case sensitivity to be the same between the M3U and the EPG.

Issue #32 was resolved with https://github.com/jjssoftware/m3u-epg-editor/pull/33/commits/8a9414b63bd62e3ce727db277d9f296f67cbaf10 and that fix ensures that the casing in the resulting M3U and EPG files generated by this script will always match by forcing the tvg-id to lowercase in the M3U file and the channel to lowercase in the EPG file.

Providing that both the script generated M3U and EPG files are used, there shouldn't be any issues. If you attempt to mix and match the use of a vanilla untouched source M3U file with a script generated EPG file or vice versa, you might end up with something that doesn't work due to the case sensitivity issue that you've described.

My advice is to use both the script generated M3U and EPG files if possible and don't attempt to mix use of the original unmodified M3U with an EPG file generated by this script.

alpe12 commented 4 years ago

Oh, I get it. Thanks. My M3U is way more frequently updated than my EPG. And I filter it by other means. I'll either revert https://github.com/jjssoftware/m3u-epg-editor/commit/8a9414b63bd62e3ce727db277d9f296f67cbaf10 here or parse my M3U changing it to lower case too. Couldn't this be an option? If not interested, which is totally ok, you can close this. Thanks again. :)

bebo-dot-dev commented 4 years ago

To be fair I think there is valid argument for introducing an option to preserve case sensitivity so I'll probably take a look at implementing that feature at some point. I'm not sure when I'll get to it though so for the moment your best option might be to have a go at reverting the original change as a quick fix.

bebo-dot-dev commented 4 years ago

A new optional --preserve_case, -pc argument has been introduced that can be supplied either as a command line argument or specified in json configuration.

When this argument is present the script should preserve the original case sensitivity of tvg-id and channel attributes as supplied in the original M3U and EPG file data through to the target newly generated M3U and EPG files.

I'll close this now but feel free to reopen it or add a comment you see any issues, thanks.