huxuan / iptvtools

A set of scripts that help to better the IPTV experience.
https://iptvtools.readthedocs.io/
MIT License
182 stars 50 forks source link

ValueError: invalid literal for int() with base 10 #25

Open Coloradohusky opened 2 years ago

Coloradohusky commented 2 years ago

Running on Windows 10, using Python 3.8.2. Trying to use on iptv-org.github.io m3us, but to no avail.

C:\Users\Coloradohusky\Downloads\IPTV>iptv-filter -i https://iptv-org.github.io/iptv/languages/cat.m3u
https://videos.rtva.ad/live/rtva/playlist.m3u8, Inaccessible (No connectivity)!
http://ventdelnord.tv:8080/girona/directe.m3u8, Inaccessible (No connectivity)!
http://ventdelnord.tv:8080/escala/directe.m3u8, Inaccessible (No connectivity)!
http://5.255.90.184:2002/play/a01z, Inaccessible (No connectivity)!
https://cdnlive.shooowit.net/25televisiolive/smil:channel1.smil/master.m3u8, OK!
https://cdnapisec.kaltura.com/p/2346171/sp/234617100/playManifest/entryId/1_n6442jz0/format/applehttp/.m3u8?referrer=aHR0cHM6Ly9iZXRldmUuY2F0, OK!
https://bcovlive-a.akamaihd.net/1e7e91116b104391a4f22e13a694d94f/eu-central-1/6057955885001/playlist_dvr.m3u8, Inaccessible (No connectivity)!
100%|####################################################################################| 7/7 [00:31<00:00,  4.49s/it]
Traceback (most recent call last):
  File "C:\Users\Coloradohusky\AppData\Local\Programs\Python\Python38\lib\runpy.py", line 193, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "C:\Users\Coloradohusky\AppData\Local\Programs\Python\Python38\lib\runpy.py", line 86, in _run_code
    exec(code, run_globals)
  File "C:\Users\Coloradohusky\AppData\Local\Programs\Python\Python38\Scripts\iptv-filter.exe\__main__.py", line 7, in <module>
  File "C:\Users\Coloradohusky\AppData\Local\Programs\Python\Python38\lib\site-packages\iptvtools\iptv_filter.py", line 75, in main
    playlist.export()
  File "C:\Users\Coloradohusky\AppData\Local\Programs\Python\Python38\lib\site-packages\iptvtools\models.py", line 42, in export
    for url in sorted(self.data, key=self.__custom_sort):
  File "C:\Users\Coloradohusky\AppData\Local\Programs\Python\Python38\lib\site-packages\iptvtools\models.py", line 175, in __custom_sort
    res.append(int(entry['params'].get(key) or sys.maxsize))
ValueError: invalid literal for int() with base 10: '25TV.es'

The line in question (see 'tvg-id'):

#EXTINF:-1 tvg-id="25TV.es" tvg-logo="https://i.imgur.com/sADbx7S.png" group-title="Undefined",25 TV (480p) [Not 24/7]
https://cdnlive.shooowit.net/25televisiolive/smil:channel1.smil/master.m3u8
Coloradohusky commented 2 years ago

Also broken on Python 3.10.6 (just updated versions)

Coloradohusky commented 2 years ago

Why is tvg-id being converted into an int? Program seems to work great w/o the casting

huxuan commented 2 years ago

We convert tvg-id to int for sorting, so that channels with tvg-id 1, 10, 2 will be sorted properly. But it is OK to make this part more robust. I will make a path soon.

huxuan commented 2 years ago

Please help to check whether version 0.2.10 fix the problem.

P.S. I still want to keep the feature of sorting by numeric tvg-id, so the changes is more like a hack instead.