Update to rspotify 0.11.2 (#640)
* Update to rspotify 0.11.x Many breaking changes * Minor cleanups via Clippy
This commit is contained in:
committed by
GitHub
parent
a8c8a1761a
commit
96f2d88696
@@ -3,6 +3,7 @@ use std::thread;
|
||||
|
||||
use cursive::view::ViewWrapper;
|
||||
use cursive::Cursive;
|
||||
use rspotify::model::AlbumType;
|
||||
|
||||
use crate::album::Album;
|
||||
use crate::artist::Artist;
|
||||
@@ -14,7 +15,6 @@ use crate::track::Track;
|
||||
use crate::traits::ViewExt;
|
||||
use crate::ui::listview::ListView;
|
||||
use crate::ui::tabview::TabView;
|
||||
use rspotify::senum::AlbumType;
|
||||
|
||||
pub struct ArtistView {
|
||||
artist: Artist,
|
||||
@@ -53,7 +53,7 @@ impl ArtistView {
|
||||
let library = library.clone();
|
||||
thread::spawn(move || {
|
||||
if let Some(id) = id {
|
||||
if let Some(artists) = spotify.api.artist_related_artists(id) {
|
||||
if let Some(artists) = spotify.api.artist_related_artists(&id) {
|
||||
related.write().unwrap().extend(artists);
|
||||
library.trigger_redraw();
|
||||
}
|
||||
|
||||
@@ -71,7 +71,7 @@ impl ContextMenu {
|
||||
let spotify = spotify.clone();
|
||||
let library = library.clone();
|
||||
|
||||
playlist.append_tracks(&[track.clone()], spotify, library);
|
||||
playlist.append_tracks(&[Playable::Track(track.clone())], spotify, library);
|
||||
c.pop_layer();
|
||||
|
||||
// Close add_track_dialog too
|
||||
@@ -81,7 +81,7 @@ impl ContextMenu {
|
||||
let modal = Modal::new(already_added_dialog);
|
||||
s.add_layer(modal);
|
||||
} else {
|
||||
playlist.append_tracks(&[track], spotify, library);
|
||||
playlist.append_tracks(&[Playable::Track(track)], spotify, library);
|
||||
s.pop_layer();
|
||||
}
|
||||
});
|
||||
|
||||
@@ -117,7 +117,7 @@ impl<I: ListItem> ListView<I> {
|
||||
.iter()
|
||||
.map(|track| Playable::Track(track.clone()))
|
||||
.collect();
|
||||
let index = self.queue.append_next(tracks);
|
||||
let index = self.queue.append_next(&tracks);
|
||||
self.queue.play(index + self.selected, true, false);
|
||||
true
|
||||
} else {
|
||||
|
||||
@@ -6,16 +6,17 @@ use cursive::Cursive;
|
||||
use crate::command::Command;
|
||||
use crate::commands::CommandResult;
|
||||
use crate::library::Library;
|
||||
use crate::playable::Playable;
|
||||
use crate::playlist::Playlist;
|
||||
use crate::queue::Queue;
|
||||
use crate::spotify::Spotify;
|
||||
use crate::track::Track;
|
||||
|
||||
use crate::traits::ViewExt;
|
||||
use crate::ui::listview::ListView;
|
||||
|
||||
pub struct PlaylistView {
|
||||
playlist: Playlist,
|
||||
list: ListView<Track>,
|
||||
list: ListView<Playable>,
|
||||
spotify: Spotify,
|
||||
library: Arc<Library>,
|
||||
queue: Arc<Queue>,
|
||||
@@ -54,7 +55,7 @@ impl PlaylistView {
|
||||
}
|
||||
|
||||
impl ViewWrapper for PlaylistView {
|
||||
wrap_impl!(self.list: ListView<Track>);
|
||||
wrap_impl!(self.list: ListView<Playable>);
|
||||
}
|
||||
|
||||
impl ViewExt for PlaylistView {
|
||||
@@ -64,7 +65,7 @@ impl ViewExt for PlaylistView {
|
||||
|
||||
fn title_sub(&self) -> String {
|
||||
if let Some(tracks) = self.playlist.tracks.as_ref() {
|
||||
let duration_secs = tracks.iter().map(|p| p.duration as u64 / 1000).sum();
|
||||
let duration_secs = tracks.iter().map(|p| p.duration() as u64 / 1000).sum();
|
||||
let duration = std::time::Duration::from_secs(duration_secs);
|
||||
format!(
|
||||
"{} tracks, {}",
|
||||
|
||||
@@ -28,7 +28,6 @@ use crate::ui::pagination::Pagination;
|
||||
use crate::ui::search_results::SearchResultsView;
|
||||
use crate::ui::tabview::TabView;
|
||||
use rspotify::model::search::SearchResult;
|
||||
use rspotify::senum::SearchType;
|
||||
|
||||
pub struct SearchView {
|
||||
edit: NamedView<EditView>,
|
||||
|
||||
@@ -18,7 +18,7 @@ use crate::ui::tabview::TabView;
|
||||
use cursive::view::ViewWrapper;
|
||||
use cursive::Cursive;
|
||||
use rspotify::model::search::SearchResult;
|
||||
use rspotify::senum::SearchType;
|
||||
use rspotify::model::SearchType;
|
||||
use std::sync::{Arc, RwLock};
|
||||
|
||||
pub struct SearchResultsView {
|
||||
|
||||
Reference in New Issue
Block a user