bebo-dot-dev / m3u-epg-editor

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

id_transforms #83

Closed MagicOneFr closed 2 weeks ago

MagicOneFr commented 2 weeks ago

Hello. In my json config file I have this : "id_transforms": [ { "|FR| CANAL+ 4K HDR UHD (Résolution Exclusive)" : "CanalPlusUhd.fr" }, { "|FR| DREAMWORKS FHD" : "Dreamworks.fr" }, { "|FR| L'EQUIPE LIVE 1 FHD" : "LequipeLive1.fr" }, { "|FR| L'EQUIPE LIVE 2 FHD" : "LequipeLive2.fr" }, { "|FR| RMC SPORT LIVE 3 FHD" : "rmcsport3.fr" } ], but in the resulting m3u, the tvg-id remains unchanged. For example :

EXTINF:-1 tvg-id="" tvg-name="|FR| RMC SPORT LIVE 3 FHD" tvg-logo="https://i.imgur.com/gtuTff6.png" group-title="FR SPORTS (France)",|FR| RMC SPORT LIVE 3 FHD

What's wrong in my config? Thank you.

bebo-dot-dev commented 2 weeks ago

That tiny snippet of config looks ok as far as I can see. It not working as expected might be due to other config not shown or input data not supplied. Not much to go on here.

MagicOneFr commented 2 weeks ago

The full one: { "m3uurl": "http://r365mail.contact:2103/get.php?username=XXX&password=YYY&type=m3u_plus&output=ts", "epgurl": "http://r365mail.contact:2103/xmltv.php?username=XXX&password=YYY", "groups": [ "FR TV FULL HD|4K (France)", "FR TV HEVC (France)", "FR TV HD (France)", "FR TV BACK UP (SECOURS)", "FR TV CINEMA FHD ( DOLBY DIGITAL)", "FR SPORTS (France)", "FR SPORTS (F1 TV | EUROLEAGUE | LNB)", "RAKUTEN TV (FRANCE)", "BELGES (FR-SPORTS-FLAMAND)", "SUISSES (SWITZERLAND)", "CANADA ( CA )", "CANALSAT AF HD (AFRIQUE)" ], "id_transforms": [ { "|FR| CANAL+ 4K HDR UHD (Résolution Exclusive)" : "CanalPlusUhd.fr" }, { "|FR| DREAMWORKS FHD" : "Dreamworks.fr" }, { "|FR| L'EQUIPE LIVE 1 FHD" : "LequipeLive1.fr" }, { "|FR| L'EQUIPE LIVE 2 FHD" : "LequipeLive2.fr" }, { "|FR| RMC SPORT LIVE 3 FHD" : "rmcsport3.fr" } ], "discard_channels": [" SD" , "▀▄ "], "no_tvg_id": true, "no_epg": false, "force_epg": false, "no_sort": true, "outdirectory": "E:\m3u-epg-editor-master", "outfilename": "azerty365", "log_enabled": true }

bebo-dot-dev commented 2 weeks ago

What's going on with the strange characters? Maybe attach a file rather than pasting it or worst case paste it as code so it's at least known to be intentional. Also still no input data so still not much to go on.

MagicOneFr commented 2 weeks ago

I have channels with non ascii characters, i guess. But it doesn't seem to be an issue. input_args2_copy.json

bebo-dot-dev commented 2 weeks ago

Please see https://github.com/bebo-dot-dev/m3u-epg-editor/blob/main/docs/SUPPORT.md

MagicOneFr commented 2 weeks ago

original.zip here they are

bebo-dot-dev commented 2 weeks ago

I ran a test with your source data and your json config and it looks to me like your configured transforms are working and are incomplete.

i.e. I see this line ends up in the newly created m3u file with no rewritten tvg-id value because there's no matching |FR| RMC SPORT LIVE 3 HD id transform in the config for the tvg-name.

#EXTINF:-1 tvg-id="" tvg-name="|FR| RMC SPORT LIVE 3 HD" tvg-logo="https://i.imgur.com/gtuTff6.png" group-title="FR SPORTS (France)",|FR| RMC SPORT LIVE 3 HD
http://r365mail.contact:2103/xxx/yyy/45738

For tvg-id transforms to be complete and tvg-id values to be populated where they were originally empty a matching transform rule needs to exist for every tvg-name value where the tvg-id is empty in the source m3u.

There's no bug here as far as I can see, just mismatched config against the source data as mentioned

Script input arguments can become misaligned to input data and changing input data and/or input data quality can be the cause of issues that arise.

MagicOneFr commented 2 weeks ago

I think I have found why it doesn't work for some channel names. You have to open the json file in utf8 mode like this: def hydrate_args_from_json(args, json_cfg_file_path): global log_enabled with open(json_cfg_file_path, encoding='utf-8') as json_cfg_file:

This way the accentued characters in channel names are correctly handled.

bebo-dot-dev commented 2 weeks ago

I don't think that's the full story to be honest. The config that you supplied above contains a unicode character and it processes against your supplied m3u/epg data without error on Linux without any code change.

I see however from that config that you appear to be running on a Windows OS and I suspect some of what's going on is related to OS, the environment you're running Python in and possibly also related to what was previously said in here which was another unicode discussion around your Windows OS and terminal/CLI environment.

MagicOneFr commented 2 weeks ago

Now I'm using powershell to launch the script. All I can say is that, for me, without the "encoding='utf-8'" parameter it doesn't work for channel names with a "é" and with the parameter, the bug is fixed.