syhlx / plugin.video.piped

An addon for Kodi which allows you to access any Piped instance, login and manage your playlists and watch history
GNU Affero General Public License v3.0
9 stars 1 forks source link

Fetching playlists error #2

Closed StatelessOddity closed 2 months ago

StatelessOddity commented 4 months ago

Hey, I wanted to test this out, so I logged in to piped.kavin.rocks and tried to grab the content I saved there. However, I'm getting a blank error in the GUI. I've checked addons settings XML file just to be sure that the login data is correct - it is. This is the error that I'm getting in the logs:


2024-03-16 02:09:56.019 T:1615    error <general>: GetDirectory - Error getting plugin://plugin.video.piped/subscriptions
2024-03-16 02:09:56.027 T:848     error <general>: CGUIMediaWindow::GetDirectory(plugin://plugin.video.piped/subscriptions) failed
2024-03-16 02:09:58.416 T:1625    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: string indices must be integers, not 'str'
                                                   Traceback (most recent call last):
                                                     File "/storage/.kodi/addons/plugin.video.piped/default.py", line 8, in <module>
                                                       router(sys.argv)
                                                     File "/storage/.kodi/addons/plugin.video.piped/lib/sections.py", line 285, in router
                                                       globals()[route](**routes[route])
                                                     File "/storage/.kodi/addons/plugin.video.piped/lib/sections.py", line 169, in playlists
                                                       list_playlists(get(f'{instance}/user/playlists', headers={'Authorization': auth_token}).json())
                                                     File "/storage/.kodi/addons/plugin.video.piped/lib/sections.py", line 143, in list_playlists
                                                       info += f"{addon.getLocalizedString(30018)}: {playlist['videos']}"
                                                                                                     ~~~~~~~~^^^^^^^^^^
                                                   TypeError: string indices must be integers, not 'str'
                                                   -->End of Python script error report<--

Also, it is impossible to browse this addon via widget creators. I wanted to create a widget with trenging videos, but Pipes is not showing in Video addons like any othe addon while choosing path for the widget.

Could you please help me? Piped is much better way of watching YouTube than the default application.

syhlx commented 4 months ago

I added a quick check for the missing information in playlists provided by the instance.

Can you try again with the new changes? -> Latest version You can then install as a ZIP in Kodi.

As for your querstion about adding to a widget: you should be able to, but, weirdly, the plugin was listed as service addon in the Official Kodi Repository instead of a video addon. I'll check with Kodi's maintainers for the next release.

StatelessOddity commented 4 months ago

Ok, there's a bit more info:

2024-03-18 21:15:33.792 T:22981   error <general>: GetDirectory - Error getting plugin://plugin.video.piped/feed
2024-03-18 21:15:33.806 T:849     error <general>: CGUIMediaWindow::GetDirectory(plugin://plugin.video.piped/feed) failed
2024-03-18 21:15:37.795 T:22988   error <general>: EXCEPTION Thrown (PythonToCppException) : -->Python callback/script returned the following error<--
                                                    - NOTE: IGNORING THIS CAN LEAD TO MEMORY LEAKS!
                                                   Error Type: <class 'requests.exceptions.JSONDecodeError'>
                                                   Error Contents: Expecting value: line 1 column 1 (char 0)
                                                   Traceback (most recent call last):
                                                     File "/storage/.kodi/addons/script.module.requests/lib/requests/models.py", line 971, in json
                                                       return complexjson.loads(self.text, **kwargs)
                                                              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
                                                     File "/usr/lib/python3.11/site-packages/simplejson/__init__.py", line 525, in loads
                                                     File "/usr/lib/python3.11/site-packages/simplejson/decoder.py", line 372, in decode
                                                     File "/usr/lib/python3.11/site-packages/simplejson/decoder.py", line 402, in raw_decode
                                                     File "/usr/lib/python3.11/site-packages/simplejson/scanner.py", line 79, in scan_once
                                                     File "/usr/lib/python3.11/site-packages/simplejson/scanner.py", line 70, in _scan_once
                                                   simplejson.errors.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

                                                   During handling of the above exception, another exception occurred:

                                                   Traceback (most recent call last):
                                                     File "/storage/.kodi/addons/plugin.video.piped/default.py", line 8, in <module>
                                                       router(sys.argv)
                                                     File "/storage/.kodi/addons/plugin.video.piped/lib/sections.py", line 285, in router
                                                       globals()[route](**routes[route])
                                                     File "/storage/.kodi/addons/plugin.video.piped/lib/sections.py", line 136, in subscriptions
                                                       list_channels(get(f'{instance}/subscriptions', headers={'Authorization': auth_token}).json())
                                                                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
                                                     File "/storage/.kodi/addons/script.module.requests/lib/requests/models.py", line 975, in json
                                                       raise RequestsJSONDecodeError(e.msg, e.doc, e.pos)
                                                   requests.exceptions.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
                                                   -->End of Python script error report<--

2024-03-18 21:15:37.873 T:22987   error <general>: GetDirectory - Error getting plugin://plugin.video.piped/subscriptions
2024-03-18 21:15:37.873 T:849     error <general>: CGUIMediaWindow::GetDirectory(plugin://plugin.video.piped/subscriptions) failed
2024-03-18 21:15:46.474 T:22995   error <general>: EXCEPTION Thrown (PythonToCppException) : -->Python callback/script returned the following error<--
                                                    - NOTE: IGNORING THIS CAN LEAD TO MEMORY LEAKS!
                                                   Error Type: <class 'requests.exceptions.JSONDecodeError'>
                                                   Error Contents: Expecting value: line 1 column 1 (char 0)
                                                   Traceback (most recent call last):
                                                     File "/storage/.kodi/addons/script.module.requests/lib/requests/models.py", line 971, in json
                                                       return complexjson.loads(self.text, **kwargs)
                                                              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
                                                     File "/usr/lib/python3.11/site-packages/simplejson/__init__.py", line 525, in loads
                                                     File "/usr/lib/python3.11/site-packages/simplejson/decoder.py", line 372, in decode
                                                     File "/usr/lib/python3.11/site-packages/simplejson/decoder.py", line 402, in raw_decode
                                                     File "/usr/lib/python3.11/site-packages/simplejson/scanner.py", line 79, in scan_once
                                                     File "/usr/lib/python3.11/site-packages/simplejson/scanner.py", line 70, in _scan_once
                                                   simplejson.errors.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

                                                   During handling of the above exception, another exception occurred:

                                                   Traceback (most recent call last):
                                                     File "/storage/.kodi/addons/plugin.video.piped/default.py", line 8, in <module>
                                                       router(sys.argv)
                                                     File "/storage/.kodi/addons/plugin.video.piped/lib/sections.py", line 285, in router
                                                       globals()[route](**routes[route])
                                                     File "/storage/.kodi/addons/plugin.video.piped/lib/sections.py", line 169, in playlists
                                                       list_playlists(get(f'{instance}/user/playlists', headers={'Authorization': auth_token}).json())
                                                                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
                                                     File "/storage/.kodi/addons/script.module.requests/lib/requests/models.py", line 975, in json
                                                       raise RequestsJSONDecodeError(e.msg, e.doc, e.pos)
                                                   requests.exceptions.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
                                                   -->End of Python script error report<--

If there's anything more I can do to help, I'll gladly do it.

syhlx commented 2 months ago

I think it was due to an expired session.

I added a "re-login" when this happens.

Can you try again with the new changes? -> Latest version Then, installing it as a ZIP in Kodi.

StatelessOddity commented 2 months ago

It works! Thank you for your work.