bugatsinho / bugatsinho.github.io

Bugatsinho New Repository
GNU General Public License v3.0
77 stars 41 forks source link

[SportHD] The "Live Events" entry fails on kodi 18 #110

Closed pitsi closed 1 month ago

pitsi commented 2 years ago

As mentioned in the title, the "live events" entry fails to start on kodi 18 and brings this error in the log

2022-09-04 08:45:24.770 T:140088537245440   ERROR: EXCEPTION Thrown (PythonToCppException) : -->Python callback/script returned the following error<--
                                             - NOTE: IGNORING THIS CAN LEAD TO MEMORY LEAKS!
                                            Error Type: <type 'exceptions.UnicodeEncodeError'>
                                            Error Contents: 'ascii' codec can't encode character u'\u0142' in position 45120: ordinal not in range(128)
                                            Traceback (most recent call last):
                                              File "/storage/.kodi/addons/plugin.video.sporthdme/default.py", line 677, in <module>
                                                get_events(url)
                                              File "/storage/.kodi/addons/plugin.video.sporthdme/default.py", line 169, in get_events
                                                events = list(zip(client.parseDOM(str(data), 'li', attrs={'class': "item itemhov"}),
                                            UnicodeEncodeError: 'ascii' codec can't encode character u'\u0142' in position 45120: ordinal not in range(128)
                                            -->End of Python script error report<--
2022-09-04 08:45:24.892 T:140089317373696   ERROR: GetDirectory - Error getting plugin://plugin.video.sporthdme/?description&iconimage=%2fstorage%2f.kodi%2faddons%2fplugin.video.sporthdme%2ficon.png&mode=5&name=%5bB%5d%5bCOLOR%20white%5dLIVE%20EVENTS%5b%2fCOLOR%5d%5b%2fB%5d&url=https%3a%2f%2f1.livesoccer.sx%2f
2022-09-04 08:45:24.894 T:140089954474112   ERROR: CGUIMediaWindow::GetDirectory(plugin://plugin.video.sporthdme/?description&iconimage=%2fstorage%2f.kodi%2faddons%2fplugin.video.sporthdme%2ficon.png&mode=5&name=%5bB%5d%5bCOLOR%20white%5dLIVE%20EVENTS%5b%2fCOLOR%5d%5b%2fB%5d&url=https%3a%2f%2f1.livesoccer.sx%2f) failed

It works with no issue on kodi 19 and the url at the end of the log file does open on a web browser on the same network. Thus, I think it is something related to scrapping that fails on python2 but works on python3. I do not use the addon frequently, so the above may have been an issue on previous versions too and I noticed it just now.

p.s. Can you also make the entries under "alternative live events" show up in chronological order?

bugatsinho commented 2 years ago

thanks mate i will check it now

bugatsinho commented 2 years ago

it works ok in my end though! What version of addon do you have and which device? image

bugatsinho commented 2 years ago

New version 0.1.29 will shows events in chronological order! image

pitsi commented 2 years ago

Sporthd on v0.1.28b and the log is from kodi 18.9, on libreelec 9.2.6, on an old laptop. My other device that runs kodi 18 is a tvbox running coreelec 9.2.8, but I have not tested it yet. I tested it on kodi 19.4 (pc running debian testing/unstable) and libreelec 10.0.2. No android devices here as you see :P

And yes, I haven't booted anything yet so as to get the upgrade to 0.1.29 which was released an hour ago.

bugatsinho commented 2 years ago

Yes i can understand, cause i tested in Mac, Win and android TV also.

bugatsinho commented 2 years ago

plugin.video.sporthdme-0.1.29a.zip if you can install this version and tell me if you get any errors. PS: you can find it also in https://bugatsinho.github.io/test (use it as source to your kodi)

pitsi commented 2 years ago

Although v0.1.29 gave the same error, v0.1.29a works just like before. Thank you for the quick reply and the quick fix :)

bugatsinho commented 2 years ago

so v0.1.29a works for you mate ? I will push it ASAP. thanks for the feedback

pitsi commented 2 years ago

Yea, v0.1.29a worked for me. If I got this right, the script was failing because of utf character "u0142", which is actually a small "L" with a diagonal line on it*? And it was failing only on linux systems with python2? Amazing :D

*https://unicodeplus.com/U+0142

pitsi commented 1 month ago

Python2 did not like yesterday's upgrade to 0.1.61

2024-07-31 11:04:59.468 T:140133869266688   ERROR: EXCEPTION Thrown (PythonToCppException) : -->Python callback/script returned the following error<--
                                             - NOTE: IGNORING THIS CAN LEAD TO MEMORY LEAKS!
                                            Error Type: <type 'exceptions.UnicodeEncodeError'>
                                            Error Contents: 'ascii' codec can't encode character u'\u0142' in position 15: ordinal not in range(128)
                                            Traceback (most recent call last):
                                              File "/storage/.kodi/addons/plugin.video.sporthdme/default.py", line 852, in <module>
                                                router(sys.argv[2][1:])
                                              File "/storage/.kodi/addons/plugin.video.sporthdme/default.py", line 836, in router
                                                get_events(params['url'])
                                              File "/storage/.kodi/addons/plugin.video.sporthdme/default.py", line 101, in get_events
                                                event = "{} vs {}".format(team1, team2) if team1 and team2 else team1
                                            UnicodeEncodeError: 'ascii' codec can't encode character u'\u0142' in position 15: ordinal not in range(128)
                                            -->End of Python script error report<--
kolekan commented 1 month ago

edit default.py in addon folder and change line 101 from event = "{} vs {}".format(team1, team2) if team1 and team2 else team1 to event = u"{} vs {}".format(team1, team2) if team1 and team2 else team1

pitsi commented 1 month ago

It worked. Thanks :)