Closed AlexLArmstrong closed 7 months ago
Hi,
The error seems to indicate that duration_ms is an object rather than a number. I never saw this happening before. But with the Spotify web api, you never know. They like to break things. Do you have the playlist ID used in this api call?
Sadly no, the exception does not log the playlist ID.
@AlexLArmstrong I added a temporary catch that logs the ID. Could you try with this branch again? https://github.com/Viperinius/jellyfin-plugin-spotify-import/tree/fix/json-except
I found the id, removed the playlist from the Spotify account and it works again...
Do you have a script to call the api with the ID for me to see what the difference in the response is?
With that I could add some more details to this issue
Would you be comfortable with sharing the ID? Everyone can access the playlist knowing the ID.
If not, you can also use this page: https://developer.spotify.com/documentation/web-api/reference/get-playlists-tracks
Okay, for some reason exactly one "duration_ms" is an object:
"duration_ms": { "totalMilliseconds": 12345 },
but only on the https://api.spotify.com/v1/playlists/{playlist_id}
and not the https://api.spotify.com/v1/playlists/{playlist_id}/tracks
its also interesting that there seems to be no album and no artist for this particular track...
album: {
album_type: null,
available_markets: [],
external_urls: {},
href: null,
id: null,
images: [],
name: "",
release_date: null,
release_date_precision: null,
type: "album",
uri: null,
artists: []
},
artists: [
{
external_urls: {},
href: null,
id: null,
name: "",
type: "artist",
uri: null
}
]
The song seems to have been deleted from the Spotify catalog as I cannot manually select and play the song through the regular web UI.
Do you have the track ID?
no, the track does not have an ID
It is the only track with the is_local
flag set to true
, which according to documentation indicates that the file is a local file
Weird, even if it's a local track, the API should not deliver that kind of response.
I guess you could report it on the spotify developer forums but don't expect a response. Doesn't seem like something we need to fix here or in SpotifyAPI-NET.
understandable, wrapping the json error in a SpotifyAPI-NET exception and adding some hint on what might be going on could help other projects catch it with their normal exception handling and also troubleshoot the issue faster... some exception message like "a json deserialization error occurred. The Spotify API is known to be inconsistent. {api call info here}"
for us @Viperinius, I'd say we keep the catch from your fix and add additional debug information about which playlist etc was involved, maybe even reference this issue. what do you think?
Yeah, I'll add the catch to other api calls as well, just in case, and add some logging
I get the following error on a freshly installed jellyfin instance when manually triggering a sync job:
For reasons unknown an exception in SpotifyAPI playableItemConverter is thrown.
Usually, exceptions in the library are caught in SpotifyPlaylistProvider, but this one is not since it is a
JsonReaderException
.As a result the sync tasks stops with errors.
Expected Behavior
The exception should not be thrown in the first place, but if it still happens I would expect this to be logged as a warning and the sync process should continue.
Solutions
A quick fix for now could be to add a
catch (JsonException)
block. This would however not solve the underlying issue, which might come from the usedSpotifyWeb
library. (@JohnnyCrazy ?)