Add Spotify URI resource helpers

This commit is contained in:
Oscar Linderholm
2019-04-09 21:20:16 +02:00
committed by Henrik Friedrichsen
parent f6d674d9be
commit de1062471f

View File

@@ -576,4 +576,20 @@ impl Spotify {
let new = (progress.as_secs() * 1000) as i32 + progress.subsec_millis() as i32 + delta;
self.seek(std::cmp::max(0, new) as u32);
}
pub fn is_album(s: &str) -> bool {
s.starts_with("spotify:album:")
}
pub fn is_artist(s: &str) -> bool {
s.starts_with("spotify:artist:")
}
pub fn is_track(s: &str) -> bool {
s.starts_with("spotify:track:")
}
pub fn is_playlist(s: &str) -> bool {
s.starts_with("spotify:user:") && s.contains(":playlist:")
}
}