im85288 / service.upnext

GNU General Public License v2.0
81 stars 42 forks source link

Upnext crashes with `binascii.Error: Odd-length string` #267

Closed croneter closed 2 years ago

croneter commented 2 years ago

Upnext crashes with

2021-12-05 11:07:40.305 T:26156   DEBUG <general>: script.skin.helper.widgets --> Kodi_Monitor: sender xbmc - method: Player.OnAVChange  - data: {"item":{"id":3,"type":"episode"},"player":{"playerid":1,"speed":1}}
2021-12-05 11:07:40.305 T:26156   DEBUG <general>: Skipped 1 duplicate messages..
2021-12-05 11:07:40.305 T:26156   DEBUG <general>: script.skin.helper.widgets --> Kodi_Monitor: sender xbmc - method: Player.OnAVStart  - data: {"item":{"id":3,"type":"episode"},"player":{"playerid":1,"speed":1}}
2021-12-05 11:07:40.321 T:24960   ERROR <general>: EXCEPTION Thrown (PythonToCppException) : -->Python callback/script returned the following error<--
                                                    - NOTE: IGNORING THIS CAN LEAD TO MEMORY LEAKS!
                                                   Error Type: <class 'binascii.Error'>
                                                   Error Contents: Incorrect padding
                                                   Traceback (most recent call last):
                                                     File "C:\Users\kat\AppData\Roaming\Kodi\addons\service.upnext\resources\lib\utils.py", line 127, in decode_data
                                                       json_data = unhexlify(encoded)
                                                   binascii.Error: Odd-length string

                                                   During handling of the above exception, another exception occurred:

                                                   Traceback (most recent call last):
                                                     File "C:\Users\kat\AppData\Roaming\Kodi\addons\service.upnext\resources\lib\monitor.py", line 111, in onNotification
                                                       decoded_data, encoding = decode_json(data)
                                                     File "C:\Users\kat\AppData\Roaming\Kodi\addons\service.upnext\resources\lib\utils.py", line 141, in decode_json
                                                       return decode_data(encoded[0])
                                                     File "C:\Users\kat\AppData\Roaming\Kodi\addons\service.upnext\resources\lib\utils.py", line 130, in decode_data
                                                       json_data = b64decode(encoded)
                                                     File "C:\Program Files\Kodi\system\python\Lib\base64.py", line 87, in b64decode
                                                       return binascii.a2b_base64(s)
                                                   binascii.Error: Incorrect padding
                                                   -->End of Python script error report<--

Detailed debug log: kodi.log

MoojMidge commented 2 years ago

Someone else had a similar issue caused by the hex string being sent from PKC as a bytestring and being malformed as a result.

https://github.com/im85288/service.upnext/issues/250

Not sure if the exact same code is still being used in PKC, but it sounds like the same root cause.

croneter commented 2 years ago

Ahhh, did not get that info - thanks a ton! I'll look into this

croneter commented 2 years ago

Should finally be fixed with PlexKodiConnect version 3.6.1