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

@@ -6,6 +6,7 @@ use rspotify::model::album::{FullAlbum, SavedAlbum, SimplifiedAlbum};
use crate::artist::Artist;
use crate::library::Library;
use crate::playable::Playable;
use crate::queue::Queue;
use crate::spotify::Spotify;
use crate::track::Track;
@@ -136,8 +137,8 @@ impl ListItem for Album {
.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()
@@ -175,7 +176,10 @@ impl ListItem for Album {
self.load_tracks(queue.get_spotify());
if let Some(tracks) = self.tracks.as_ref() {
let tracks: Vec<&Track> = tracks.iter().collect();
let tracks: Vec<Playable> = tracks
.iter()
.map(|track| Playable::Track(track.clone()))
.collect();
let index = queue.append_next(tracks);
queue.play(index, true, true);
}
@@ -186,7 +190,7 @@ impl ListItem for Album {
if let Some(tracks) = self.tracks.as_ref() {
for t in tracks {
queue.append(&t);
queue.append(Playable::Track(t.clone()));
}
}
}