* 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
61 lines
1.6 KiB
Rust
61 lines
1.6 KiB
Rust
use std::sync::Arc;
|
|
|
|
use cursive::view::ViewWrapper;
|
|
use cursive::Cursive;
|
|
|
|
use crate::command::Command;
|
|
use crate::commands::CommandResult;
|
|
use crate::library::Library;
|
|
use crate::queue::Queue;
|
|
use crate::traits::ViewExt;
|
|
use crate::ui::listview::ListView;
|
|
use crate::ui::playlists::PlaylistsView;
|
|
use crate::ui::tabview::TabView;
|
|
|
|
pub struct LibraryView {
|
|
tabs: TabView,
|
|
}
|
|
|
|
impl LibraryView {
|
|
pub fn new(queue: Arc<Queue>, library: Arc<Library>) -> Self {
|
|
let tabs = TabView::new()
|
|
.tab(
|
|
"tracks",
|
|
"Tracks",
|
|
ListView::new(library.tracks.clone(), queue.clone(), library.clone()),
|
|
)
|
|
.tab(
|
|
"albums",
|
|
"Albums",
|
|
ListView::new(library.albums.clone(), queue.clone(), library.clone()),
|
|
)
|
|
.tab(
|
|
"artists",
|
|
"Artists",
|
|
ListView::new(library.artists.clone(), queue.clone(), library.clone()),
|
|
)
|
|
.tab(
|
|
"playlists",
|
|
"Playlists",
|
|
PlaylistsView::new(queue.clone(), library.clone()),
|
|
)
|
|
.tab(
|
|
"podcasts",
|
|
"Podcasts",
|
|
ListView::new(library.shows.clone(), queue, library.clone()),
|
|
);
|
|
|
|
Self { tabs }
|
|
}
|
|
}
|
|
|
|
impl ViewWrapper for LibraryView {
|
|
wrap_impl!(self.tabs: TabView);
|
|
}
|
|
|
|
impl ViewExt for LibraryView {
|
|
fn on_command(&mut self, s: &mut Cursive, cmd: &Command) -> Result<CommandResult, String> {
|
|
self.tabs.on_command(s, cmd)
|
|
}
|
|
}
|