CaTzil / service.subtitles.napisy24pl

Napisy24.pl is Addon for searching and downloading subtitles from KODI
GNU General Public License v2.0
8 stars 9 forks source link

plugin napisy24pl error #31

Closed PDent0n closed 1 year ago

PDent0n commented 1 year ago

Hello. For several days, the plugin has been reporting an error. From the KODI log:

WARNING <general>: RunScript called for a non-script addon 'service.subtitles.napisy24pl'. This behaviour is deprecated.
   INFO <general>: initializing python engine.
  ERROR <general>: EXCEPTION Thrown (PythonToCppException) : -->Python callback/script returned the following error<--
                    - NOTE: IGNORING THIS CAN LEAD TO MEMORY LEAKS!
                   Error Type: <class 'TypeError'>
                   Error Contents: argument should be integer or bytes-like object, not 'str'
                   Traceback (most recent call last):
                     File "/home/sap/.kodi/addons/service.subtitles.napisy24pl/service.py", line 144, in <module>
                       helper.login(True)
                     File "/home/sap/.kodi/addons/service.subtitles.napisy24pl/resources/lib/NapisyUtils.py", line 160, in login
                       if content.find(self.BASE_URL + "/cb-logout") > -1:
                   TypeError: argument should be integer or bytes-like object, not 'str'
                   -->End of Python script error report<--

Both KODI Matrix and Nexus on Nvidia Shield and Linux

CaTzil commented 1 year ago

I've tested it on Matrix, it works :]

PDent0n commented 1 year ago

Unfortunately, it still doesn't work on the Nexus. Login ok, but when searching for subtitles there is an error. From the KODI log:

error <general>: EXCEPTION Thrown (PythonToCppException) : -->Python callback/script returned the following error<--
                                                    - NOTE: IGNORING THIS CAN LEAD TO MEMORY LEAKS!
                                                   Error Type: <class 'TypeError'>
                                                   Error Contents: JSONDecoder.__init__() got an unexpected keyword argument 'encoding'
                                                   Traceback (most recent call last):
                                                     File "/storage/emulated/0/Android/data/org.xbmc.kodi/files/.kodi/addons/service.subtitles.napisy24pl/service.py", line 127, in <module>
                                                       search(item)
                                                     File "/storage/emulated/0/Android/data/org.xbmc.kodi/files/.kodi/addons/service.subtitles.napisy24pl/service.py", line 28, in search
                                                       subtitles_list = helper.get_subtitle_list(item)
                                                                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
                                                     File "/storage/emulated/0/Android/data/org.xbmc.kodi/files/.kodi/addons/service.subtitles.napisy24pl/resources/lib/NapisyUtils.py", line 101, in get_subtitle_list
                                                       search_results = self._search_tvshow(item)
                                                                        ^^^^^^^^^^^^^^^^^^^^^^^^^
                                                     File "/storage/emulated/0/Android/data/org.xbmc.kodi/files/.kodi/addons/service.subtitles.napisy24pl/resources/lib/NapisyUtils.py", line 183, in _search_tvshow
                                                       search_result = json.loads(search_result, encoding="utf-8")
                                                                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
                                                     File "/data/user/0/org.xbmc.kodi/cache/apk/assets/python3.11/lib/python3.11/json/__init__.py", line 359, in loads
                                                       return cls(**kw).decode(s)
                                                              ^^^^^^^^^
                                                   TypeError: JSONDecoder.__init__() got an unexpected keyword argument 'encoding'
                                                   -->End of Python script error report<--
CaTzil commented 1 year ago

I've tested it on Python 3.10.9 seems that you are using latest python, I'll check with your version.

CaTzil commented 1 year ago

I'm not able to force Kodi on mac to run with a different python version, but I've searched for the error, and seems that encoding was removed from json.loads in python.

I've pushed a fix, can you try this version, I'll prepare a new kodi PR after your approval. (On my machine it works)

PDent0n commented 1 year ago

Same error. Addon works perfectly with Python 3.8, (Kodi Matrix on Android TV, Nexus on Windows) but does not work with Python > 3.8 (Nexus on Android - Python 3.11).

[EDIT] Sorry. my mistake. I installed the previous version instead of today's version. The current one works without any problem. Thank you.

m-zakes commented 1 year ago

When is this being planned to be rollout? I still see through Kodi Matrix addons 3.0.4

CaTzil commented 1 year ago

@m-zakes when they approve it here: https://github.com/xbmc/repo-scripts/pull/2401