Podcast support improvements. (#229)
* Added OpenUri D-BUS MPRIS support. Removed "user:" from URIType check because Spotify doesn't always provide it. * Added tags to .gitignore * Changed mpris metadata to actually return the track's url instead of the Spotify URI so that it matches the functionality of the official Spotify client. * Changed mpris:trackid and xesam:url to not use static naming so it can support podcasts. * Changed xesam:url to default to an empty string instead of "0" * Added possibility to start playing Shows and Episodes via MPRIS. Added possibility to search for Podcast Episodes.
This commit is contained in:
@@ -58,7 +58,7 @@ use crate::events::{Event, EventManager};
|
||||
use crate::playable::Playable;
|
||||
use crate::queue;
|
||||
use crate::track::Track;
|
||||
use rspotify::model::show::{Show, SimplifiedEpisode};
|
||||
use rspotify::model::show::{Show, SimplifiedEpisode, FullShow, FullEpisode};
|
||||
|
||||
pub const VOLUME_PERCENT: u16 = ((u16::max_value() as f64) * 1.0 / 100.0) as u16;
|
||||
|
||||
@@ -663,6 +663,14 @@ impl Spotify {
|
||||
self.api_with_retry(|api| api.track(track_id))
|
||||
}
|
||||
|
||||
pub fn get_show(&self, show_id: &str) -> Option<FullShow> {
|
||||
self.api_with_retry(|api| api.get_a_show(show_id.to_string(), None))
|
||||
}
|
||||
|
||||
pub fn episode(&self, episode_id: &str) -> Option<FullEpisode> {
|
||||
self.api_with_retry(|api| api.get_an_episode(episode_id.to_string(), None))
|
||||
}
|
||||
|
||||
pub fn search(
|
||||
&self,
|
||||
searchtype: SearchType,
|
||||
@@ -904,6 +912,8 @@ pub enum URIType {
|
||||
Artist,
|
||||
Track,
|
||||
Playlist,
|
||||
Show,
|
||||
Episode
|
||||
}
|
||||
|
||||
impl URIType {
|
||||
@@ -916,6 +926,10 @@ impl URIType {
|
||||
Some(URIType::Track)
|
||||
} else if s.starts_with("spotify:") && s.contains(":playlist:") {
|
||||
Some(URIType::Playlist)
|
||||
} else if s.starts_with("spotify:show:"){
|
||||
Some(URIType::Show)
|
||||
} else if s.starts_with("spotify:episode:"){
|
||||
Some(URIType::Episode)
|
||||
} else {
|
||||
None
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user