Kodi sync queue issue

Hi, I have Jellyfin 10.6.4 installed on raspberry pi 4 and have two accounts, one for me and one for my daughter. My account has admin privileges.Kodi sync queue plugin is installed and active on the server. I use kodi on windows 10 pc also with two profiles and again my account has admin privileges. Both profiles have sync queue enabled in the jellyfin plugin. In my daughters profile sync queue works, but in my profile whenever i enable it and logout, when i log in again there is no syncing and when i go to jellyfin plugin i see sync queue is disabled gy itself. What is the problem?

Also on jellyfin server i have tmdb box set installed and movies are split into collections, but there are no collections in kodi, each movie is separate. Collections are enabled in kodi library. What is the problem?

Sounds like there’s a couple things in play here, so I’ll try to split them up so we don’t lose anything.

  1. The plugin disabling itself in the server: This is likely just a graphical glitch, but it can be verified by starting Kodi when the plugin says it’s disabled. If Kodi is unable to reach the plugin endpoint it will give an error on startup.

  2. Not syncing. This one is trickier. Updates are synced to Kodi in 2 different ways depending on when the media is added/updated.

    • New content added to server when Kodi is not running: When Kodi starts, it reaches out to the plugin and says “give me all updated content from $DATE” which is the last time it checked in with the server. Any new content, watched status updates, etc will be synced at this time. This requires the Kodi Sync Queue plugin to be installed in the server.
    • New content added to server when Kodi is running: The server pushes out notifications and Kodi will process and add it to it’s local library immediately. This happens over a websocket connection and shouldn’t involve any other extra steps or requests.

    If Kodi isn’t syncing anything on startup, then that means that the sync queue plugin told it there were no new updates it needed since it’s last check in date. You can forcibly check if this is working by changing the date in $KODI_HOME/userdata/addon_data/plugin.video.jellyfin/sync.json to a time before when you know something was changed on the server. I’ll admit I’m not sure how well that works with multiple profiles, but I haven’t heard of issues in the past. What I suspect is happening is that for whatever reason your Kodi install missed an update from the server over websockets, but the sync date was changed by something later. From that point on it requests the newer date and there’s no new media since that date, so it doesn’t get a sync.

  3. Collections. Collections don’t automatically display in Kodi. I’m not sure why it’s not the default option, it’s a choice that Team Kodi made. There’s an option in Kodi located at Settings -> Media -> Videos called ‘Show movie sets’. I’m guessing this is what you’re looking for.

Thank you for your answer.

The first issue is definitely with sync queue. Jellyfin plugin is active, but when i start kodi it does not sync new movies and tv shows that i added. I noticed that movies and tv shows were not syncing and thats when i went into the plugin and noticed sync queue is not enabled even though i know i enabled it. Several times i re enabled it, but after log off and log on sync queue again shows as disabled.

Second issue, show movie sets is enabed in kodi and there are collections on jellyfin server, but again movie are not shown in collection in my kodi movie library

Hi mcarlton00,

I have been having similar issues with gettin Kodi Sync Queue enabled in the kodi plugin as well and might have a clue (or not!)

I’m new to Jellyfin and started on 10.6.4 a few weeks ago and had issues with getting the sync setting to stick in kodi despite it being installed properly server side. every time I logged in I got the message to enable it. I eventually got it working. Not sure how. I since updated to 10.7.0 RC1 and got the issue again.

Debug logs revealed it doing the companion check by hitting the datetime url:

2020-12-08 14:00:45.960 T:139677772281600 NOTICE: JELLYFIN.jellyfin.http -> ERROR::jellyfin_kodi/jellyfin/http.py:124 404 Client Error: Not Found for url: http://192.168.xxx.xxx:8096//Jellyfin.Plugin.KodiSyncQueue/GetServerDateTime

notice the double // ?

I edited line 262 of api.py:

        self._get("/Jellyfin.Plugin.KodiSyncQueue/GetServerDateTime")

and removed the leading / and sure enough, it worked. I’ve not looked fully into the code, but I have a feeling this is only called on a first sync, to check if the companion is installed, not sure. There is another call to that url which does not include the leading / as part of the datetime call which I think might be used in normal operation.

Anyway, if I’m right (and I’ve not had time to check thoroughly) this might explain some of the kody sync queue issues reported in the plugin?

Hi, thanks for the answer. Can you tell me where api.py is located, to try it myself? Is it on the jellyfin server or pc with kodi and in which folder?

I found api.py in /user/appdata/roaming/kodi/addons/jellyfin_kodi/jellyfin and there was a / in line 262 and i removed it. But again when i enter into master user on kodi sync queue is disabled. I tried even restarting the pc, but again i enable sync queue and when i exit and return to master user in kodi, sync queue is disabled

Whilst this got rid of the URL error for me on 10.7 RC1 (under linux), and the logs indicate it is successfully getting the time and date from the server addon, it doesn’t seem to sync any changed states whilst kodi was offline, so I think my problem might be different and is more related to the 10.7 RC1.

Apologies I probably chimed in too soon and led you astray. I think I will roll back to 10.6.4 and get things working again and clone my jellyfin VM and try 10.7 in a test environment first.

Hi mcarlton00,

I hope this is helpful to you. For Jellyfin 10.7 RC1, kodi sync queue doesn’t seem to work. I’m a novice, but I’ve found 2 issues that seem to fix it:

  1. Double slash in URL for the check_companion_installed API call:

As mentioned in api.py in the kodi addon def check_companion_installed prepends a slash, causing a double slash and breaking the URL sent to the API, at least for me. Removing this allows the plugin to connect initially.

  1. User-ID mismatch due to inconsistent hyphens between kodi client and server:

The kodi addon seems to record and send the User-ID with dashes in it, whilst the jellyfin plugin seems to be using the User-ID with no dashes, so it’s no longer the same user, and no records match.

If I look at the logs I see the API call as

"url": "http://{jellyfin-server}/Jellyfin.Plugin.KodiSyncQueue/db8c3138-7290-494a-a42c-3bb1321e6ff6/GetItems",

If I plug this into a browser I get no records, but if I remove the hyphens I get the changed records, ie:

http://jellyfin:8096/Jellyfin.Plugin.KodiSyncQueue/db8c31387290494aa42c3bb1321e6ff6/GetItems

If I hack ~/.kodi/userdata/addon_data/plugin.video.jellyfin/data.json on my kodi box and remove the hyphens from the user id, turn it off, make some changes under that account via the jellyfin web client (ie watched status) and then login to kodi again, the watched status updates.

Obviously that’s not a permanent fix. I don’t know where/how these user id’s are derived and why one side uses hyphens and the other doesn’t but someone more familiar with the code would, I’m guessing that’s a breaking change for 10.7 for this plugin.

I hope this helps, as I think the kodi sync queue plugin may not work for anybody under 10.7 RC1 currently (unless my system is seriously messed up!)

Thanks for the digging, it should be helpful tracking down why some users have errors and others don’t.

I believe the double slash is a non-blocking error in 10.6.x versions, however in 10.7 it is. We’re working on addressing those in this PR with test builds available here. So far we’ve found the Sync Queue request and a request for subtitles both failing with double slashes. Just another lingering pain point of the legacy codebase. Though to my knowledge the user IDs shouldn’t matter. In every other instance the server accepts with and without hyphens, so that will definitely need more investigating.

10.7-rc1 requires Kodi Sync Queue version 6 to be installed in the server, while 10.6.4 requires version 5. That might be why you’re seeing it failing to be activated if the wrong version is installed.

Double slash results in a 404 on a empty page.

Improperly formatted hyphens result in a 500 with the body Error processing request.
Error in server logs:
System.FormatException: Guid should contain 32 digits with 4 dashes (xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx).

Proper hyphens, and no hyphens at all both result in the expected json payload.

I have jellyfin 10.6.4 with sync queue plugin 5.0.0 installed on raspberry os 64-bit and jellyfin for kodi 0.6.5+py2 installed on kodi 18.9.0 on windows 10 pc.

Sync queue disables itself for my master user, but works on my second kodi profile created for my daughter.

If it is helpful i can collect logs what happens when i start master user and what happens if i start my daughters profile.

Just please give me step by step guide how to collect logs.

Do NOT enable Kodi debug logging.

i can’t upload log file. it says extension is not authorized.

Hi mcarlton00,

Thanks for pointing me to the PR, I didn’t find that when I looked. I’ve done some more testing on a test kodi install for the hyphens in user ID issue. Note this is all with Kodi 18.9 and the Jellyfin Kodi Addon 0.65+py2. I get the same behaviour under libreelec (Linux) and an OSX kodi install. (On the same test install I re-verified that I need to remove the leading slash in the check_companion_installed function in order to have sync work at all - that seems consistent for me).

This kodi install was previously connected to a Jellyfin 10.6.4 server, which was updated to 10.7.0 RC1 and is most definitely running the version 6 of the Kodi Sync Queue plugin. I’ve uninstalled/reinstalled and verified in the filesystem and log, have restarted the server etc.

When the server was on 10.6.4, the userdata/addon_data/plugin.video.jellyfin/data.json file looked like this:

{
    "Servers": [
        {
            "AccessToken": "5ed23eecac6c405db678e48233a2b647",
            "DateLastAccessed": "2020-12-04T20:31:20Z",
            "Id": "acb3a2488459464bb011f722f1dc4e06",
            "Name": "jellyfin",
            "UserId": "db8c31387290494aa42c3bb1321e6ff6",
            "Users": [
                {
                    "Id": "db8c31387290494aa42c3bb1321e6ff6",
                    "IsSignedInOffline": true
                }
            ],
            "address": "http://192.168.xxx.xxx:8096"
        }
    ]
}

After running kodi against the 10.7.0 RC1 server, the same file looked like this:

{
    "Servers": [
        {
            "AccessToken": "6e5bfa242fb14c64a9d1afb1fb8d5302",
            "DateLastAccessed": "2020-12-09T10:57:46Z",
            "Id": "acb3a2488459464bb011f722f1dc4e06",
            "Name": "jellyfin",
            "UserId": "db8c3138-7290-494a-a42c-3bb1321e6ff6",
            "Users": [
                {
                    "Id": "db8c31387290494aa42c3bb1321e6ff6",
                    "IsSignedInOffline": true
                },
                {
                    "Id": "db8c3138-7290-494a-a42c-3bb1321e6ff6",
                    "IsSignedInOffline": true
                }
            ],
            "address": "http://192.168.xxx.xxx:8096"
        }
    ]
}

Hyphens have appeared. Note the duplicate “Id” in “Users”, one with hyphens and one without. Not sure about that, regardless the issue appears to be with the UserID entry in “Servers”, not the “Id”'s in “Users”.

With kodi not running I now go and mark a movie as watched in the jellyfin web UI. Then restart kodi.

On the server I get the following in the logs with the “UserId”: “db8c3138-7290-494a-a42c-3bb1321e6ff6” in the data.json:

[2020-12-09 11:22:59.083 +11:00] [INF] [83] Jellyfin.Plugin.KodiSyncQueue.API.KodiSyncQueueController: Server Time Requested…
[2020-12-09 11:22:59.126 +11:00] [INF] [102] Jellyfin.Plugin.KodiSyncQueue.API.KodiSyncQueueController: Sync Requested for UserID: ‘“db8c3138-7290-494a-a42c-3bb1321e6ff6”’ with LastUpdateDT: ‘“2020-12-09T00:02:13z”’
[2020-12-09 11:22:59.129 +11:00] [INF] [102] Jellyfin.Plugin.KodiSyncQueue.API.KodiSyncQueueController: Added: 0, Removed: 0, Updated: 0, Changed User Data: 0
[2020-12-09 11:22:59.129 +11:00] [INF] [102] Jellyfin.Plugin.KodiSyncQueue.API.KodiSyncQueueController: Request Finished Taking “00:00:00.0026477”

If I stop kodi, hack the json so the “UserID” in “Servers” has no dashes, then start again I get the following in the server log, and the kodi log reflects this, pulling down the changes and reflecting the watched status after starting kodi and logging in.

[2020-12-09 11:32:34.471 +11:00] [INF] [108] Jellyfin.Plugin.KodiSyncQueue.API.KodiSyncQueueController: Server Time Requested…
[2020-12-09 11:32:34.524 +11:00] [INF] [58] Jellyfin.Plugin.KodiSyncQueue.API.KodiSyncQueueController: Sync Requested for UserID: ‘“db8c31387290494aa42c3bb1321e6ff6”’ with LastUpdateDT: ‘“2020-12-09T00:02:13z”’
[2020-12-09 11:32:34.528 +11:00] [INF] [58] Jellyfin.Plugin.KodiSyncQueue.API.KodiSyncQueueController: Added: 0, Removed: 0, Updated: 0, Changed User Data: 1
[2020-12-09 11:32:34.528 +11:00] [INF] [58] Jellyfin.Plugin.KodiSyncQueue.API.KodiSyncQueueController: Request Finished Taking “00:00:00.0036946”

So in short, the “UserId” field only seems to work without dashes, the “Users”:“Id” field doesn’t seem to matter either way. Perhaps importantly, I’m not getting an error in the logs when hyphens are used, just no records.

In my kodisyncqueue.db file all the User ID’s seem to be listed without dashes if that matters.

Hopefully this helps pinpoint the issue.

Kikinho I’m sorry I’ve seemed to of hijacked your thread, I originally thought our issues were related but they may not be, but I have experienced what you have on 10.6.4 and it did eventually start working but I’m not sure why or how. I believe multiple reset local databases and re-setup of the plugin may have done it - it might be to do with how you specify the server - manually or auto discovery or something. From what I can tell, the sync option will disable itself on login if that api call for the date and time fails, but there could be other reasons too.

I wish I could help you more but I’m barely scratching the surface myself as I’m very new to jellyfin so largely in the same boat as you - trying to figure it all out. If you can’t get it working it might be worth waiting for 10.7 and updating? - perhaps the changes the team are working on now might mean it works better for you. Also, I’m not convinced profiles in kodi doesn’t cause problems - I’m pretty sure there are bugs and quirks there too which might be having an impact.

That is some excellent investigative work. Major thanks for digging through all of that. We’ve confirmed it and I’ve opened an issue on the main repo to look into reverting the user id format change here.

Can you put the contents into pastebin or something similar and send us a link?

Also when you say that it’s disabling itself, you mean that the UI in the server dashboard says it’s disabled, correct? When you start Kodi on your master user, does it give you a popup saying that it’s not working as intended?

Here is a link to my Google Drive where I have put log files for master and nina profile. Master is my profile and nina is my daughters profile.

I have added identical new movie in jellyfin database for both users and I have seen that movie is shown in database for both users.

After that I started kodi and first entered my daughter profile, then mine.
In my daughters profile new movie was shown, which proves that sync queue works.
In my profile new movie was not shown and I went into Jellyfin for Kodi addon and as always sync queue was disabled.

About your question, Kodi does not give any popup. Also Jellyfin dashboard does not give any notification for sync queue issues. For both profiles Jellyfin dashboard just informs that user was online and then disconnected

I’m going to ask a potentially stupid question, but it needs to be asked. When you go into the addon settings on your master user and enable toggle the “Enable Kodi Sync Queue” setting, are you exiting by pressing back or by moving the cursor over and selecting “Ok”? Going back doesn’t save your changes, only pressing OK does.

The logic for this is happening in plugin.video.jellyfin/jellyfin_kodi/library.py at line 330. What I’m assuming is happening is it’s checking if the initial setup is complete (line 330, it succeeds), then checking if that setting is enabled (line 331, it isn’t) and proceeds. Judging by the log messages on your master user, that’s the only thing that’s making sense.

I’ve just set up 2 profiles for different users on my server and the only way I can replicate this is if I’ve manually set the sync queue setting on the master user to disabled.

Soory for my late answer. I had issues with my raspberry pi server and needed to reinstall it. After reinstallation of the server and enableing kodi sync queue setting everything works. I don’t know if i didn’t click ok previously or it was something else, but now sync works for both profiles.

Thanks to everybody for the help.

I recently updated from Jellyfin 10.5.5 to 10.6.4 and have noticed my Kodi isn’t syncing changes anymore. I see that the plugin isn’t installed anymore after the upgrade and tried to reinstall version 6.0.0 of Kodi Sync Queue but get the infinite spinning loading circle and the plugin never installed. I did some digging around in the Docker folder on my Synology NAS and found that the plugin folder is still there under jellyfin/config/plugins so i tried deleting that along with the .xml file found in jellyfin/config/plugins/configuration then cleared my Docker container and restarted Jellyfin. I am still unable to install Kodi Sync Queue plugin.

Any ideas what to try next?