update to rust edition 2018 + bump version
This commit is contained in:
2
Cargo.lock
generated
2
Cargo.lock
generated
@@ -1637,7 +1637,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "ncspot"
|
||||
version = "0.1.2"
|
||||
version = "0.1.3"
|
||||
dependencies = [
|
||||
"chrono 0.4.11 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"clap 2.33.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
|
||||
@@ -2,12 +2,13 @@
|
||||
name = "ncspot"
|
||||
description = "ncurses Spotify client written in Rust using librespot, inspired by ncmpc and the likes."
|
||||
exclude = ["screenshots/**"]
|
||||
version = "0.1.2"
|
||||
version = "0.1.3"
|
||||
authors = ["Henrik Friedrichsen <henrik@affekt.org>"]
|
||||
repository = "https://github.com/hrkfdn/ncspot"
|
||||
keywords = ["spotify", "ncurses", "librespot"]
|
||||
license = "BSD-2-Clause"
|
||||
readme = "README.md"
|
||||
edition = "2018"
|
||||
|
||||
[badges]
|
||||
travis-ci = { repository = "hrkfdn/ncspot", branch = "master" }
|
||||
|
||||
14
src/album.rs
14
src/album.rs
@@ -4,13 +4,13 @@ use std::sync::Arc;
|
||||
use chrono::{DateTime, Utc};
|
||||
use rspotify::spotify::model::album::{FullAlbum, SavedAlbum, SimplifiedAlbum};
|
||||
|
||||
use artist::Artist;
|
||||
use library::Library;
|
||||
use queue::Queue;
|
||||
use spotify::Spotify;
|
||||
use track::Track;
|
||||
use traits::{IntoBoxedViewExt, ListItem, ViewExt};
|
||||
use ui::album::AlbumView;
|
||||
use crate::artist::Artist;
|
||||
use crate::library::Library;
|
||||
use crate::queue::Queue;
|
||||
use crate::spotify::Spotify;
|
||||
use crate::track::Track;
|
||||
use crate::traits::{IntoBoxedViewExt, ListItem, ViewExt};
|
||||
use crate::ui::album::AlbumView;
|
||||
|
||||
#[derive(Clone, Deserialize, Serialize)]
|
||||
pub struct Album {
|
||||
|
||||
@@ -3,13 +3,13 @@ use std::sync::Arc;
|
||||
|
||||
use rspotify::spotify::model::artist::{FullArtist, SimplifiedArtist};
|
||||
|
||||
use album::Album;
|
||||
use library::Library;
|
||||
use queue::Queue;
|
||||
use spotify::Spotify;
|
||||
use track::Track;
|
||||
use traits::{IntoBoxedViewExt, ListItem, ViewExt};
|
||||
use ui::artist::ArtistView;
|
||||
use crate::album::Album;
|
||||
use crate::library::Library;
|
||||
use crate::queue::Queue;
|
||||
use crate::spotify::Spotify;
|
||||
use crate::track::Track;
|
||||
use crate::traits::{IntoBoxedViewExt, ListItem, ViewExt};
|
||||
use crate::ui::artist::ArtistView;
|
||||
|
||||
#[derive(Clone, Deserialize, Serialize)]
|
||||
pub struct Artist {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
use queue::RepeatSetting;
|
||||
use crate::queue::RepeatSetting;
|
||||
use std::collections::HashMap;
|
||||
use std::fmt;
|
||||
use std::iter::FromIterator;
|
||||
@@ -252,7 +252,7 @@ pub fn parse(input: &str) -> Option<Command> {
|
||||
|
||||
Some(Command::Repeat(mode))
|
||||
}
|
||||
"seek" => args.get(0).and_then(|arg| match arg.chars().nth(0) {
|
||||
"seek" => args.get(0).and_then(|arg| match arg.chars().next() {
|
||||
Some(x) if x == '-' || x == '+' => String::from_iter(arg.chars().skip(1))
|
||||
.parse::<i32>()
|
||||
.ok()
|
||||
|
||||
@@ -2,16 +2,16 @@ use std::collections::HashMap;
|
||||
use std::sync::Arc;
|
||||
use std::time::Duration;
|
||||
|
||||
use command::{parse, Command, GotoMode, MoveMode, SeekDirection, ShiftMode, TargetMode};
|
||||
use crate::command::{parse, Command, GotoMode, MoveMode, SeekDirection, ShiftMode, TargetMode};
|
||||
use crate::library::Library;
|
||||
use crate::queue::{Queue, RepeatSetting};
|
||||
use crate::spotify::{Spotify, VOLUME_PERCENT};
|
||||
use crate::traits::ViewExt;
|
||||
use crate::ui::layout::Layout;
|
||||
use cursive::event::{Event, Key};
|
||||
use cursive::traits::View;
|
||||
use cursive::views::ViewRef;
|
||||
use cursive::Cursive;
|
||||
use library::Library;
|
||||
use queue::{Queue, RepeatSetting};
|
||||
use spotify::{Spotify, VOLUME_PERCENT};
|
||||
use traits::ViewExt;
|
||||
use ui::layout::Layout;
|
||||
|
||||
pub enum CommandResult {
|
||||
Consumed(Option<String>),
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
use crossbeam_channel::{unbounded, Receiver, Sender, TryIter};
|
||||
use cursive::{CbSink, Cursive};
|
||||
|
||||
use spotify::PlayerEvent;
|
||||
use crate::spotify::PlayerEvent;
|
||||
|
||||
pub enum Event {
|
||||
Player(PlayerEvent),
|
||||
|
||||
@@ -9,13 +9,13 @@ use rspotify::spotify::model::playlist::SimplifiedPlaylist;
|
||||
use serde::de::DeserializeOwned;
|
||||
use serde::Serialize;
|
||||
|
||||
use album::Album;
|
||||
use artist::Artist;
|
||||
use config;
|
||||
use events::EventManager;
|
||||
use playlist::Playlist;
|
||||
use spotify::Spotify;
|
||||
use track::Track;
|
||||
use crate::album::Album;
|
||||
use crate::artist::Artist;
|
||||
use crate::config;
|
||||
use crate::events::EventManager;
|
||||
use crate::playlist::Playlist;
|
||||
use crate::spotify::Spotify;
|
||||
use crate::track::Track;
|
||||
|
||||
const CACHE_TRACKS: &str = "tracks.db";
|
||||
const CACHE_ALBUMS: &str = "albums.db";
|
||||
|
||||
41
src/main.rs
41
src/main.rs
@@ -69,10 +69,10 @@ mod ui;
|
||||
#[cfg(feature = "mpris")]
|
||||
mod mpris;
|
||||
|
||||
use commands::CommandManager;
|
||||
use events::{Event, EventManager};
|
||||
use library::Library;
|
||||
use spotify::PlayerEvent;
|
||||
use crate::commands::CommandManager;
|
||||
use crate::events::{Event, EventManager};
|
||||
use crate::library::Library;
|
||||
use crate::spotify::PlayerEvent;
|
||||
|
||||
fn setup_logging(filename: &str) -> Result<(), fern::InitError> {
|
||||
fern::Dispatch::new()
|
||||
@@ -103,11 +103,12 @@ fn get_credentials(reset: bool) -> Credentials {
|
||||
error!("could not delete credential file");
|
||||
}
|
||||
|
||||
let creds = ::config::load_or_generate_default(&path, authentication::create_credentials, true)
|
||||
.unwrap_or_else(|e| {
|
||||
eprintln!("{}", e);
|
||||
process::exit(1);
|
||||
});
|
||||
let creds =
|
||||
crate::config::load_or_generate_default(&path, authentication::create_credentials, true)
|
||||
.unwrap_or_else(|e| {
|
||||
eprintln!("{}", e);
|
||||
process::exit(1);
|
||||
});
|
||||
|
||||
#[cfg(target_family = "unix")]
|
||||
std::fs::set_permissions(path, std::os::unix::fs::PermissionsExt::from_mode(0o600))
|
||||
@@ -156,13 +157,17 @@ fn main() {
|
||||
|
||||
// Things here may cause the process to abort; we must do them before creating curses windows
|
||||
// otherwise the error message will not be seen by a user
|
||||
let cfg: ::config::Config = {
|
||||
let cfg: crate::config::Config = {
|
||||
let path = config::config_path("config.toml");
|
||||
::config::load_or_generate_default(path, |_| Ok(::config::Config::default()), false)
|
||||
.unwrap_or_else(|e| {
|
||||
eprintln!("{}", e);
|
||||
process::exit(1);
|
||||
})
|
||||
crate::config::load_or_generate_default(
|
||||
path,
|
||||
|_| Ok(crate::config::Config::default()),
|
||||
false,
|
||||
)
|
||||
.unwrap_or_else(|e| {
|
||||
eprintln!("{}", e);
|
||||
process::exit(1);
|
||||
})
|
||||
};
|
||||
|
||||
let mut credentials = get_credentials(false);
|
||||
@@ -178,7 +183,11 @@ fn main() {
|
||||
|
||||
let event_manager = EventManager::new(cursive.cb_sink().clone());
|
||||
|
||||
let spotify = Arc::new(spotify::Spotify::new(event_manager.clone(), credentials, &cfg));
|
||||
let spotify = Arc::new(spotify::Spotify::new(
|
||||
event_manager.clone(),
|
||||
credentials,
|
||||
&cfg,
|
||||
));
|
||||
|
||||
let queue = Arc::new(queue::Queue::new(spotify.clone()));
|
||||
|
||||
|
||||
@@ -8,9 +8,9 @@ use dbus::stdintf::org_freedesktop_dbus::PropertiesPropertiesChanged;
|
||||
use dbus::tree::{Access, Factory};
|
||||
use dbus::{Path, SignalArgs};
|
||||
|
||||
use queue::{Queue, RepeatSetting};
|
||||
use spotify::{PlayerEvent, Spotify};
|
||||
use track::Track;
|
||||
use crate::queue::{Queue, RepeatSetting};
|
||||
use crate::spotify::{PlayerEvent, Spotify};
|
||||
use crate::track::Track;
|
||||
|
||||
type Metadata = HashMap<String, Variant<Box<dyn RefArg>>>;
|
||||
struct MprisState(String, Option<Track>);
|
||||
|
||||
@@ -3,12 +3,12 @@ use std::sync::Arc;
|
||||
|
||||
use rspotify::spotify::model::playlist::{FullPlaylist, SimplifiedPlaylist};
|
||||
|
||||
use library::Library;
|
||||
use queue::Queue;
|
||||
use spotify::Spotify;
|
||||
use track::Track;
|
||||
use traits::{IntoBoxedViewExt, ListItem, ViewExt};
|
||||
use ui::playlist::PlaylistView;
|
||||
use crate::library::Library;
|
||||
use crate::queue::Queue;
|
||||
use crate::spotify::Spotify;
|
||||
use crate::track::Track;
|
||||
use crate::traits::{IntoBoxedViewExt, ListItem, ViewExt};
|
||||
use crate::ui::playlist::PlaylistView;
|
||||
|
||||
#[derive(Clone, Debug, Deserialize, Serialize)]
|
||||
pub struct Playlist {
|
||||
|
||||
17
src/queue.rs
17
src/queue.rs
@@ -1,10 +1,11 @@
|
||||
use std::cmp::Ordering;
|
||||
use std::sync::{Arc, RwLock};
|
||||
|
||||
use rand::prelude::*;
|
||||
use strum_macros::Display;
|
||||
|
||||
use spotify::Spotify;
|
||||
use track::Track;
|
||||
use crate::spotify::Spotify;
|
||||
use crate::track::Track;
|
||||
|
||||
#[derive(Display, Clone, Copy, PartialEq, Debug, Serialize, Deserialize)]
|
||||
pub enum RepeatSetting {
|
||||
@@ -142,11 +143,13 @@ impl Queue {
|
||||
// of the one we deleted
|
||||
let current = *self.current_track.read().unwrap();
|
||||
if let Some(current_track) = current {
|
||||
if index == current_track {
|
||||
self.play(index, false, false);
|
||||
} else if index < current_track {
|
||||
let mut current = self.current_track.write().unwrap();
|
||||
current.replace(current_track - 1);
|
||||
match current_track.cmp(&index) {
|
||||
Ordering::Equal => self.play(index, false, false),
|
||||
Ordering::Greater => {
|
||||
let mut current = self.current_track.write().unwrap();
|
||||
current.replace(current_track - 1);
|
||||
}
|
||||
_ => (),
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -42,11 +42,11 @@ use std::sync::RwLock;
|
||||
use std::thread;
|
||||
use std::time::{Duration, SystemTime};
|
||||
|
||||
use artist::Artist;
|
||||
use config;
|
||||
use events::{Event, EventManager};
|
||||
use track::Track;
|
||||
use queue;
|
||||
use crate::artist::Artist;
|
||||
use crate::config;
|
||||
use crate::events::{Event, EventManager};
|
||||
use crate::queue;
|
||||
use crate::track::Track;
|
||||
|
||||
pub const VOLUME_PERCENT: u16 = ((u16::max_value() as f64) * 1.0 / 100.0) as u16;
|
||||
|
||||
@@ -223,7 +223,7 @@ impl Spotify {
|
||||
let (user_tx, user_rx) = oneshot::channel();
|
||||
let volume = match &cfg.saved_state {
|
||||
Some(state) => match state.volume {
|
||||
Some(vol) => ((std::cmp::min(vol, 100) as f32)/100.0 * (0xFFFF as f32)).ceil() as u16,
|
||||
Some(vol) => ((std::cmp::min(vol, 100) as f32) / 100.0 * 65535_f32).ceil() as u16,
|
||||
None => 0xFFFF as u16,
|
||||
},
|
||||
None => 0xFFFF as u16,
|
||||
@@ -234,7 +234,7 @@ impl Spotify {
|
||||
"track" => queue::RepeatSetting::RepeatTrack,
|
||||
"playlist" => queue::RepeatSetting::RepeatPlaylist,
|
||||
_ => queue::RepeatSetting::None,
|
||||
}
|
||||
},
|
||||
_ => queue::RepeatSetting::None,
|
||||
},
|
||||
_ => queue::RepeatSetting::None,
|
||||
@@ -263,8 +263,8 @@ impl Spotify {
|
||||
channel: tx,
|
||||
user: user_rx.wait().expect("error retrieving userid from worker"),
|
||||
volume: AtomicU16::new(volume),
|
||||
repeat: repeat,
|
||||
shuffle: shuffle,
|
||||
repeat,
|
||||
shuffle,
|
||||
};
|
||||
|
||||
// acquire token for web api usage
|
||||
|
||||
@@ -3,7 +3,7 @@ use cursive::theme::Color::*;
|
||||
use cursive::theme::PaletteColor::*;
|
||||
use cursive::theme::*;
|
||||
|
||||
use config::Config;
|
||||
use crate::config::Config;
|
||||
|
||||
macro_rules! load_color {
|
||||
( $cfg: expr, $member: ident, $default: expr ) => {
|
||||
|
||||
10
src/track.rs
10
src/track.rs
@@ -5,11 +5,11 @@ use chrono::{DateTime, Utc};
|
||||
use rspotify::spotify::model::album::FullAlbum;
|
||||
use rspotify::spotify::model::track::{FullTrack, SavedTrack, SimplifiedTrack};
|
||||
|
||||
use album::Album;
|
||||
use artist::Artist;
|
||||
use library::Library;
|
||||
use queue::Queue;
|
||||
use traits::{ListItem, ViewExt};
|
||||
use crate::album::Album;
|
||||
use crate::artist::Artist;
|
||||
use crate::library::Library;
|
||||
use crate::queue::Queue;
|
||||
use crate::traits::{ListItem, ViewExt};
|
||||
|
||||
#[derive(Clone, Deserialize, Serialize)]
|
||||
pub struct Track {
|
||||
|
||||
@@ -4,13 +4,13 @@ use cursive::view::{View, ViewWrapper};
|
||||
use cursive::views::NamedView;
|
||||
use cursive::Cursive;
|
||||
|
||||
use album::Album;
|
||||
use artist::Artist;
|
||||
use command::Command;
|
||||
use commands::CommandResult;
|
||||
use library::Library;
|
||||
use queue::Queue;
|
||||
use track::Track;
|
||||
use crate::album::Album;
|
||||
use crate::artist::Artist;
|
||||
use crate::command::Command;
|
||||
use crate::commands::CommandResult;
|
||||
use crate::library::Library;
|
||||
use crate::queue::Queue;
|
||||
use crate::track::Track;
|
||||
|
||||
pub trait ListItem: Sync + Send + 'static {
|
||||
fn is_playing(&self, queue: Arc<Queue>) -> bool;
|
||||
|
||||
@@ -3,15 +3,15 @@ use std::sync::{Arc, RwLock};
|
||||
use cursive::view::ViewWrapper;
|
||||
use cursive::Cursive;
|
||||
|
||||
use album::Album;
|
||||
use artist::Artist;
|
||||
use command::Command;
|
||||
use commands::CommandResult;
|
||||
use library::Library;
|
||||
use queue::Queue;
|
||||
use traits::ViewExt;
|
||||
use ui::listview::ListView;
|
||||
use ui::tabview::TabView;
|
||||
use crate::album::Album;
|
||||
use crate::artist::Artist;
|
||||
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::tabview::TabView;
|
||||
|
||||
pub struct AlbumView {
|
||||
album: Album,
|
||||
|
||||
@@ -4,15 +4,15 @@ use std::thread;
|
||||
use cursive::view::ViewWrapper;
|
||||
use cursive::Cursive;
|
||||
|
||||
use artist::Artist;
|
||||
use command::Command;
|
||||
use commands::CommandResult;
|
||||
use library::Library;
|
||||
use queue::Queue;
|
||||
use track::Track;
|
||||
use traits::ViewExt;
|
||||
use ui::listview::ListView;
|
||||
use ui::tabview::TabView;
|
||||
use crate::artist::Artist;
|
||||
use crate::command::Command;
|
||||
use crate::commands::CommandResult;
|
||||
use crate::library::Library;
|
||||
use crate::queue::Queue;
|
||||
use crate::track::Track;
|
||||
use crate::traits::ViewExt;
|
||||
use crate::ui::listview::ListView;
|
||||
use crate::ui::tabview::TabView;
|
||||
|
||||
pub struct ArtistView {
|
||||
artist: Artist,
|
||||
|
||||
@@ -4,14 +4,14 @@ use cursive::view::{Margins, ViewWrapper};
|
||||
use cursive::views::{Dialog, ScrollView, SelectView};
|
||||
use cursive::Cursive;
|
||||
|
||||
use crate::library::Library;
|
||||
use crate::queue::Queue;
|
||||
use crate::track::Track;
|
||||
use crate::traits::ListItem;
|
||||
use crate::ui::layout::Layout;
|
||||
use crate::ui::modal::Modal;
|
||||
#[cfg(feature = "share_clipboard")]
|
||||
use clipboard::{ClipboardContext, ClipboardProvider};
|
||||
use library::Library;
|
||||
use queue::Queue;
|
||||
use track::Track;
|
||||
use traits::ListItem;
|
||||
use ui::layout::Layout;
|
||||
use ui::modal::Modal;
|
||||
|
||||
pub struct ContextMenu {
|
||||
dialog: Modal<Dialog>,
|
||||
|
||||
@@ -5,9 +5,9 @@ use cursive::utils::markup::StyledString;
|
||||
use cursive::view::ViewWrapper;
|
||||
use cursive::views::{ScrollView, TextView};
|
||||
|
||||
use command::Command;
|
||||
use config::config_path;
|
||||
use traits::ViewExt;
|
||||
use crate::command::Command;
|
||||
use crate::config::config_path;
|
||||
use crate::traits::ViewExt;
|
||||
|
||||
pub struct HelpView {
|
||||
view: ScrollView<TextView>,
|
||||
|
||||
@@ -12,10 +12,10 @@ use cursive::views::EditView;
|
||||
use cursive::{Cursive, Printer};
|
||||
use unicode_width::UnicodeWidthStr;
|
||||
|
||||
use command::Command;
|
||||
use commands::CommandResult;
|
||||
use events;
|
||||
use traits::{IntoBoxedViewExt, ViewExt};
|
||||
use crate::command::Command;
|
||||
use crate::commands::CommandResult;
|
||||
use crate::events;
|
||||
use crate::traits::{IntoBoxedViewExt, ViewExt};
|
||||
|
||||
struct Screen {
|
||||
title: String,
|
||||
|
||||
@@ -3,14 +3,14 @@ use std::sync::Arc;
|
||||
use cursive::view::ViewWrapper;
|
||||
use cursive::Cursive;
|
||||
|
||||
use command::Command;
|
||||
use commands::CommandResult;
|
||||
use library::Library;
|
||||
use queue::Queue;
|
||||
use traits::ViewExt;
|
||||
use ui::listview::ListView;
|
||||
use ui::playlists::PlaylistsView;
|
||||
use ui::tabview::TabView;
|
||||
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,
|
||||
|
||||
@@ -9,17 +9,17 @@ use cursive::view::ScrollBase;
|
||||
use cursive::{Cursive, Printer, Rect, Vec2};
|
||||
use unicode_width::UnicodeWidthStr;
|
||||
|
||||
use crate::command::{Command, GotoMode, MoveMode, TargetMode};
|
||||
use crate::commands::CommandResult;
|
||||
use crate::library::Library;
|
||||
use crate::queue::Queue;
|
||||
use crate::track::Track;
|
||||
use crate::traits::{IntoBoxedViewExt, ListItem, ViewExt};
|
||||
use crate::ui::album::AlbumView;
|
||||
use crate::ui::artist::ArtistView;
|
||||
use crate::ui::contextmenu::ContextMenu;
|
||||
#[cfg(feature = "share_clipboard")]
|
||||
use clipboard::{ClipboardContext, ClipboardProvider};
|
||||
use command::{Command, GotoMode, MoveMode, TargetMode};
|
||||
use commands::CommandResult;
|
||||
use library::Library;
|
||||
use queue::Queue;
|
||||
use track::Track;
|
||||
use traits::{IntoBoxedViewExt, ListItem, ViewExt};
|
||||
use ui::album::AlbumView;
|
||||
use ui::artist::ArtistView;
|
||||
use ui::contextmenu::ContextMenu;
|
||||
|
||||
pub type Paginator<I> = Box<dyn Fn(Arc<RwLock<Vec<I>>>) + Send + Sync>;
|
||||
pub struct Pagination<I: ListItem> {
|
||||
|
||||
@@ -3,14 +3,14 @@ use std::sync::{Arc, RwLock};
|
||||
use cursive::view::ViewWrapper;
|
||||
use cursive::Cursive;
|
||||
|
||||
use command::Command;
|
||||
use commands::CommandResult;
|
||||
use library::Library;
|
||||
use playlist::Playlist;
|
||||
use queue::Queue;
|
||||
use track::Track;
|
||||
use traits::ViewExt;
|
||||
use ui::listview::ListView;
|
||||
use crate::command::Command;
|
||||
use crate::commands::CommandResult;
|
||||
use crate::library::Library;
|
||||
use crate::playlist::Playlist;
|
||||
use crate::queue::Queue;
|
||||
use crate::track::Track;
|
||||
use crate::traits::ViewExt;
|
||||
use crate::ui::listview::ListView;
|
||||
|
||||
pub struct PlaylistView {
|
||||
playlist: Playlist,
|
||||
|
||||
@@ -4,14 +4,14 @@ use cursive::view::{Margins, ViewWrapper};
|
||||
use cursive::views::Dialog;
|
||||
use cursive::Cursive;
|
||||
|
||||
use command::Command;
|
||||
use commands::CommandResult;
|
||||
use library::Library;
|
||||
use playlist::Playlist;
|
||||
use queue::Queue;
|
||||
use traits::ViewExt;
|
||||
use ui::listview::ListView;
|
||||
use ui::modal::Modal;
|
||||
use crate::command::Command;
|
||||
use crate::commands::CommandResult;
|
||||
use crate::library::Library;
|
||||
use crate::playlist::Playlist;
|
||||
use crate::queue::Queue;
|
||||
use crate::traits::ViewExt;
|
||||
use crate::ui::listview::ListView;
|
||||
use crate::ui::modal::Modal;
|
||||
|
||||
pub struct PlaylistsView {
|
||||
list: ListView<Playlist>,
|
||||
|
||||
@@ -6,14 +6,14 @@ use cursive::Cursive;
|
||||
use std::cmp::min;
|
||||
use std::sync::Arc;
|
||||
|
||||
use command::{Command, ShiftMode};
|
||||
use commands::CommandResult;
|
||||
use library::Library;
|
||||
use queue::Queue;
|
||||
use track::Track;
|
||||
use traits::ViewExt;
|
||||
use ui::listview::ListView;
|
||||
use ui::modal::Modal;
|
||||
use crate::command::{Command, ShiftMode};
|
||||
use crate::commands::CommandResult;
|
||||
use crate::library::Library;
|
||||
use crate::queue::Queue;
|
||||
use crate::track::Track;
|
||||
use crate::traits::ViewExt;
|
||||
use crate::ui::listview::ListView;
|
||||
use crate::ui::modal::Modal;
|
||||
|
||||
pub struct QueueView {
|
||||
list: ListView<Track>,
|
||||
|
||||
@@ -9,19 +9,19 @@ use cursive::{Cursive, Printer, Vec2};
|
||||
use std::cell::RefCell;
|
||||
use std::sync::{Arc, Mutex, RwLock};
|
||||
|
||||
use album::Album;
|
||||
use artist::Artist;
|
||||
use command::{Command, MoveMode};
|
||||
use commands::CommandResult;
|
||||
use events::EventManager;
|
||||
use library::Library;
|
||||
use playlist::Playlist;
|
||||
use queue::Queue;
|
||||
use spotify::{Spotify, URIType};
|
||||
use track::Track;
|
||||
use traits::{ListItem, ViewExt};
|
||||
use ui::listview::{ListView, Pagination};
|
||||
use ui::tabview::TabView;
|
||||
use crate::album::Album;
|
||||
use crate::artist::Artist;
|
||||
use crate::command::{Command, MoveMode};
|
||||
use crate::commands::CommandResult;
|
||||
use crate::events::EventManager;
|
||||
use crate::library::Library;
|
||||
use crate::playlist::Playlist;
|
||||
use crate::queue::Queue;
|
||||
use crate::spotify::{Spotify, URIType};
|
||||
use crate::track::Track;
|
||||
use crate::traits::{ListItem, ViewExt};
|
||||
use crate::ui::listview::{ListView, Pagination};
|
||||
use crate::ui::tabview::TabView;
|
||||
|
||||
pub struct SearchView {
|
||||
results_tracks: Arc<RwLock<Vec<Track>>>,
|
||||
|
||||
@@ -8,9 +8,9 @@ use cursive::vec::Vec2;
|
||||
use cursive::Printer;
|
||||
use unicode_width::UnicodeWidthStr;
|
||||
|
||||
use library::Library;
|
||||
use queue::{Queue, RepeatSetting};
|
||||
use spotify::{PlayerEvent, Spotify};
|
||||
use crate::library::Library;
|
||||
use crate::queue::{Queue, RepeatSetting};
|
||||
use crate::spotify::{PlayerEvent, Spotify};
|
||||
|
||||
pub struct StatusBar {
|
||||
queue: Arc<Queue>,
|
||||
|
||||
@@ -7,9 +7,9 @@ use cursive::traits::View;
|
||||
use cursive::{Cursive, Printer, Vec2};
|
||||
use unicode_width::UnicodeWidthStr;
|
||||
|
||||
use command::{Command, MoveMode};
|
||||
use commands::CommandResult;
|
||||
use traits::{IntoBoxedViewExt, ViewExt};
|
||||
use crate::command::{Command, MoveMode};
|
||||
use crate::commands::CommandResult;
|
||||
use crate::traits::{IntoBoxedViewExt, ViewExt};
|
||||
|
||||
pub struct Tab {
|
||||
title: String,
|
||||
|
||||
Reference in New Issue
Block a user