mirror of
https://github.com/librespot-org/librespot.git
synced 2025-10-03 01:39:28 +02:00
Streamline and refactor Podcast support,
<Metadata> Add publisher to `Show` Add `ALLOWED` to `PassthroughEnum`
This commit is contained in:
parent
0cb7a3f7c8
commit
8eb51e9b55
6 changed files with 135 additions and 88 deletions
|
@ -2,7 +2,7 @@ use std;
|
|||
use std::fmt;
|
||||
|
||||
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
|
||||
pub enum SpotifyTrackType {
|
||||
pub enum SpotifyAudioType {
|
||||
Track,
|
||||
Podcast,
|
||||
}
|
||||
|
@ -10,7 +10,7 @@ pub enum SpotifyTrackType {
|
|||
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
|
||||
pub struct SpotifyId {
|
||||
pub id: u128,
|
||||
pub track_type: SpotifyTrackType,
|
||||
pub audio_type: SpotifyAudioType,
|
||||
}
|
||||
|
||||
#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
|
||||
|
@ -23,7 +23,7 @@ impl SpotifyId {
|
|||
fn as_track(n: u128) -> SpotifyId {
|
||||
SpotifyId {
|
||||
id: n.to_owned(),
|
||||
track_type: SpotifyTrackType::Track,
|
||||
audio_type: SpotifyAudioType::Track,
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -73,7 +73,7 @@ impl SpotifyId {
|
|||
let parts = uri.split(":").collect::<Vec<&str>>();
|
||||
if uri.contains(":show:") || uri.contains(":episode:") {
|
||||
let mut spotify_id = SpotifyId::from_base62(parts[2]).unwrap();
|
||||
spotify_id.track_type = SpotifyTrackType::Podcast;
|
||||
let _ = std::mem::replace(&mut spotify_id.audio_type, SpotifyAudioType::Podcast);
|
||||
Ok(spotify_id)
|
||||
} else {
|
||||
SpotifyId::from_base62(parts[2])
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue