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