Jellyfin for Kodi 0.5.6 breaks KodiSyncQueue

Hi there,
first of all: Thank you very much for this great Project. I switched from a shared Database Implementation (MySQL) on Kodi to Jellyfin 3 Months ago and I am absolutely happy with it.

Unfortunately I came across a situation with the latest Upgrade of the Jellyfin for Kodi addon to Version 0.5.6 that I can’t seem to fix.
I am running Jellyfin 10.5.5 in Docker on Debian Buster, using Kodi 18.7 from 3 different clients with the latest Jellyfin for Kodi Addon. I am using Kodi Sync Queue 4.0.0 to keep the libraries in sync.

Since the Update of the Jellyfin for Kodi Addon I get an Notification each and every time Kodi starts that it can’s sync with Jellyfin.

In the Debug log of Kodi the response for the Sync Request looks like this:

2020-06-06 10:06:31.313 T:3416863456 NOTICE: JELLYFIN.library -> ERROR::jellyfin_kodi/library.py:366 Failed to retrieve latest updates
Traceback (most recent call last):
File “jellyfin_kodi/library.py”, line 337, in startup
raise Exception(“Failed to retrieve latest updates”)
Exception: Failed to retrieve latest updates

On the Server-Side I see this Error happening:

[2020-06-06 10:06:27.451 +02:00] [INF] [22] App: Sync Requested for UserID: ‘“e30f82e036bd4a908a45be9a549b8d8e”’ with LastUpdateDT: ‘“2020-06-05T15:21:53z”’
[2020-06-06 10:06:28.027 +02:00] [ERR] [22] Emby.Server.Implementations.HttpServer.HttpListenerHost: Error processing request. URL: “http://192.168.100.26:8096/Jellyfin.Plugin.KodiSyncQueue/e30f82e036bd4a908a45be9a549b8d8e/GetItems?LastUpdateDT=2020-06-05T15%3A21%3A53z
System.ArgumentNullException: Value cannot be null. (Parameter ‘source’)

The request itself from Kodi looks like this in the Debug log:

2020-06-06 10:06:27.437 T:3416863456 NOTICE: JELLYFIN.jellyfin.http -> DEBUG::jellyfin_kodi/jellyfin/http.py:84 —>[ http ] {
“url”: “http://192.168.100.26:8096/Jellyfin.Plugin.KodiSyncQueue/e30f82e036bd4a908a45be9a549b8d8e/GetItems”,
“verify”: true,
“headers”: {
“Accept-Charset”: “UTF-8,*”,
“Accept-encoding”: “gzip”,
“X-MediaBrowser-Token”: “{jellyfin-token}”,
“Content-type”: “application/json”,
“x-emby-authorization”: “MediaBrowser Client=Kodi, Device=osmc-wz, DeviceId=9c3523ab-5328-4318-adc9-8e80eb78cee6, Version=0.5.6, UserId=e30f82e036bd4a908a45be9a549b8d8e”,
“User-Agent”: “Jellyfin-Kodi/0.5.6”
},
“params”: {
“filter”: null,
“LastUpdateDT”: “2020-06-05T15:21:53z”
},
“timeout”: 30,
“type”: “GET”
}

When I go back with the Addon to Version 0.5.5, everything is running fine again. I suspect the filter: null in the request is creating a porblem here, but I can’t understand why I seem to be the only one experiencing this problem…

What I already tried on Kodi side is to re-initalize everything and repairing databases - both actions didn’t solve. Only Downgrading seems to help right now.

I’d really appreciate any hint on this issue. If there is any Information missing, I am more than happy to deliver.

Best Regards from Hamburg/Germany
Michael

Hmm, I suspect this might be related to this change, though it shouldn’t be breaking anything from the testing we did. You should be able to test this yourself by opening a browser where you’re logged in and going to

http://192.168.100.26:8096/Jellyfin.Plugin.KodiSyncQueue/e30f82e036bd4a908a45be9a549b8d8e/GetItems?LastUpdateDT=2020-06-05T15:21:53z&filter=null

What media types do you have synced locally? Perhaps we overlooked something during testing.

Actually I lied. I’ve just confirmed that having Mixed Content libraries synced locally is broken with version 0.5.6. I know where the fix is, so we’ll have a new release pushed this weekend to get that out there.

Hi mcarlton00,

thank you very much for looking into this so quickly. As you already assumed I have a mixed-content library (syncing Shows, Movies, Albums and Musicvideos).

Good to hear, that you could identify the root-cause. I’ll wait for the next release and give you feedback.

Best Regards
Michael

Ah this clears up my confusion as to why no new items have been showing up in kodi lately out of the blue.
Baffled me as it would connect to jellyfin and display the welcome username message but wouldn’t sync up.

Essentially we need to wait for v0.5.7 then?

On a somewhat related note, can anyone point me to some help as to why I have files in ‘Videos’ and ‘Home Movies’ showing up in the Movies and TV Shows section in kodi? I use estuary mod on nvidia shield.

What kind of Library are your home movies saved in? Is it “Photos” or “Mixed Content”?
(Note to all: “Mixed Content” is never the correct answer.)

Mixed content for both. Home movies being just that and Videos being stuff that doesn’t fit in either Movies or TV Shows i.e. shorts, standup, ballet/opera etc.

Kodi doesn’t have types for generic videos or home videos. Everything is purely a movie/tv show and they all go into the same database. The Embuary skin seems to have some custom view options that may help, or you can edit your menu items to point to a specific library in Jellyfin (but I don’t think the default Estuary skin allows this).

Edit: you can downgrade the addon to v0.5.5 to fix the auto sync, but v0.5.7 should be out in the next day or two. I want to get https://github.com/jellyfin/jellyfin-kodi/pull/310 in as well before pushing a release

Jellyfin for Kodi 0.5.7 has just been released, it should solve any syncing problems you were having.

Updated and all working again! :smiley:

Hi, thank you very much for taking care of this issue. Unfortunately for me the issue is still there with 0.5.7.
Downgrading to 0.5.5 solves the Problem (again).

In the log, I see the request been built (again with filter null):

2020-06-11 17:19:50.348 T:3476091616 NOTICE: JELLYFIN.jellyfin.http -> DEBUG::jellyfin_kodi/jellyfin/http.py:84 —>[ http ] {
“url”: “http://{jellyfin-server}/Jellyfin.Plugin.KodiSyncQueue/e30f82e036bd4a908a45be9a549b8d8e/GetItems”,
“verify”: true,
“headers”: {
“Accept-Charset”: “UTF-8,*”,
“Accept-encoding”: “gzip”,
“X-MediaBrowser-Token”: “{jellyfin-token}”,
“Content-type”: “application/json”,
“x-emby-authorization”: “MediaBrowser Client=Kodi, Device=osmc-sz, DeviceId=0202f6cb-e889-4832-9b6b-bee3a8a240b1, Version=0.5.7, UserId=e30f82e036bd4a908a45be9a549b8d8e”,
“User-Agent”: “Jellyfin-Kodi/0.5.7”
},
“params”: {
“filter”: null,
“LastUpdateDT”: “2020-06-11T10:42:36z”
},
“timeout”: 30,
“type”: “GET”
}

Here is the URL that’s built:

2020-06-11 17:19:50.508 T:3476091616 NOTICE: JELLYFIN.jellyfin.http -> ERROR::jellyfin_kodi/jellyfin/http.py:124 400 Client Error: Bad Request for url: http://{jellyfin-server}/Jellyfin.Plugin.KodiSyncQueue/e30f82e036bd4a908a45be9a549b8d8e/GetItems?LastUpdateDT=2020-06-11T10%3A42%3A36z

On Serverside it looks like this than (no surprise, I guess):

[2020-06-11 17:19:50.499 +02:00] [ERR] [80] Emby.Server.Implementations.HttpServer.HttpListenerHost: Error processing request. URL: “http://192.168.100.26:8096/Jellyfin.Plugin.KodiSyncQueue/e30f82e036bd4a908a45be9a549b8d8e/GetItems?LastUpdateDT=2020-06-11T10%3A42%3A36z
System.ArgumentNullException: Value cannot be null. (Parameter ‘source’)

Is there anything I can do to narrow the Problem down? Right now I am back to 0.5.5, but of course I am willing to perform tests with 0.5.7

And one more thing, I first misunderstood: I don’t use “mixed-content” libraries in Jellyfin. I thought you were asking, whether I sync different Media-Types (which is true), but all of my Jellying-Libraries are of a specific type (Music-Video, Music, Movies, Tv-Shows - none of them is mixed)

Regards
Michael

Hmm. Ok I know why it’s broken for you, I just don’t understand why (if you know what I mean).

That URL requires both a LastUpdateDT and a filter parameter. I’m assuming that you have a library of each type synced, so when it goes to build the URL is just ignores the filter keyword.

Chances are, if you go to http://192.168.100.26:8096/Jellyfin.Plugin.KodiSyncQueue/e30f82e036bd4a908a45be9a549b8d8e/GetItems?LastUpdateDT=2020-06-11T10%3A42%3A36z in a browser, it will error, but if you go to http://192.168.100.26:8096/Jellyfin.Plugin.KodiSyncQueue/e30f82e036bd4a908a45be9a549b8d8e/GetItems?LastUpdateDT=2020-06-11T10%3A42%3A36z&filter=null it will work. I need to track down how that’s being excluded from the API call.

Actually no, that’s not the issue. You should be able to request that URL just fine without having filter=null on the end. I can’t seem to replicate this. I’ve got Movies, TV Shows, Music Videos, and Music all synced locally. My query seems to match yours exactly, best I can tell.

DEBUG::jellyfin_kodi/jellyfin/http.py:84 --->[ http ] {
                                    "url": "http://{jellyfin-server}/Jellyfin.Plugin.KodiSyncQueue/82fb57e4199a4b2dbf95679337ffce86/GetItems",
                                    "verify": true,
                                    "headers": {
                                        "Accept-Charset": "UTF-8,*",
                                        "Accept-encoding": "gzip",
                                        "X-MediaBrowser-Token": "{jellyfin-token}",
                                        "Content-type": "application/json",
                                        "x-emby-authorization": "MediaBrowser Client=Kodi, Device=Kodi (kronos), DeviceId=01a2e401-4493-4d2b-8a71-20a101709e88, Version=0.5.7, UserId=82fb57e4199a4b2dbf95679337ffce86",
                                        "User-Agent": "Jellyfin-Kodi/0.5.7"
                                    },
                                    "params": {
                                        "filter": null,
                                        "LastUpdateDT": "2020-06-12T01:07:21z"
                                    },
                                    "timeout": 30,
                                    "type": "GET"
                                }

At this point I’m running out of guesses. It’s mostly going to depend on if that URL will open properly in a browser for you when you’re logged into the server

So just to understand this right:
If you open up a URL like http://192.168.100.26:8096/Jellyfin.Plugin.KodiSyncQueue/e30f82e036bd4a908a45be9a549b8d8e/GetItems?LastUpdateDT=2020-06-11T10%3A42%3A36z in the Browser (without filter=null attached) you don’t get an error telling you Value cannot be null. (Parameter 'source') ? Because if that’s the case, than something on my server-side seems to be different.

Or is your URL Builded with &filter=null ? Because if I add this to the request, than it works.

Is there anything I can try or deliver to narrow this down? I am willing to try anything you suggest :wink:

Best regards
Michael

Oh. I think I see the problem and the source of confusion. I’m running nightly server and a new compiled release of Kodi Sync Queue master that seems to work without the &filter=null in the URL. However on the current 10.5.5 and 4.0.0 release, if &filter=null isn’t present then it throws errors. Now I understand why things are weird here.

I should have this solved within the next day or two

Cool, thank you very much for the feedback. Really thought I was insane, because, while my library is big, there should be nothing too special about it and I just couldn’t comprehend why your URL was working.

Thanks for letting me know the recent status, really appreciated

I lied (again). And now I’m really lost.

When I have libraries of each type synced when using the current release of server (10.5.5 server, 4.0.0 Kodi Sync Queue), I’m requesting the exact same URL endpoint without filter=null. http://192.168.0.200:8096/Jellyfin.Plugin.KodiSyncQueue/3920b99003194448a2a9d4f0bedd3d82/GetItems?LastUpdateDT=2020-06-12T19%3A56%3A30z and I’m seeing no errors.

I wonder if this could be another localization thing where the addon isn’t behaving. Is your Kodi set to a language other than English?

I wonder if you could change a line and test for me. You’ll need to find where your addons are installed (on linux this is typically ~/.kodi/addons, I’m not sure about windows). You’ll want to edit the file plugin.video.jellyfin/jellyfin_kodi/jellyfin/api.py Change
'filter': filters or None
to
'filter': filters or 'None'

This should force filter=None onto the URL and work properly, but I really can’t figure out why it would be needed in this case.

Hi, just checked:
First set my language to English (it’s in German normally). Afterwards updated the Plugin from 0.5.5 to 0.5.7 and the problem is still there, so seems not to be related to the kodi localization. I don’t understand why your server seems to be reacting differently here (I use the docker-variant with 10.5.5 and 4.0.0 Kodi sync queue…)

Nevertheless, I modified the api.py according to your suggestion and with this modification everything seems to be running normal again.

Is there something more I can do on serverside to help you analyzing, or is this ok for a fix…

Best Regards
Michael

I’ve committed the fix here: https://github.com/jellyfin/jellyfin-kodi/pull/322. It should be released soon and solve the problem for you.