mirror of
https://github.com/oSumAtrIX/free-librespot.git
synced 2025-12-19 09:54:25 +00:00
Merge pull request #440 from tehcodedninja/SpotfyId-toURI
Ability to get the Spotify URI from a SpotifyId
This commit is contained in:
commit
dc99cd73c0
1 changed files with 8 additions and 0 deletions
|
|
@ -104,6 +104,14 @@ impl SpotifyId {
|
|||
std::str::from_utf8(&data).unwrap().to_owned()
|
||||
}
|
||||
|
||||
pub fn to_uri(&self) -> String {
|
||||
match self.audio_type {
|
||||
SpotifyAudioType::Track => format!("spotify:track:{}", self.to_base62()),
|
||||
SpotifyAudioType::Podcast => format!("spotify:episode:{}", self.to_base62()),
|
||||
SpotifyAudioType::NonPlayable => format!("spotify:unknown:{}", self.to_base62()),
|
||||
}
|
||||
}
|
||||
|
||||
pub fn to_raw(&self) -> [u8; 16] {
|
||||
self.id.to_be_bytes()
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue