cargo fmt/clippy
This commit is contained in:
@@ -7,7 +7,7 @@ use crate::events::EventManager;
|
|||||||
use crate::library::Library;
|
use crate::library::Library;
|
||||||
use crate::queue::{Queue, RepeatSetting};
|
use crate::queue::{Queue, RepeatSetting};
|
||||||
use crate::spotify::{Spotify, VOLUME_PERCENT};
|
use crate::spotify::{Spotify, VOLUME_PERCENT};
|
||||||
use crate::traits::{ViewExt, IntoBoxedViewExt};
|
use crate::traits::{IntoBoxedViewExt, ViewExt};
|
||||||
use crate::ui::contextmenu::ContextMenu;
|
use crate::ui::contextmenu::ContextMenu;
|
||||||
use crate::ui::help::HelpView;
|
use crate::ui::help::HelpView;
|
||||||
use crate::ui::layout::Layout;
|
use crate::ui::layout::Layout;
|
||||||
@@ -216,7 +216,9 @@ impl CommandManager {
|
|||||||
self.queue.clone(),
|
self.queue.clone(),
|
||||||
self.library.clone(),
|
self.library.clone(),
|
||||||
);
|
);
|
||||||
s.call_on_name("main", |v: &mut Layout| v.push_view(view.as_boxed_view_ext()));
|
s.call_on_name("main", |v: &mut Layout| {
|
||||||
|
v.push_view(view.as_boxed_view_ext())
|
||||||
|
});
|
||||||
Ok(None)
|
Ok(None)
|
||||||
}
|
}
|
||||||
Command::Jump(_)
|
Command::Jump(_)
|
||||||
|
|||||||
@@ -12,7 +12,6 @@ use librespot_playback::config::Bitrate;
|
|||||||
use librespot_playback::mixer::Mixer;
|
use librespot_playback::mixer::Mixer;
|
||||||
use librespot_playback::player::{Player, PlayerEvent as LibrespotPlayerEvent};
|
use librespot_playback::player::{Player, PlayerEvent as LibrespotPlayerEvent};
|
||||||
|
|
||||||
use rspotify::{blocking::client::ApiError, senum::Country};
|
|
||||||
use rspotify::blocking::client::Spotify as SpotifyAPI;
|
use rspotify::blocking::client::Spotify as SpotifyAPI;
|
||||||
use rspotify::model::album::{FullAlbum, SavedAlbum, SimplifiedAlbum};
|
use rspotify::model::album::{FullAlbum, SavedAlbum, SimplifiedAlbum};
|
||||||
use rspotify::model::artist::FullArtist;
|
use rspotify::model::artist::FullArtist;
|
||||||
@@ -22,6 +21,7 @@ use rspotify::model::search::SearchResult;
|
|||||||
use rspotify::model::track::{FullTrack, SavedTrack, SimplifiedTrack};
|
use rspotify::model::track::{FullTrack, SavedTrack, SimplifiedTrack};
|
||||||
use rspotify::model::user::PrivateUser;
|
use rspotify::model::user::PrivateUser;
|
||||||
use rspotify::senum::SearchType;
|
use rspotify::senum::SearchType;
|
||||||
|
use rspotify::{blocking::client::ApiError, senum::Country};
|
||||||
|
|
||||||
use serde_json::{json, Map};
|
use serde_json::{json, Map};
|
||||||
|
|
||||||
@@ -774,7 +774,9 @@ impl Spotify {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub fn show_episodes(&self, show_id: &str, offset: u32) -> Option<Page<SimplifiedEpisode>> {
|
pub fn show_episodes(&self, show_id: &str, offset: u32) -> Option<Page<SimplifiedEpisode>> {
|
||||||
self.api_with_retry(|api| api.get_shows_episodes(show_id.to_string(), 50, offset, self.country))
|
self.api_with_retry(|api| {
|
||||||
|
api.get_shows_episodes(show_id.to_string(), 50, offset, self.country)
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn get_saved_shows(&self, offset: u32) -> Option<Page<Show>> {
|
pub fn get_saved_shows(&self, offset: u32) -> Option<Page<Show>> {
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ pub struct SelectArtistMenu {
|
|||||||
|
|
||||||
enum ContextMenuAction {
|
enum ContextMenuAction {
|
||||||
ShowItem(Box<dyn ListItem>),
|
ShowItem(Box<dyn ListItem>),
|
||||||
SelectArtist(Box<Vec<Artist>>),
|
SelectArtist(Vec<Artist>),
|
||||||
ShareUrl(String),
|
ShareUrl(String),
|
||||||
AddToPlaylist(Box<Track>),
|
AddToPlaylist(Box<Track>),
|
||||||
ShowRecommentations(Box<dyn ListItem>),
|
ShowRecommentations(Box<dyn ListItem>),
|
||||||
@@ -142,14 +142,11 @@ impl ContextMenu {
|
|||||||
let action = match a.len() {
|
let action = match a.len() {
|
||||||
0 => None,
|
0 => None,
|
||||||
1 => Some(ContextMenuAction::ShowItem(Box::new(a[0].clone()))),
|
1 => Some(ContextMenuAction::ShowItem(Box::new(a[0].clone()))),
|
||||||
_ => Some(ContextMenuAction::SelectArtist(Box::new(a))),
|
_ => Some(ContextMenuAction::SelectArtist(a)),
|
||||||
};
|
};
|
||||||
|
|
||||||
if let Some(a) = action {
|
if let Some(a) = action {
|
||||||
content.add_item(
|
content.add_item("Show artist", a)
|
||||||
"Show artist",
|
|
||||||
a
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if let Some(a) = item.album(queue.clone()) {
|
if let Some(a) = item.album(queue.clone()) {
|
||||||
@@ -208,7 +205,7 @@ impl ContextMenu {
|
|||||||
track.toggle_saved(library);
|
track.toggle_saved(library);
|
||||||
}
|
}
|
||||||
ContextMenuAction::SelectArtist(artists) => {
|
ContextMenuAction::SelectArtist(artists) => {
|
||||||
let dialog = Self::select_artist_dialog(library, queue, *artists.clone());
|
let dialog = Self::select_artist_dialog(library, queue, artists.clone());
|
||||||
s.add_layer(dialog);
|
s.add_layer(dialog);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -621,7 +621,8 @@ impl<I: ListItem + Clone> ViewExt for ListView<I> {
|
|||||||
return match artists.len() {
|
return match artists.len() {
|
||||||
0 => Ok(CommandResult::Consumed(None)),
|
0 => Ok(CommandResult::Consumed(None)),
|
||||||
1 => {
|
1 => {
|
||||||
let view = ArtistView::new(queue, library, &artists[0]).as_boxed_view_ext();
|
let view = ArtistView::new(queue, library, &artists[0])
|
||||||
|
.as_boxed_view_ext();
|
||||||
Ok(CommandResult::View(view))
|
Ok(CommandResult::View(view))
|
||||||
}
|
}
|
||||||
_ => {
|
_ => {
|
||||||
|
|||||||
Reference in New Issue
Block a user