rasmuslos / AmpFin

Native Jellyfin music player for iOS & iPadOS
Other
154 stars 11 forks source link

'Content Unavailable' shown for artist/album list views #52

Closed tamask closed 3 months ago

tamask commented 3 months ago

When accessing the artist or album list views, a 'Content Unavailable' message is shown, for example:

image

The console in xcode has the following error:

Error while decoding response https://<redacted>/Artists?userId=<redacted>&SortBy=Name&SortOrder=Ascending&limit=100&searchTerm=

keyNotFound(CodingKeys(stringValue: "MediaType", intValue: nil), Swift.DecodingError.Context(codingPath: [CodingKeys(stringValue: "Items", intValue: nil), _JSONKey(stringValue: "Index 0", intValue: 0)], debugDescription: "No value associated with key CodingKeys(stringValue: \"MediaType\", intValue: nil) (\"MediaType\").", underlyingError: nil))

I believe the issue is that Jellyfin does not return a MediaType key in the response json for these api calls. The local model for these items requires this key to be defined:

https://github.com/rasmuslos/AmpFin/blob/faf5d27dfab2f02fc4d1035284c38ea0a437bb3a/AmpFinKit/Sources/AFNetwork/Models/JellyfinItem.swift#L21

The fix that works for me is making the JellyfinItem.MediaType property an optional:

    let MediaType: String?

But I haven't done thorough testing if this causes problems elsewhere.

My Jellyfin version is 10.8.13

rasmuslos commented 3 months ago

Thanks! I will release a new fixed version