[GH-ISSUE #190] is_playable field is always Option::None #66

Closed
opened 2026-02-27 20:22:54 +03:00 by kerem · 1 comment
Owner

Originally created by @elbart on GitHub (Feb 27, 2021).
Original GitHub issue: https://github.com/ramsayleung/rspotify/issues/190

Describe the bug
First of all: Thanks for bringing this project to life and for maintaining it further. It's a super cool thing to use, especially for downstream projects like spotify-tui, where I am currently working on, a bit.

I was just trying to fetch the is_playable field for the FullTrack (currently rspotify only support this for FullTrack -> SimplifiedTrack will be supported when #145 goes into a release). However I always only got Option::None values returned.

I used my personal "Saved Tracks" list, where I have one Song which is not playable (spotify:track:3jUL0aX4XgQbUxJhMRiY7a) and many others which are all playable. However I never see a Some(bool) (neither true, nor false), but only None values.

I did try myself with the spotify API web console and I always got the field is_playable returned with "false" for the above mentioned track and otherwise "true". I am however not sure where this error roots from, yet.

To Reproduce
Steps to reproduce the behavior:
I prepared a small code-portion which works with tokio "0.2"and rspotify "0.10.0" as dependencies:

use rspotify::client::Spotify;
use rspotify::oauth2::{SpotifyClientCredentials, TokenInfo};

#[tokio::main]
async fn main() {
    let ti = TokenInfo {
        access_token: "xxx".to_string(),
        expires_at: Some(123),
        expires_in: 3600,
        refresh_token: Some("xxx".to_string()),
        scope: "playlist-read-private playlist-read-collaborative user-follow-read playlist-modify-private user-read-private user-follow-modify user-modify-playback-state user-library-read user-library-modify playlist-modify-public user-read-playback-state user-read-currently-playing user-read-recently-played user-read-playback-position".to_string(),
        token_type: "Bearer".to_string(),
    };

    let client_credential = SpotifyClientCredentials::default().token_info(ti).build();
    let spotify = Spotify::default()
        .client_credentials_manager(client_credential)
        .build();
    let tracks = spotify.current_user_saved_tracks(10, 0).await.unwrap();
    tracks.items.iter().for_each(|i| {
        println!("{:?}", i.track.is_playable);
    });
}

Expected behavior
I would expect Some(false) or Some(true) for either of these tracks.

Log/Output data

$> cargo run                                                                                                                                                                                                                                                                                    
   Compiling rspotify-playable v0.1.0 (/home/tim/projects/tmp/rspotify-playable)
    Finished dev [unoptimized + debuginfo] target(s) in 3.26s
     Running `target/debug/rspotify-playable`
None
None
None
None
None
None
None
None
None
None

Additional context
I was working on the spotify-tui project and we want to display "unplayable" songs differently and would need this field to identify this. For more information, please cf. to https://github.com/Rigellute/spotify-tui/issues/718.

Originally created by @elbart on GitHub (Feb 27, 2021). Original GitHub issue: https://github.com/ramsayleung/rspotify/issues/190 **Describe the bug** First of all: Thanks for bringing this project to life and for maintaining it further. It's a super cool thing to use, especially for downstream projects like spotify-tui, where I am currently working on, a bit. I was just trying to fetch the `is_playable` field for the `FullTrack` (currently rspotify only support this for `FullTrack` -> `SimplifiedTrack` will be supported when #145 goes into a release). However I always only got `Option::None` values returned. I used my personal "Saved Tracks" list, where I have one Song which is not playable (spotify:track:3jUL0aX4XgQbUxJhMRiY7a) and many others which are all playable. However I never see a Some(bool) (neither true, nor false), but only None values. I did try myself with the spotify API web console and I always got the field `is_playable` returned with "false" for the above mentioned track and otherwise "true". I am however not sure where this error roots from, yet. **To Reproduce** Steps to reproduce the behavior: I prepared a small code-portion which works with tokio "0.2"and rspotify "0.10.0" as dependencies: ```rust use rspotify::client::Spotify; use rspotify::oauth2::{SpotifyClientCredentials, TokenInfo}; #[tokio::main] async fn main() { let ti = TokenInfo { access_token: "xxx".to_string(), expires_at: Some(123), expires_in: 3600, refresh_token: Some("xxx".to_string()), scope: "playlist-read-private playlist-read-collaborative user-follow-read playlist-modify-private user-read-private user-follow-modify user-modify-playback-state user-library-read user-library-modify playlist-modify-public user-read-playback-state user-read-currently-playing user-read-recently-played user-read-playback-position".to_string(), token_type: "Bearer".to_string(), }; let client_credential = SpotifyClientCredentials::default().token_info(ti).build(); let spotify = Spotify::default() .client_credentials_manager(client_credential) .build(); let tracks = spotify.current_user_saved_tracks(10, 0).await.unwrap(); tracks.items.iter().for_each(|i| { println!("{:?}", i.track.is_playable); }); } ``` **Expected behavior** I would expect Some(false) or Some(true) for either of these tracks. **Log/Output data** ```bash $> cargo run Compiling rspotify-playable v0.1.0 (/home/tim/projects/tmp/rspotify-playable) Finished dev [unoptimized + debuginfo] target(s) in 3.26s Running `target/debug/rspotify-playable` None None None None None None None None None None ``` **Additional context** I was working on the spotify-tui project and we want to display "unplayable" songs differently and would need this field to identify this. For more information, please cf. to https://github.com/Rigellute/spotify-tui/issues/718.
kerem 2026-02-27 20:22:54 +03:00
Author
Owner

@Peter-Schorn commented on GitHub (Mar 24, 2021):

The documentation for the is_playable property of the track object says:

Part of the response when Track Relinking is applied. If true, the track is playable in the given market. Otherwise false.

Track relinking is only applied if you specify a market parameter in the request. Please read the Track Relinking Guide thoroughly for more information. This endpoint accepts a market parameter but it is missing from the corresponding method in this library. It's also missing from other methods in this library, such as current_user_saved_albums.

<!-- gh-comment-id:805432289 --> @Peter-Schorn commented on GitHub (Mar 24, 2021): The documentation for the `is_playable` property of the [`track`][1] object says: > Part of the response when Track Relinking is applied. If true, the track is playable in the given market. Otherwise false. Track relinking is only applied if you specify a market parameter in the request. Please read the [Track Relinking Guide][2] thoroughly for more information. This endpoint accepts a `market` parameter but it is missing from the corresponding method in this library. It's also missing from other methods in this library, such as `current_user_saved_albums`. [1]: https://developer.spotify.com/documentation/web-api/reference/#object-trackobject [2]: https://developer.spotify.com/documentation/general/guides/track-relinking-guide/
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/rspotify#66
No description provided.