rspotify icon indicating copy to clipboard operation
rspotify copied to clipboard

Fetched playlist contains `Track` items for episodes

Open hrkfdn opened this issue 2 years ago • 6 comments

Describe the bug A playlist of tracks and podcast episodes only contains PlayableItem::Track items.

To Reproduce Steps to reproduce the behavior:

  1. Create a new playlist
  2. Add music track to playlist
  3. Add podcast episode to playlist
  4. Fetch playlist using i.e. playlist_items_manual()

Expected behavior The playlist should have items typed as PlayableItem::Track and PlayableItem::Episode

Log/Output data Here's one of the items that should have been a podcast episode but was typed as a track instead:

Track(FullTrack { album: SimplifiedAlbum { album_group: None, album_type: Some("compilation"), artists: [SimplifiedArtist { external_urls: {"spotify": "https://open.spotify.com/show/2Shpxw7dPoxRJCdfFXTWLE"}, href: Some("https://api.spotify.com/v1/shows/2Shpxw7dPoxRJCdfFXTWLE"), id: Some(ArtistId("2Shpxw7dPoxRJCdfFXTWLE")), name: "Philosophize This!" }], available_markets: ["AD", "AE", "AG", "AL", "AM", "AO", "AR", "AT", "AU", "AZ", "BA", "BB", "BE", "BF", "BG", "BH", "BI", "BJ", "BN", "BO", "BR", "BS", "BT", "BW", "BZ", "CA", "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", "IS", "IT", "JM", "JO", "JP", "KE", "KH", "KI", "KM", "KN", "KW", "LA", "LB", "LC", "LI", "LR", "LS", "LT", "LU", "LV", "MA", "MC", "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", "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", "TL", "TN", "TO", "TR", "TT", "TV", "TW", "TZ", "US", "UY", "UZ", "VC", "VN", "VU", "WS", "XK", "ZA", "ZM", "ZW"], external_urls: {"spotify": "https://open.spotify.com/show/2Shpxw7dPoxRJCdfFXTWLE"}, href: Some("https://api.spotify.com/v1/shows/2Shpxw7dPoxRJCdfFXTWLE"), id: Some(AlbumId("2Shpxw7dPoxRJCdfFXTWLE")), images: [Image { height: Some(640), url: "https://i.scdn.co/image/f07f5f6476583502fac99edd5eb83e99dfaf4633", width: Some(640) }, Image { height: Some(300), url: "https://i.scdn.co/image/b01d89d740d3275d16082b5c5e597b12881bec26", width: Some(300) }, Image { height: Some(64), url: "https://i.scdn.co/image/7c2c22f4fe4d0193c886b297920626c136fccde0", width: Some(64) }], name: "Philosophize This!", release_date: None, release_date_precision: None, restrictions: Some(Restriction { reason: Product }) }, artists: [SimplifiedArtist { external_urls: {"spotify": "https://open.spotify.com/show/2Shpxw7dPoxRJCdfFXTWLE"}, href: Some("https://api.spotify.com/v1/shows/2Shpxw7dPoxRJCdfFXTWLE"), id: Some(ArtistId("2Shpxw7dPoxRJCdfFXTWLE")), name: "Philosophize This!" }], available_markets: ["AD", "AE", "AG", "AL", "AM", "AO", "AR", "AT", "AU", "AZ", "BA", "BB", "BE", "BF", "BG", "BH", "BI", "BJ", "BN", "BO", "BR", "BS", "BT", "BW", "BZ", "CA", "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", "IS", "IT", "JM", "JO", "JP", "KE", "KH", "KI", "KM", "KN", "KW", "LA", "LB", "LC", "LI", "LR", "LS", "LT", "LU", "LV", "MA", "MC", "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", "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", "TL", "TN", "TO", "TR", "TT", "TV", "TW", "TZ", "US", "UY", "UZ", "VC", "VN", "VU", "WS", "XK", "ZA", "ZM", "ZW"], disc_number: 0, duration: 1675.68s, explicit: false, external_ids: {"spotify": "https://open.spotify.com/episode/3eCVbzwX4rZvwmcrGwmhHs"}, external_urls: {"spotify": "https://open.spotify.com/episode/3eCVbzwX4rZvwmcrGwmhHs"}, href: Some("https://api.spotify.com/v1/episodes/3eCVbzwX4rZvwmcrGwmhHs"), id: Some(TrackId("3eCVbzwX4rZvwmcrGwmhHs")), is_local: false, is_playable: Some(false), linked_from: None, restrictions: None, name: "Episode #165 ... Ralph Waldo Emerson - Nature and Other Things", popularity: 0, preview_url: Some("https://p.scdn.co/mp3-preview/f20fa210a955025247b33d5087fba650d5b046b9"), track_number: 0 })

Note the URIs pointing to a show object.

hrkfdn avatar May 28 '22 11:05 hrkfdn

Hi Henrik, thanks for your report, would you like to post your code to reproduce this problem?

  1. Create a new playlist
  2. Add music track to playlist
  3. Add podcast episode to playlist
  4. Fetch playlist using i.e. playlist_items_manual()

ramsayleung avatar Jun 02 '22 01:06 ramsayleung

Hey @ramsayleung, I would, but there really isn't much to it. Steps 1-3 I did using the Spotify desktop app, and then in step 4 I just fetched the playlist.

hrkfdn avatar Jun 02 '22 19:06 hrkfdn

Oooh, I can reproduce this problem.

items that should have been a podcast episode but was typed as a track instead

But I think Spotify explicitly treats the podcast episode as track instead of Rspotify doing so. You could confirm this with Spotify Web Console: https://developer.spotify.com/console/get-playlist-tracks/

ramsayleung avatar Jun 03 '22 12:06 ramsayleung

Hey there, thanks for looking into this. Oh that's a shame. How could this be handled? Type it as a PlayableItem::Episode in rspotify based on the URI?

hrkfdn avatar Jun 21 '22 18:06 hrkfdn

I think it's the inconsistency introduced by Spotify Web API should not be handled by RSpotify unless Spotify explicitly points out the rule that we should deduce the type of PlayableItem by URI instead of Type.

There is another bad case, the Type is correct (we could say Episode), but the URI is incorrect(track URI).

ramsayleung avatar Jun 22 '22 13:06 ramsayleung

Message to comment on stale issues. If none provided, will not mark issues stale

github-actions[bot] avatar Jun 26 '23 02:06 github-actions[bot]