podcast support (#203)

* implement search for shows/podcasts

* create Playable supertype for queue to contain tracks and episodes

* wip: implement playback of episodes

* load spotify id from uri instead of raw id to fix podcast playback

* show duration for podcast episodes

* implement generic status bar for playables (tracks and episodes)

omit saved indicator for now as the library does not yet support podcasts

* instead of only the last 50 fetch all episodes of a show

* refactor: extract Playable code to separate file

* implement playback/queuing of shows + sharing url

* implement podcast library

* migrate mpris code to Playable supertype
This commit is contained in:
Henrik Friedrichsen
2020-07-14 10:38:22 +02:00
committed by GitHub
parent 8bf06147e2
commit 1b1d392ab8
19 changed files with 723 additions and 115 deletions

View File

@@ -5,6 +5,7 @@ use rspotify::model::artist::{FullArtist, SimplifiedArtist};
use crate::album::Album;
use crate::library::Library;
use crate::playable::Playable;
use crate::queue::Queue;
use crate::spotify::Spotify;
use crate::track::Track;
@@ -125,8 +126,8 @@ impl ListItem for Artist {
.read()
.unwrap()
.iter()
.filter(|t| t.id.is_some())
.map(|t| t.id.clone().unwrap())
.filter(|t| t.id().is_some())
.map(|t| t.id().clone().unwrap())
.collect();
let ids: Vec<String> = tracks
.iter()
@@ -170,7 +171,11 @@ impl ListItem for Artist {
fn play(&mut self, queue: Arc<Queue>) {
self.load_albums(queue.get_spotify());
if let Some(tracks) = self.tracks() {
if let Some(tracks) = self.tracks.as_ref() {
let tracks: Vec<Playable> = tracks
.iter()
.map(|track| Playable::Track(track.clone()))
.collect();
let index = queue.append_next(tracks);
queue.play(index, true, true);
}
@@ -181,7 +186,7 @@ impl ListItem for Artist {
if let Some(tracks) = self.tracks() {
for t in tracks {
queue.append(t);
queue.append(Playable::Track(t.clone()));
}
}
}