@@ -74,6 +74,7 @@ have them configurable.
|
|||||||
* `F3`: Library
|
* `F3`: Library
|
||||||
* `d` deletes the currently selected playlist
|
* `d` deletes the currently selected playlist
|
||||||
* Tracks and playlists can be played using `Return` and queued using `Space`
|
* Tracks and playlists can be played using `Return` and queued using `Space`
|
||||||
|
* `.` will move to the currently playing track in the queue.
|
||||||
* `s` will save, `d` will remove the currently selected track to/from your
|
* `s` will save, `d` will remove the currently selected track to/from your
|
||||||
library
|
library
|
||||||
* `o` will open a detail view or context menu for the selected item
|
* `o` will open a detail view or context menu for the selected item
|
||||||
|
|||||||
@@ -26,6 +26,7 @@ pub enum MoveMode {
|
|||||||
Down,
|
Down,
|
||||||
Left,
|
Left,
|
||||||
Right,
|
Right,
|
||||||
|
Playing,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Display, Clone, Serialize, Deserialize, Debug)]
|
#[derive(Display, Clone, Serialize, Deserialize, Debug)]
|
||||||
@@ -144,8 +145,10 @@ impl fmt::Display for Command {
|
|||||||
MoveMode::Down => "bottom",
|
MoveMode::Down => "bottom",
|
||||||
MoveMode::Left => "leftmost",
|
MoveMode::Left => "leftmost",
|
||||||
MoveMode::Right => "rightmost",
|
MoveMode::Right => "rightmost",
|
||||||
|
_ => "",
|
||||||
}
|
}
|
||||||
),
|
),
|
||||||
|
Command::Move(MoveMode::Playing, _) => "move playing".to_string(),
|
||||||
Command::Move(mode, MoveAmount::Integer(amount)) => format!("move {} {}", mode, amount),
|
Command::Move(mode, MoveAmount::Integer(amount)) => format!("move {} {}", mode, amount),
|
||||||
Command::Shift(mode, amount) => format!("shift {} {}", mode, amount.unwrap_or(1)),
|
Command::Shift(mode, amount) => format!("shift {} {}", mode, amount.unwrap_or(1)),
|
||||||
Command::Search(term) => format!("search {}", term),
|
Command::Search(term) => format!("search {}", term),
|
||||||
@@ -235,6 +238,7 @@ pub fn parse(input: &str) -> Option<Command> {
|
|||||||
"bottom" => Some(Command::Move(MoveMode::Down, MoveAmount::Extreme)),
|
"bottom" => Some(Command::Move(MoveMode::Down, MoveAmount::Extreme)),
|
||||||
"leftmost" => Some(Command::Move(MoveMode::Left, MoveAmount::Extreme)),
|
"leftmost" => Some(Command::Move(MoveMode::Left, MoveAmount::Extreme)),
|
||||||
"rightmost" => Some(Command::Move(MoveMode::Right, MoveAmount::Extreme)),
|
"rightmost" => Some(Command::Move(MoveMode::Right, MoveAmount::Extreme)),
|
||||||
|
"playing" => Some(Command::Move(MoveMode::Playing, MoveAmount::default())),
|
||||||
_ => None,
|
_ => None,
|
||||||
})
|
})
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -265,6 +265,10 @@ impl CommandManager {
|
|||||||
kb.insert("A".into(), Command::Goto(GotoMode::Artist));
|
kb.insert("A".into(), Command::Goto(GotoMode::Artist));
|
||||||
|
|
||||||
kb.insert("Up".into(), Command::Move(MoveMode::Up, Default::default()));
|
kb.insert("Up".into(), Command::Move(MoveMode::Up, Default::default()));
|
||||||
|
kb.insert(
|
||||||
|
".".into(),
|
||||||
|
Command::Move(MoveMode::Playing, Default::default()),
|
||||||
|
);
|
||||||
kb.insert(
|
kb.insert(
|
||||||
"Down".into(),
|
"Down".into(),
|
||||||
Command::Move(MoveMode::Down, Default::default()),
|
Command::Move(MoveMode::Down, Default::default()),
|
||||||
|
|||||||
@@ -83,12 +83,16 @@ impl Queue {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub fn get_current(&self) -> Option<Track> {
|
pub fn get_current(&self) -> Option<Track> {
|
||||||
match *self.current_track.read().unwrap() {
|
match self.get_current_index() {
|
||||||
Some(index) => Some(self.queue.read().unwrap()[index].clone()),
|
Some(index) => Some(self.queue.read().unwrap()[index].clone()),
|
||||||
None => None,
|
None => None,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn get_current_index(&self) -> Option<usize> {
|
||||||
|
*self.current_track.read().unwrap()
|
||||||
|
}
|
||||||
|
|
||||||
pub fn append(&self, track: &Track) {
|
pub fn append(&self, track: &Track) {
|
||||||
let mut random_order = self.random_order.write().unwrap();
|
let mut random_order = self.random_order.write().unwrap();
|
||||||
if let Some(order) = random_order.as_mut() {
|
if let Some(order) = random_order.as_mut() {
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ use cursive::Cursive;
|
|||||||
use std::cmp::min;
|
use std::cmp::min;
|
||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
|
|
||||||
use crate::command::{Command, ShiftMode};
|
use crate::command::{Command, MoveMode, ShiftMode};
|
||||||
use crate::commands::CommandResult;
|
use crate::commands::CommandResult;
|
||||||
use crate::library::Library;
|
use crate::library::Library;
|
||||||
use crate::queue::Queue;
|
use crate::queue::Queue;
|
||||||
@@ -132,6 +132,11 @@ impl ViewExt for QueueView {
|
|||||||
s.add_layer(dialog);
|
s.add_layer(dialog);
|
||||||
return Ok(CommandResult::Consumed(None));
|
return Ok(CommandResult::Consumed(None));
|
||||||
}
|
}
|
||||||
|
Command::Move(MoveMode::Playing, _) => {
|
||||||
|
if let Some(playing) = self.queue.get_current_index() {
|
||||||
|
self.list.move_focus_to(playing);
|
||||||
|
}
|
||||||
|
}
|
||||||
_ => {}
|
_ => {}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user