use environment variable for MPD_PORT and MPD_HOST
This commit is contained in:
parent
59eed99c85
commit
255687be7c
|
|
@ -177,14 +177,10 @@ pub fn handle_key_events(key_event: KeyEvent, app: &mut App) -> AppResult<()> {
|
|||
|
||||
// Playback controls
|
||||
// Toggle Pause
|
||||
KeyCode::Char('p') => {
|
||||
app.conn.toggle_pause();
|
||||
}
|
||||
KeyCode::Char('p') => app.conn.toggle_pause(),
|
||||
|
||||
// Pause
|
||||
KeyCode::Char('s') => {
|
||||
app.conn.pause();
|
||||
}
|
||||
KeyCode::Char('s') => app.conn.pause(),
|
||||
|
||||
// Toggle rpeat
|
||||
KeyCode::Char('r') => {
|
||||
|
|
@ -199,41 +195,10 @@ pub fn handle_key_events(key_event: KeyEvent, app: &mut App) -> AppResult<()> {
|
|||
}
|
||||
|
||||
// Dmenu prompt
|
||||
KeyCode::Char('D') => {
|
||||
app.conn.play_dmenu()?;
|
||||
}
|
||||
KeyCode::Char('D') => app.conn.play_dmenu()?,
|
||||
|
||||
// add to queue
|
||||
KeyCode::Char('a') => {
|
||||
// let list = app
|
||||
// .conn
|
||||
// .songs_filenames
|
||||
// .iter()
|
||||
// .map(|f| f.as_str())
|
||||
// .collect::<Vec<&str>>();
|
||||
//
|
||||
// let files: Vec<String> = app
|
||||
// .browser
|
||||
// .filetree
|
||||
// .clone()
|
||||
// .into_iter()
|
||||
// .map(|(_, f)| f)
|
||||
// .collect();
|
||||
//
|
||||
// let (filename, _) = rust_fuzzy_search::fuzzy_search_sorted(
|
||||
// &files.get(app.browser.selected).unwrap(),
|
||||
// &list,
|
||||
// )
|
||||
// .get(0)
|
||||
// .unwrap()
|
||||
// .clone();
|
||||
//
|
||||
// let song = app.conn.get_song_with_only_filename(filename);
|
||||
//
|
||||
// app.conn.conn.push(&song)?;
|
||||
|
||||
app.playlist_popup = true;
|
||||
}
|
||||
KeyCode::Char('a') => app.playlist_popup = true,
|
||||
|
||||
KeyCode::Right => {
|
||||
app.conn
|
||||
|
|
|
|||
|
|
@ -11,6 +11,7 @@ use rmptui::event::EventHandler;
|
|||
use rmptui::handler;
|
||||
use rmptui::song::RSong;
|
||||
use rmptui::tui;
|
||||
use std::env;
|
||||
use std::io;
|
||||
|
||||
use crossterm::event::{self, KeyCode, KeyEvent, KeyEventKind};
|
||||
|
|
@ -25,7 +26,9 @@ pub type Error = Box<dyn std::error::Error>;
|
|||
|
||||
fn main() -> AppResult<()> {
|
||||
let args = Args::parse();
|
||||
let mut app = App::builder("127.0.0.1:6600")?;
|
||||
let env_host = env::var("MPD_HOST").unwrap_or_else(|_| "127.0.0.1".to_string());
|
||||
let env_port = env::var("MPD_PORT").unwrap_or_else(|_| "6600".to_string());
|
||||
let mut app = App::builder(format!("{}:{}", env_host, env_port).as_str())?;
|
||||
|
||||
if !args.tui {
|
||||
handle_tui(&mut app)?;
|
||||
|
|
|
|||
Reference in New Issue