Removed usage of removed libraries
parent
8c2874d2ca
commit
4f84ee9785
|
|
@ -22,6 +22,7 @@ impl App {
|
|||
options,
|
||||
should_quit: false,
|
||||
playback: Playback::new(),
|
||||
// TODO: Maybe read from some configuration (args, file, etc...)
|
||||
track_change_options: Default::default(),
|
||||
}
|
||||
}
|
||||
|
|
@ -66,11 +67,7 @@ impl App {
|
|||
pub fn on_down(&mut self) {}
|
||||
|
||||
pub fn on_enter(&mut self) {
|
||||
self.play(
|
||||
// "".into()
|
||||
// "/home/hheikkinen/Music/Casiopea - Mint Jams (1982) FULL ALBUM/001 Take Me.opus".into(),
|
||||
"/home/hheikkinen/Music/A Groovy Thing/01 - Flamingosis - A Groovy Intro.mp3".into(),
|
||||
); // TODO: Remove hardcoding
|
||||
self.play("".into()); // TODO: Remove hardcoding
|
||||
}
|
||||
|
||||
pub fn on_tab(&mut self) {}
|
||||
|
|
|
|||
14
src/lib.rs
14
src/lib.rs
|
|
@ -1,14 +1,12 @@
|
|||
use std::{path::PathBuf, str::FromStr};
|
||||
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
#[derive(Serialize, Deserialize, Debug, Default)]
|
||||
#[derive(Debug, Default)]
|
||||
pub struct ServerState {
|
||||
pub track_change_options: TrackChangeOptions,
|
||||
pub player: Option<PlayerState>,
|
||||
}
|
||||
|
||||
#[derive(Serialize, Deserialize, Debug, Default)]
|
||||
#[derive(Debug, Default)]
|
||||
pub struct PlayerState {
|
||||
pub track: PlaylistElement,
|
||||
pub is_paused: bool,
|
||||
|
|
@ -23,7 +21,7 @@ pub enum PlaylistType {
|
|||
Queue,
|
||||
}
|
||||
|
||||
#[derive(Serialize, Deserialize, Debug, Default)]
|
||||
#[derive(Debug, Default)]
|
||||
pub struct Playlist {
|
||||
pub items: Vec<PlaylistElement>,
|
||||
pub current: Option<usize>,
|
||||
|
|
@ -31,18 +29,18 @@ pub struct Playlist {
|
|||
|
||||
impl Playlist {}
|
||||
|
||||
#[derive(Serialize, Deserialize, Debug)]
|
||||
#[derive(Debug)]
|
||||
pub struct DirectoryPlaylist {
|
||||
pub directory: PathBuf,
|
||||
pub playlist: Playlist,
|
||||
}
|
||||
|
||||
#[derive(Serialize, Deserialize, Debug, Default)]
|
||||
#[derive(Debug, Default)]
|
||||
pub struct QueuePlaylist {
|
||||
pub playlist: Playlist,
|
||||
}
|
||||
|
||||
#[derive(Serialize, Deserialize, Debug)]
|
||||
#[derive(Debug)]
|
||||
pub struct TrackChangeOptions {
|
||||
pub shuffle: bool,
|
||||
pub next: bool,
|
||||
|
|
|
|||
36
src/main.rs
36
src/main.rs
|
|
@ -10,49 +10,13 @@ pub mod ui;
|
|||
/// rmp: Rust Music Player
|
||||
#[derive(Debug, FromArgs, Clone)]
|
||||
pub struct CliArgs {
|
||||
/// run the server
|
||||
#[argh(switch, short = 's')]
|
||||
server: bool,
|
||||
|
||||
/// randomize next track?
|
||||
#[argh(option, default = "false")]
|
||||
shuffle: bool,
|
||||
|
||||
/// change track after the current one is finished?
|
||||
#[argh(option, default = "true")]
|
||||
next: bool,
|
||||
|
||||
/// repeat the playlist (or track if 'next' is disabled) after it's finished
|
||||
#[argh(option, default = "true")]
|
||||
repeat: bool,
|
||||
|
||||
/// kill server
|
||||
#[argh(switch, short = 'x')]
|
||||
exit: bool,
|
||||
|
||||
/// don't start server even if it's not running
|
||||
#[argh(switch, short = 'c')]
|
||||
client_only: bool,
|
||||
|
||||
/// time in ms between two ticks.
|
||||
#[argh(option, default = "100")]
|
||||
tick_rate: u64,
|
||||
|
||||
/// interval in ms for clearing the request queue.
|
||||
#[argh(option, default = "100")]
|
||||
message_rate: u64,
|
||||
|
||||
/// should client automatically sync the server state? (used mainly for debugging)
|
||||
#[argh(option, default = "true")]
|
||||
sync_state: bool,
|
||||
|
||||
/// whether unicode symbols are used to improve the overall look of the app
|
||||
#[argh(option, default = "true")]
|
||||
enhanced_graphics: bool,
|
||||
|
||||
/// server-side log level (quiet, error, all)
|
||||
#[argh(option)]
|
||||
log_level: Option<String>,
|
||||
}
|
||||
|
||||
fn main() {
|
||||
|
|
|
|||
23
src/ui.rs
23
src/ui.rs
|
|
@ -19,29 +19,6 @@ static SECONDARY_COLOR: Color = Color::Rgb(200, 200, 200);
|
|||
static PRIMARY_CONTRAST: Color = Color::Black;
|
||||
static CLEAR_CONTRAST: Color = Color::Rgb(100, 100, 100);
|
||||
|
||||
fn draw_no_connection<B: Backend>(f: &mut Frame<B>) {
|
||||
let message = "Not connected";
|
||||
let width = message.len() as u16 + 4;
|
||||
let height = 3;
|
||||
|
||||
let x = (f.size().width as i16 - width as i16).max(0) as u16 / 2;
|
||||
let y = (f.size().height as i16 - height as i16).max(0) as u16 / 2;
|
||||
|
||||
let area = Rect {
|
||||
x,
|
||||
y,
|
||||
width: u16::min(width, f.size().width - x),
|
||||
height: u16::min(height, f.size().height - y),
|
||||
};
|
||||
f.render_widget(
|
||||
Paragraph::new(message)
|
||||
.fg(SECONDARY_COLOR)
|
||||
.block(Block::default().borders(Borders::ALL).fg(PRIMARY_COLOR))
|
||||
.alignment(Alignment::Center),
|
||||
area,
|
||||
);
|
||||
}
|
||||
|
||||
fn draw_playlist<B: Backend>(f: &mut Frame<B>, _app: &App, area: Rect) {
|
||||
let playlist = List::new(vec![])
|
||||
.block(
|
||||
|
|
|
|||
Loading…
Reference in New Issue