adamint / spotify-web-api-kotlin

Spotify Web API wrapper for Kotlin, Java, JS, and Native - Targets JVM, Android, JS (browser), Native (Desktop), and Apple tvOS/iOS. Includes a Spotify Web Playback SDK wrapper for Kotlin/JS, and a spotify-auth wrapper for Kotlin/Android.
https://adamint.github.io/spotify-web-api-kotlin-docs/
MIT License
194 stars 21 forks source link

getCurrentlyPlayingRestAction unable to parse song in users "Liked Songs" #317

Closed tobiasarndt closed 1 year ago

tobiasarndt commented 1 year ago

Describe the bug When trying to call getCurrentlyPlayingRestAction().complete() an "com.adamratzman.spotify.SpotifyException$ParseException" exception is thrown. Stack trace says:

(Illegal Spotify ID/URI: 'spotify:user:XXXXXXXXX:collection' isn't convertible to 'playlist' or 'album' or 'artist' or 'show' id) at com.adamratzman.spotify.models.serialization.SerializationUtilsKt.parseJson(SerializationUtils.kt:33) at com.adamratzman.spotify.models.serialization.SerializationUtilsKt.toObject(SerializationUtils.kt:41) at com.adamratzman.spotify.endpoints.client.ClientPlayerApi.getCurrentlyPlaying(ClientPlayerApi.kt:203) at com.adamratzman.spotify.endpoints.client.ClientPlayerApi$getCurrentlyPlaying$1.invokeSuspend(ClientPlayerApi.kt).......

To Reproduce Steps to reproduce the behavior: Call getCurrentlyPlayingRestAction().complete() while user is listening to song in his "Liked Songs" playlist.

Expected behavior A clear and concise description of what you expected to happen.

Screenshots If applicable, add screenshots to help explain your problem.

Desktop (please complete the following information):

adamint commented 1 year ago

Oh god, they’ve added a new collection type

adamint commented 1 year ago

@tobiasarndt does this repro for different tracks in your liked songs? What track is it specifically? (Its URI)

tobiasarndt commented 1 year ago

@adamint It does not matter which song I play. Any Song in my "Liked Songs" won't work. But if i play the same song from the artist page it works.

Here is one example of the uri JSON that can not be parsed:

Uri: spotify:track:0qIKeAB6ClrZUSeD85vLa7

com.adamratzman.spotify.SpotifyException$ParseException: Unable to parse { "timestamp" : 1664290444713, "context" : { "external_urls" : { "spotify" : "https://open.spotify.com/collection/tracks" }, "href" : "https://api.spotify.com/v1/me/tracks", "type" : "collection", "uri" : "spotify:user:XXXXXXXXX:collection" }, "progress_ms" : 7263, "item" : { "album" : { "album_type" : "album", "artists" : [ { "external_urls" : { "spotify" : "https://open.spotify.com/artist/2IlTe9Gm5w5qrt2kKdOvAh" }, "href" : "https://api.spotify.com/v1/artists/2IlTe9Gm5w5qrt2kKdOvAh", "id" : "2IlTe9Gm5w5qrt2kKdOvAh", "name" : "Jonathan Bree", "type" : "artist", "uri" : "spotify:artist:2IlTe9Gm5w5qrt2kKdOvAh" } ], "available_markets" : [ "AD", "AE", "AG", "AL", "AM", "AO", "AR", "AT", "AZ", "BA", "BB", "BD", "BE", "BF", "BG", "BH", "BI", "BJ", "BN", "BO", "BR", "BS", "BT", "BW", "BY", "BZ", "CA", "CD", "CG", "CH", "CI", "CL", "CM", "CO", "CR", "CV", "CW", "CY", "CZ", "DE", "DJ", "DK", "DM", "DO", "DZ", "EC", "EE", "EG", "ES", "FI", "FJ", "FM", "FR", "GA", "GB", "GD", "GE", "GH", "GM", "GN", "GQ", "GR", "GT", "GW", "GY", "HK", "HN", "HR", "HT", "HU", "ID", "IE", "IL", "IN", "IQ", "IS", "IT", "JM", "JO", "JP", "KE", "KG", "KH", "KI", "KM", "KN", "KR", "KW", "KZ", "LA", "LB", "LC", "LI", "LK", "LR", "LS", "LT", "LU", "LV", "LY", "MA", "MC", "MD", "ME", "MG", "MH", "MK", "ML", "MN", "MO", "MR", "MT", "MU", "MV", "MW", "MX", "MY", "MZ", "NA", "NE", "NG", "NI", "NL", "NO", "NP", "NR", "OM", "PA", "PE", "PG", "PH", "PK", "PL", "PS", "PT", "PW", "PY", "QA", "RO", "RS", "RW", "SA", "SB", "SC", "SE", "SG", "SI", "SK", "SL", "SM", "SN", "SR", "ST", "SV", "SZ", "TD", "TG", "TH", "TJ", "TL", "TN", "TO", "TR", "TT", "TV", "TW", "TZ", "UA", "UG", "US", "UY", "UZ", "VC", "VE", "VN", "VU", "WS", "XK", "ZA", "ZM", "ZW" ], "external_urls" : { "spotify" : "https://open.spotify.com/album/1LMDOgbbXvj0C8OxNy5RlX" }, "href" : "https://api.spotify.com/v1/albums/1LMDOgbbXvj0C8OxNy5RlX", "id" : "1LMDOgbbXvj0C8OxNy5RlX", "images" : [ { "height" : 640, "url" : "https://i.scdn.co/image/ab67616d0000b2731cba6ee3ef4b9d62229422f2", "width" : 640 }, { "height" : 300, "url" : "https://i.scdn.co/image/ab67616d00001e021cba6ee3ef4b9d62229422f2", "width" : 300 }, { "height" : 64, "url" : "https://i.scdn.co/image/ab67616d000048511cba6ee3ef4b9d62229422f2", "width" : 64 } ], "name" : "After the Curtains Close", "release_date" : "2020-07-17", "release_date_precision" : "day", "total_tracks" : 12, "type" : "album", "uri" : "spotify:album:1LMDOgbbXvj0C8OxNy5RlX" }, "artists" : [ { "external_urls" : { "spotify" : "https://open.spotify.com/artist/2IlTe9Gm5w5qrt2kKdOvAh" }, "href" : "https://api.spotify.com/v1/artists/2IlTe9Gm5w5qrt2kKdOvAh", "id" : "2IlTe9Gm5w5qrt2kKdOvAh", "name" : "Jonathan Bree", "type" : "artist", "uri" : "spotify:artist:2IlTe9Gm5w5qrt2kKdOvAh" } ], "available_markets" : [ "AD", "AE", "AG", "AL", "AM", "AO", "AR", "AT", "AZ", "BA", "BB", "BD", "BE", "BF", "BG", "BH", "BI", "BJ", "BN", "BO", "BR", "BS", "BT", "BW", "BY", "BZ", "CA", "CD", "CG", "CH", "CI", "CL", "CM", "CO", "CR", "CV", "CW", "CY", "CZ", "DE", "DJ", "DK", "DM", "DO", "DZ", "EC", "EE", "EG", "ES", "FI", "FJ", "FM", "FR", "GA", "GB", "GD", "GE", "GH", "GM", "GN", "GQ", "GR", "GT", "GW", "GY", "HK", "HN", "HR", "HT", "HU", "ID", "IE", "IL", "IN", "IQ", "IS", "IT", "JM", "JO", "JP", "KE", "KG", "KH", "KI", "KM", "KN", "KR", "KW", "KZ", "LA", "LB", "LC", "LI", "LK", "LR", "LS", "LT", "LU", "LV", "LY", "MA", "MC", "MD", "ME", "MG", "MH", "MK", "ML", "MN", "MO", "MR", "MT", "MU", "MV", "MW", "MX", "MY", "MZ", "NA", "NE", "NG", "NI", "NL", "NO", "NP", "NR", "OM", "PA", "PE", "PG", "PH", "PK", "PL", "PS", "PT", "PW", "PY", "QA", "RO", "RS", "RW", "SA", "SB", "SC", "SE", "SG", "SI", "SK", "SL", "SM", "SN", "SR", "ST", "SV", "SZ", "TD", "TG", "TH", "TJ", "TL", "TN", "TO", "TR", "TT", "TV", "TW", "TZ", "UA", "UG", "US", "UY", "UZ", "VC", "VE", "VN", "VU", "WS", "XK", "ZA", "ZM", "ZW" ], "disc_number" : 1, "duration_ms" : 196500, "explicit" : false, "external_ids" : { "isrc" : "NZLC01900009" }, "external_urls" : { "spotify" : "https://open.spotify.com/track/0qIKeAB6ClrZUSeD85vLa7" }, "href" : "https://api.spotify.com/v1/tracks/0qIKeAB6ClrZUSeD85vLa7", "id" : "0qIKeAB6ClrZUSeD85vLa7", "is_local" : false, "name" : "Cover Your Eyes", "popularity" : 26, "preview_url" : "https://p.scdn.co/mp3-preview/94dc714f58ff58f492d1f49da6974e3911e4deba?cid=9bfb1b45da0d4c629bb7147b81532fde", "track_number" : 8, "type" : "track", "uri" : "spotify:track:0qIKeAB6ClrZUSeD85vLa7" }, "currently_playing_type" : "track", "actions" : { "disallows" : { "resuming" : true } }, "is_playing" : true }

adamint commented 1 year ago

A fix has been prepared and will be released within the next few days

flerouwu commented 1 year ago

Hey @adamint! Just wondering on what is happening with this fix?

adamint commented 1 year ago

Hi @Pixwl and @tobiasarndt, deployment is currently running and will be available in a few hours as version 4.0.0

adamint commented 1 year ago

Released, so closing.

tobiasarndt commented 1 year ago

I just got around to working on my project again. It seems, that i still encounter the same parsing error for tracks in the liked songs. I set my version to 4.0.0.

Here a new example: com.adamratzman.spotify.SpotifyException$ParseException: Unable to parse { "timestamp" : 1681237506594, "context" : { "external_urls" : { "spotify" : "https://open.spotify.com/collection/tracks" }, "href" : "https://api.spotify.com/v1/me/tracks", "type" : "collection", "uri" : "spotify:user:XXXXXXXXX:collection" }, "progress_ms" : 34170, "item" : { "album" : { "album_group" : "single", "album_type" : "single", "artists" : [ { "external_urls" : { "spotify" : "https://open.spotify.com/artist/0b05DhI4gD2fNDlqbFBOyt" }, "href" : "https://api.spotify.com/v1/artists/0b05DhI4gD2fNDlqbFBOyt", "id" : "0b05DhI4gD2fNDlqbFBOyt", "name" : "Landhouse", "type" : "artist", "uri" : "spotify:artist:0b05DhI4gD2fNDlqbFBOyt" }, { "external_urls" : { "spotify" : "https://open.spotify.com/artist/1GHfdjpfUhB42zcMKm2EOL" }, "href" : "https://api.spotify.com/v1/artists/1GHfdjpfUhB42zcMKm2EOL", "id" : "1GHfdjpfUhB42zcMKm2EOL", "name" : "Raddantze", "type" : "artist", "uri" : "spotify:artist:1GHfdjpfUhB42zcMKm2EOL" } ], "available_markets" : [ "AD", "AE", "AG", "AL", "AM", "AO", "AR", "AT", "AU", "AZ", "BA", "BB", "BD", "BE", "BF", "BG", "BH", "BI", "BJ", "BN", "BO", "BR", "BS", "BT", "BW", "BY", "BZ", "CA", "CD", "CG", "CH", "CI", "CL", "CM", "CO", "CR", "CV", "CW", "CY", "CZ", "DE", "DJ", "DK", "DM", "DO", "DZ", "EC", "EE", "EG", "ES", "ET", "FI", "FJ", "FM", "FR", "GA", "GB", "GD", "GE", "GH", "GM", "GN", "GQ", "GR", "GT", "GW", "GY", "HK", "HN", "HR", "HT", "HU", "ID", "IE", "IL", "IN", "IQ", "IS", "IT", "JM", "JO", "JP", "KE", "KG", "KH", "KI", "KM", "KN", "KR", "KW", "KZ", "LA", "LB", "LC", "LI", "LK", "LR", "LS", "LT", "LU", "LV", "LY", "MA", "MC", "MD", "ME", "MG", "MH", "MK", "ML", "MN", "MO", "MR", "MT", "MU", "MV", "MW", "MX", "MY", "MZ", "NA", "NE", "NG", "NI", "NL", "NO", "NP", "NR", "NZ", "OM", "PA", "PE", "PG", "PH", "PK", "PL", "PS", "PT", "PW", "PY", "QA", "RO", "RS", "RW", "SA", "SB", "SC", "SE", "SG", "SI", "SK", "SL", "SM", "SN", "SR", "ST", "SV", "SZ", "TD", "TG", "TH", "TJ", "TL", "TN", "TO", "TR", "TT", "TV", "TW", "TZ", "UA", "UG", "US", "UY", "UZ", "VC", "VE", "VN", "VU", "WS", "XK", "ZA", "ZM", "ZW" ], "external_urls" : { "spotify" : "https://open.spotify.com/album/1pRQnDjYshduiknpZpWrPc" }, "href" : "https://api.spotify.com/v1/albums/1pRQnDjYshduiknpZpWrPc", "id" : "1pRQnDjYshduiknpZpWrPc", "images" : [ { "height" : 640, "url" : "https://i.scdn.co/image/ab67616d0000b2733b2fbb521b79931bf889aa71", "width" : 640 }, { "height" : 300, "url" : "https://i.scdn.co/image/ab67616d00001e023b2fbb521b79931bf889aa71", "width" : 300 }, { "height" : 64, "url" : "https://i.scdn.co/image/ab67616d000048513b2fbb521b79931bf889aa71", "width" : 64 } ], "name" : "Robots In Lilac Spaceships", "release_date" : "2016-11-28", "release_date_precision" : "day", "total_tracks" : 5, "type" : "album", "uri" : "spotify:album:1pRQnDjYshduiknpZpWrPc" }, "artists" : [ { "external_urls" : { "spotify" : "https://open.spotify.com/artist/0b05DhI4gD2fNDlqbFBOyt" }, "href" : "https://api.spotify.com/v1/artists/0b05DhI4gD2fNDlqbFBOyt", "id" : "0b05DhI4gD2fNDlqbFBOyt", "name" : "Landhouse", "type" : "artist", "uri" : "spotify:artist:0b05DhI4gD2fNDlqbFBOyt" }, { "external_urls" : { "spotify" : "https://open.spotify.com/artist/1GHfdjpfUhB42zcMKm2EOL" }, "href" : "https://api.spotify.com/v1/artists/1GHfdjpfUhB42zcMKm2EOL", "id" : "1GHfdjpfUhB42zcMKm2EOL", "name" : "Raddantze", "type" : "artist", "uri" : "spotify:artist:1GHfdjpfUhB42zcMKm2EOL" } ], "available_markets" : [ "AR", "AU", "AT", "BE", "BO", "BR", "BG", "CA", "CL", "CO", "CR", "CY", "CZ", "DK", "DO", "DE", "EC", "EE", "SV", "FI", "FR", "GR", "GT", "HN", "HK", "HU", "IS", "IE", "IT", "LV", "LT", "LU", "MY", "MT", "MX", "NL", "NZ", "NI", "NO", "PA", "PY", "PE", "PH", "PL", "PT", "SG", "SK", "ES", "SE", "CH", "TW", "TR", "UY", "US", "GB", "AD", "LI", "MC", "ID", "JP", "TH", "VN", "RO", "IL", "ZA", "SA", "AE", "BH", "QA", "OM", "KW", "EG", "MA", "DZ", "TN", "LB", "JO", "PS", "IN", "BY", "KZ", "MD", "UA", "AL", "BA", "HR", "ME", "MK", "RS", "SI", "KR", "BD", "PK", "LK", "GH", "KE", "NG", "TZ", "UG", "AG", "AM", "BS", "BB", "BZ", "BT", "BW", "BF", "CV", "CW", "DM", "FJ", "GM", "GE", "GD", "GW", "GY", "HT", "JM", "KI", "LS", "LR", "MW", "MV", "ML", "MH", "FM", "NA", "NR", "NE", "PW", "PG", "WS", "SM", "ST", "SN", "SC", "SL", "SB", "KN", "LC", "VC", "SR", "TL", "TO", "TT", "TV", "VU", "AZ", "BN", "BI", "KH", "CM", "TD", "KM", "GQ", "SZ", "GA", "GN", "KG", "LA", "MO", "MR", "MN", "NP", "RW", "TG", "UZ", "ZW", "BJ", "MG", "MU", "MZ", "AO", "CI", "DJ", "ZM", "CD", "CG", "IQ", "LY", "TJ", "VE", "ET", "XK" ], "disc_number" : 1, "duration_ms" : 484477, "explicit" : false, "external_ids" : { "isrc" : "DEY471616688" }, "external_urls" : { "spotify" : "https://open.spotify.com/track/4JLHvLj1cHJpopm40v32lY" }, "href" : "https://api.spotify.com/v1/tracks/4JLHvLj1cHJpopm40v32lY", "id" : "4JLHvLj1cHJpopm40v32lY", "is_local" : false, "name" : "Robots", "popularity" : 44, "preview_url" : "https://p.scdn.co/mp3-preview/647c7a4134978ef9f4313e37773b2b03a1c279b2?cid=9bfb1b45da0d4c629bb7147b81532fde", "track_number" : 1, "type" : "track", "uri" : "spotify:track:4JLHvLj1cHJpopm40v32lY" }, "currently_playing_type" : "track", "actions" : { "disallows" : { "resuming" : true } }, "is_playing" : true } (Illegal Spotify ID/URI: 'spotify:user:1149381219:collection' isn't convertible to 'playlist' or 'album' or 'artist' or 'show' id)