jellyfin / jellyfin-kodi

Jellyfin Plugin for Kodi
https://jellyfin.org
GNU General Public License v3.0
820 stars 111 forks source link

library update broken with last Jellyfin server update #861

Closed axionman closed 4 months ago

axionman commented 4 months ago

Hello

Since I updated Jellyfin server to 10.9.0 and 10.9.1 the library won't update automatically after starting Kodi. A manual library update within the Jellyfin addon in Kodi works however.

I'm currently running Jellyfin server on Openmediavault and Kodi 21.0.1 on a Nvidia Shield Pro 2019 with latest Jellyfin for Kodi addon 1.0.2+py3

h3llrais3r commented 4 months ago

Same issue here after updating to latest jellyfin server version 10.9.1 (coming from 10.8.9). Running Jellyfin server on windows and kodi on chromecast with google tv (android) with latest kodi jellyfin addon (1.0.2).

mcarlton00 commented 4 months ago

Pretty sure this is an upstream issue being tracked at https://github.com/jellyfin/jellyfin-plugin-kodisyncqueue/issues/83

nothing2obvi commented 4 months ago

I know it's being tracked at Kodi Sync Queue but just wanted to say I'm experiencing the same problem.

axionman commented 4 months ago

It has been fixed at my side since I updated Kodi Sync Queue extension on Jellyfin server to 11.0.0.0

LentulisBatiatus commented 4 months ago

Having the same issue. Running Kodi v20 on some testing and have my JF server updated to 10.9.1 and the Kodi Sync Que updated to 11.0.0.0. Updates will not push to a running Kodi v20 client and also fails to update when closing and restarting Kodi.

The other JF server I manage won't update to KSQ 11 and I'm not sure why/how to. The version numbers of the Kodi add-on are confusing as well. In Kodi it shows 0.7.11+py3 but here on Git it's 1.0.2? I'm lost somewhere.

Everything was working fine with JF 10.8 previously on various Kodi clients running v18 or v20.. All on Windows 10 PCs

ismay commented 4 months ago

It has been fixed at my side since I updated Kodi Sync Queue extension on Jellyfin server to 11.0.0.0

This hasn't fixed it for me. Still won't sync.

darkguy-git commented 4 months ago

Same here, issue not fixed. Running 10.9.1 as a Docker container from li uxserver.io with the 11.0.0.0 update installed and active on Unraid. Kodi 21/21.0.1 on various devices (Android phone, Android tablet, various Fire TV sticks, NVIDIA Shield 2019 Pro, Windows 10)

ismay commented 4 months ago

I've done a local database reset on kodi, whilst retaining the jellyfin kodi plugin's settings. That did pull in new media on the initial sync, but I don't know if it will pick up any future new media.

edit: after adding new media, can confirm that for me the local database reset in kodi seems to have fixed the issue. It's now properly syncing new media as well.

h3llrais3r commented 4 months ago

The error about the transactions is gone on the jellyfin server, but the plugin in kodi is still throwing errors. This is a stacktrace at startup, maybe it can help someone to identify the issue. The /Plugins endpoint doens't seem accessible, as it returns a Forbidden error.

2024-05-16 09:13:43.545 T:8540     info <general>: JELLYFIN -> INFO::jellyfin_kodi/jellyfin/__init__.py:98 ---[ START JELLYFINCLIENT ]---
2024-05-16 09:13:43.566 T:8540     info <general>: JELLYFIN.jellyfin_kodi.jellyfin.connection_manager -> INFO::jellyfin_kodi/jellyfin/connection_manager.py:177 Begin connect
2024-05-16 09:13:43.573 T:8540     info <general>: JELLYFIN.jellyfin_kodi.jellyfin.connection_manager -> INFO::jellyfin_kodi/jellyfin/connection_manager.py:58 Begin getAvailableServers
2024-05-16 09:13:44.595 T:8540     info <general>: JELLYFIN.jellyfin_kodi.jellyfin.connection_manager -> INFO::jellyfin_kodi/jellyfin/connection_manager.py:241 Found Servers: []
2024-05-16 09:13:44.609 T:8540     info <general>: JELLYFIN.jellyfin_kodi.jellyfin.connection_manager -> INFO::jellyfin_kodi/jellyfin/connection_manager.py:180 connect has 1 servers
2024-05-16 09:13:44.616 T:8540     info <general>: JELLYFIN.jellyfin_kodi.jellyfin.connection_manager -> INFO::jellyfin_kodi/jellyfin/connection_manager.py:155 begin connectToServer
2024-05-16 09:13:44.630 T:8540     info <general>: JELLYFIN.jellyfin_kodi.jellyfin.api -> INFO::jellyfin_kodi/jellyfin/api.py:417 Sending get request to system/info/public
2024-05-16 09:13:44.678 T:8540     info <general>: JELLYFIN.jellyfin_kodi.jellyfin.connection_manager -> INFO::jellyfin_kodi/jellyfin/connection_manager.py:164 calling onSuccessfulConnection with server SERVER
2024-05-16 09:13:44.691 T:8540     info <general>: JELLYFIN.jellyfin_kodi.jellyfin.api -> INFO::jellyfin_kodi/jellyfin/api.py:417 Sending get request to system/info
2024-05-16 09:13:44.756 T:8540     info <general>: JELLYFIN.jellyfin_kodi.jellyfin.client -> INFO::jellyfin_kodi/jellyfin/client.py:58 User is authenticated.
2024-05-16 09:13:44.890 T:8542     info <general>: JELLYFIN.jellyfin_kodi.jellyfin.ws_client -> INFO::jellyfin_kodi/jellyfin/ws_client.py:55 Websocket url: ws://{jellyfin-server}/socket?api_key={jellyfin-token}&device_id=84d92bca-9758-4f11-af1b-f1690dcb50c6
2024-05-16 09:13:44.946 T:8530     info <general>: JSONRPC Server: New connection added
2024-05-16 09:13:45.212 T:8543     info <general>: JELLYFIN.jellyfin_kodi.library -> INFO::jellyfin_kodi/library.py:84 --->[ library ]
2024-05-16 09:13:45.280 T:8540    error <general>: EXCEPTION Thrown (PythonToCppException) : -->Python callback/script returned the following error<--
                                                    - NOTE: IGNORING THIS CAN LEAD TO MEMORY LEAKS!
                                                   Error Type: <class 'IndexError'>
                                                   Error Contents: list index out of range
                                                   Traceback (most recent call last):
                                                     File "/storage/emulated/0/Android/data/org.xbmc.kodi/files/.kodi/addons/plugin.video.jellyfin/jellyfin_kodi/monitor.py", line 148, in onNotification
                                                       self.server_instance(data['ServerId'])
                                                     File "/storage/emulated/0/Android/data/org.xbmc.kodi/files/.kodi/addons/plugin.video.jellyfin/jellyfin_kodi/monitor.py", line 164, in server_instance
                                                       server.config.data['app.session'] = session[0]['Id']
                                                                                           ~~~~~~~^^^
                                                   IndexError: list index out of range
                                                   -->End of Python script error report<--

2024-05-16 09:13:45.319 T:8535     info <general>: VideoInfoScanner: Starting scan ..
2024-05-16 09:13:45.329 T:8535     info <general>: VideoInfoScanner: Finished scan. Scanning for video info took 18 ms
2024-05-16 09:13:45.389 T:8540     info <general>: JELLYFIN.jellyfin_kodi.monitor -> INFO::jellyfin_kodi/monitor.py:42 -->[ kodi scan/video ]
2024-05-16 09:13:45.397 T:8540     info <general>: JELLYFIN.jellyfin_kodi.monitor -> INFO::jellyfin_kodi/monitor.py:45 --<[ kodi scan/video ]
2024-05-16 09:13:45.433 T:8543     info <general>: JELLYFIN.jellyfin_kodi.database -> INFO::jellyfin_kodi/database/__init__.py:154 Database locked in: /storage/emulated/0/Android/data/org.xbmc.kodi/files/.kodi/userdata/Database/MyVideos131.db
2024-05-16 09:13:45.523 T:8543     info <general>: JELLYFIN.jellyfin_kodi.database -> INFO::jellyfin_kodi/database/__init__.py:154 Database locked in: /storage/emulated/0/Android/data/org.xbmc.kodi/files/.kodi/userdata/Database/MyMusic83.db
2024-05-16 09:13:46.231 T:8543     info <general>: JELLYFIN.jellyfin_kodi.objects.kodi.movies -> INFO::jellyfin_kodi/objects/kodi/movies.py:162 Starting migration for Omega database changes
2024-05-16 09:13:46.241 T:8543     info <general>: JELLYFIN.jellyfin_kodi.objects.kodi.movies -> INFO::jellyfin_kodi/objects/kodi/movies.py:172 Omega database migration is complete
2024-05-16 09:13:47.008 T:8542     info <general>: JELLYFIN.jellyfin_kodi.jellyfin.ws_client -> INFO::jellyfin_kodi/jellyfin/ws_client.py:73 --->[ websocket opened ]
2024-05-16 09:13:47.547 T:8543     info <general>: JELLYFIN.jellyfin_kodi.jellyfin.http -> ERROR::jellyfin_kodi/jellyfin/http.py:124 403 Client Error: Forbidden for url: http://{jellyfin-server}/Plugins
2024-05-16 09:13:47.579 T:8543     info <general>: JELLYFIN.jellyfin_kodi.library -> ERROR::jellyfin_kodi/library.py:386 (403, HTTPError('403 Client Error: Forbidden for url: http://{jellyfin-server}/Plugins'))
                                                   Traceback (most recent call last):
                                                     File "jellyfin_kodi/jellyfin/http.py", line 96, in request
                                                       r.raise_for_status()
                                                     File "/storage/emulated/0/Android/data/org.xbmc.kodi/files/.kodi/addons/script.module.requests/lib/requests/models.py", line 1021, in raise_for_status
                                                       raise HTTPError(http_error_msg, response=self)
                                                   requests.exceptions.HTTPError: 403 Client Error: Forbidden for url: http://{jellyfin-server}/Plugins

                                                   During handling of the above exception, another exception occurred:

                                                   Traceback (most recent call last):
                                                     File "jellyfin_kodi/library.py", line 356, in startup
                                                       if self.server.jellyfin.check_companion_installed() is not False:
                                                          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
                                                     File "jellyfin_kodi/jellyfin/api.py", line 269, in check_companion_installed
                                                       for x in self.get_plugins()
                                                                ^^^^^^^^^^^^^^^^^^
                                                     File "jellyfin_kodi/jellyfin/api.py", line 258, in get_plugins
                                                       return self._get("Plugins")
                                                              ^^^^^^^^^^^^^^^^^^^^
                                                     File "jellyfin_kodi/jellyfin/api.py", line 61, in _get
                                                       return self._http("GET", handler, {'params': params})
                                                              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
                                                     File "jellyfin_kodi/jellyfin/api.py", line 58, in _http
                                                       return self.client.request(request)
                                                              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
                                                     File "jellyfin_kodi/jellyfin/http.py", line 159, in request
                                                       raise HTTPException(r.status_code, error)
                                                   jellyfin_kodi.helper.exceptions.HTTPException: (403, HTTPError('403 Client Error: Forbidden for url: http://{jellyfin-server}/Plugins'))

2024-05-16 09:13:47.586 T:8543     info <general>: JELLYFIN.jellyfin_kodi.library -> INFO::jellyfin_kodi/library.py:105 ---<[ library ]

@nielsvanvelzen Could this change (https://github.com/jellyfin/jellyfin/pull/11436) have broken the plugin as it now throws a Forbidden error?

nielsvanvelzen commented 4 months ago

The /Plugins endpoint doens't seem accessible, as it returns a Forbidden error.

@nielsvanvelzen Could this change (jellyfin/jellyfin#11436) have broken the plugin as it now throws a Forbidden error?

Yes, and we're not going to revert that. So the fix would need to be made client-side, which shouldn't be that difficult.

mcarlton00 commented 4 months ago

For those of you looking for a very quick and dirty fix and have access to the source on your devices, change this line

https://github.com/jellyfin/jellyfin-kodi/blob/fbc8a99b0fb9cbf2ed40d10accaec4b0bd472fd7/jellyfin_kodi/jellyfin/api.py#L285

from False to True. This URL path is now only valid for admin users for security, so we need to build some more logic into the addon to prevent it causing issues on non-admin users. I'm hoping to get to that this weekend, but this should enough to get things flowing again until we have time.

h3llrais3r commented 4 months ago

@mcarlton00 Your proposed workaround does not work for me... The exception is caught in http.py and a new HTTPException is raised. Due to this, the check_companion_installed call never returns. As a workaround, I added an addtional except HTTPException to catch the exception raised in the http.py. This also requires the import of the HTTPException in the api.py. To make it easier, you can find the modified api.py here: api.zip

For anyone who doesn't want to use the content of the zip file, these are the added lines in api.py:

image

image

Tested on one of my chromecast installations and the sync works again. But as mentioned, this is only a quick and dirty workaround until a permanent solution is found (authenticated /Plugins call).

DaveMinion commented 4 months ago

This (temporary) fix works on one of my Kodi v20.5 clients but so far not the other.

darkguy-git commented 4 months ago

Temporary fix for me, hopefully not too far off-topic: I installed the JellyCon plugin for Kodi alongside the Jellyfin plugin and use that to access my libraries and watch content for now.

ddalben commented 4 months ago

Since the release of 10.9 and 10.9.1 my Jellyfin Kodu setups have been unreliable. The update to the kodiqueuesync plugin didn't seem to help. My issue seems to be authentication.

Jellyfin running in an LSIO Container on Unraid Logs below from my Windows based Kodi setup.

Whenever Kodi starts I was getting: [10:54:05] [INF] [43] Jellyfin.Api.Auth.CustomAuthenticationHandler: CustomAuthentication was not authenticated. Failure message: Invalid token. [10:54:05] [INF] [43] Jellyfin.Api.Auth.CustomAuthenticationHandler: CustomAuthentication was not authenticated. Failure message: Invalid token. [10:54:05] [INF] [11] Jellyfin.Api.Auth.CustomAuthenticationHandler: CustomAuthentication was not authenticated. Failure message: Invalid token. [10:54:05] [INF] [11] Jellyfin.Api.Auth.CustomAuthenticationHandler: CustomAuthentication was not authenticated. Failure message: Invalid token.

I deleted the Jellyfin addon and reinstalled it and ran a full library sync [10:58:56] [INF] [23] Jellyfin.Server.Implementations.Users.UserManager: Authentication request for jsmith has succeeded. [10:58:56] [INF] [23] Emby.Server.Implementations.Session.SessionManager: Current/Max sessions for user radikal: 0/0 [10:58:56] [INF] [23] Emby.Server.Implementations.Session.SessionManager: Creating new access token for user xxxxx-xxx-xxxx-xxxx-xxxxxxxxxxx [10:58:57] [INF] [22] Emby.Server.Implementations.HttpServer.WebSocketManager: WS 10.10.1.10 request [11:00:00] [INF] [3] Emby.Server.Implementations.Session.SessionWebSocketListener: Lost 1 WebSockets. [11:00:08] [INF] [45] Jellyfin.Plugin.KodiSyncQueue.EntryPoints.LibrarySyncNotification: Started library sync [11:00:14] [INF] [45] Jellyfin.Plugin.KodiSyncQueue.EntryPoints.LibrarySyncNotification: Library Sync: Added 61 items [11:00:14] [INF] [45] Jellyfin.Plugin.KodiSyncQueue.EntryPoints.LibrarySyncNotification: Finished library sync, taking 00:00:06.0926291

Stopped and started Kodi again and I see these errors, there's no welcome to message from the server [11:08:52] [INF] [29] Jellyfin.Api.Auth.CustomAuthenticationHandler: AuthenticationScheme: CustomAuthentication was forbidden. [11:10:45] [INF] [22] Jellyfin.Api.Auth.CustomAuthenticationHandler: AuthenticationScheme: CustomAuthentication was forbidden. [11:11:53] [INF] [20] Jellyfin.Api.Auth.CustomAuthenticationHandler: AuthenticationScheme: CustomAuthentication was forbidden.

Just not working for me

mcarlton00 commented 4 months ago

Summary:

There were two bugs in play here.

If you're still having issues after updating, please open a new issue.

hoewer commented 4 months ago

@h3llrais3r Thanx for your "quick and dirty workaround". Since I'm bound to Kodi 18 for technical reasons, I can only use a py2 version of the addon. The global fix in addon 1.0.3 therefore doesn't help me. But your workaround seems to work...