Compare commits
10 commits
Author | SHA1 | Date | |
---|---|---|---|
Stephen Seo | d90c86c894 | ||
Stephen Seo | f42fadd403 | ||
Stephen Seo | f2f58047a5 | ||
Stephen Seo | d457098f2a | ||
Stephen Seo | d0beff5a98 | ||
Stephen Seo | 7a860e323a | ||
Stephen Seo | ef234f0ec0 | ||
Stephen Seo | 391949cde6 | ||
Stephen Seo | f66880f13d | ||
Stephen Seo | 83bb20c246 |
1621
Cargo.lock
generated
1621
Cargo.lock
generated
File diff suppressed because it is too large
Load diff
12
Cargo.toml
12
Cargo.toml
|
@ -1,6 +1,6 @@
|
|||
[package]
|
||||
name = "mpd_info_screen"
|
||||
version = "0.4.6"
|
||||
version = "0.4.9"
|
||||
edition = "2021"
|
||||
description = "Displays info on currently playing music from an MPD daemon"
|
||||
license = "MIT"
|
||||
|
@ -10,16 +10,14 @@ resolver = "2"
|
|||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||
|
||||
[dependencies]
|
||||
structopt = "0.3"
|
||||
clap = { version = "4.4", features = ["derive"] }
|
||||
image = "0.24"
|
||||
#ggez = "0.8.1"
|
||||
# Workaround for album art not drawing bug in ggez, use commit from "devel" branch:
|
||||
ggez = "0.9.0"
|
||||
ggez = "0.9.3"
|
||||
freetype = { version = "0.7", optional = true }
|
||||
wgpu = "0.16.1"
|
||||
wgpu = "0.16"
|
||||
|
||||
[build-dependencies]
|
||||
bindgen = { version = "0.53", optional = true }
|
||||
bindgen = { version = "0.69", optional = true }
|
||||
|
||||
[features]
|
||||
unicode_support = ["dep:freetype", "dep:bindgen"]
|
||||
|
|
53
README.md
53
README.md
|
@ -35,28 +35,39 @@ or through crates.io:
|
|||
# Usage
|
||||
|
||||
|
||||
USAGE:
|
||||
mpd_info_screen [FLAGS] [OPTIONS] <host> [port]
|
||||
Displays info on currently playing music from an MPD daemon
|
||||
|
||||
FLAGS:
|
||||
--disable-show-album disable album display
|
||||
--disable-show-artist disable artist display
|
||||
--disable-show-filename disable filename display
|
||||
--disable-show-title disable title display
|
||||
--no-scale-fill don't scale-fill the album art to the window
|
||||
--pprompt input password via prompt
|
||||
-h, --help Prints help information
|
||||
-V, --version Prints version information
|
||||
Usage: mpd_info_screen [OPTIONS] <HOST> [PORT]
|
||||
|
||||
OPTIONS:
|
||||
-l, --log-level <log-level> [default: Error] [possible values: Error, Warning, Debug, Verbose]
|
||||
-p <password>
|
||||
--pfile <password-file> read password from file
|
||||
-t, --text-bg-opacity <text-bg-opacity> sets the opacity of the text background (0-255) [default: 190]
|
||||
Arguments:
|
||||
<HOST>
|
||||
[PORT] [default: 6600]
|
||||
|
||||
ARGS:
|
||||
<host>
|
||||
<port> [default: 6600]
|
||||
Options:
|
||||
-p <PASSWORD>
|
||||
|
||||
--disable-show-title
|
||||
disable title display
|
||||
--disable-show-artist
|
||||
disable artist display
|
||||
--disable-show-album
|
||||
disable album display
|
||||
--disable-show-filename
|
||||
disable filename display
|
||||
--pprompt
|
||||
input password via prompt
|
||||
--pfile <PASSWORD_FILE>
|
||||
read password from file
|
||||
--no-scale-fill
|
||||
don't scale-fill the album art to the window
|
||||
-l, --log-level <LOG_LEVEL>
|
||||
[default: error] [possible values: error, warning, debug, verbose]
|
||||
-t, --text-bg-opacity <TEXT_BG_OPACITY>
|
||||
sets the opacity of the text background (0-255) [default: 190]
|
||||
-h, --help
|
||||
Print help
|
||||
-V, --version
|
||||
Print version
|
||||
|
||||
|
||||
Note that presing the Escape key when the window is focused closes the program.
|
||||
|
@ -85,8 +96,8 @@ MIT license.
|
|||
Uses dependency [image](https://crates.io/crates/image) which is licensed under
|
||||
MIT license.
|
||||
|
||||
Uses dependency [structopt](https://crates.io/crates/structopt) which is
|
||||
licensed under Apache-2.0 or MIT licenses.
|
||||
Uses dependency [clap](https://crates.io/crates/clap) which is licensed under
|
||||
Apache-2.0 or MIT licenses.
|
||||
|
||||
## Unicode Support Dependencies
|
||||
|
||||
|
|
2
build.rs
2
build.rs
|
@ -14,7 +14,7 @@ fn main() {
|
|||
|
||||
let bindings = bindgen::Builder::default()
|
||||
.header("src/bindgen_wrapper.h")
|
||||
.parse_callbacks(Box::new(bindgen::CargoCallbacks))
|
||||
.parse_callbacks(Box::new(bindgen::CargoCallbacks::new()))
|
||||
.generate()
|
||||
.expect("Unable to generate bindings");
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
use std::fmt::Display;
|
||||
use structopt::clap::arg_enum;
|
||||
use clap::ValueEnum;
|
||||
|
||||
#[derive(Copy, Clone, Debug, PartialEq, Eq)]
|
||||
pub enum LogState {
|
||||
|
@ -9,14 +9,12 @@ pub enum LogState {
|
|||
Verbose,
|
||||
}
|
||||
|
||||
arg_enum! {
|
||||
#[derive(Copy, Clone, Debug, PartialEq, Eq)]
|
||||
pub enum LogLevel {
|
||||
Error,
|
||||
Warning,
|
||||
Debug,
|
||||
Verbose,
|
||||
}
|
||||
#[derive(ValueEnum, Copy, Clone, Debug, PartialEq, Eq)]
|
||||
pub enum LogLevel {
|
||||
Error,
|
||||
Warning,
|
||||
Debug,
|
||||
Verbose,
|
||||
}
|
||||
|
||||
pub fn log<T>(msg: T, state: LogState, level: LogLevel)
|
||||
|
|
36
src/main.rs
36
src/main.rs
|
@ -15,44 +15,42 @@ use std::net::Ipv4Addr;
|
|||
use std::path::PathBuf;
|
||||
use std::thread;
|
||||
use std::time::{Duration, Instant};
|
||||
use structopt::StructOpt;
|
||||
use clap::Parser;
|
||||
|
||||
use debug_log::log;
|
||||
|
||||
#[derive(StructOpt, Debug, Clone)]
|
||||
#[structopt(name = "mpd_info_screen")]
|
||||
#[derive(Parser, Debug, Clone)]
|
||||
#[command(author, version, about, long_about = None)]
|
||||
pub struct Opt {
|
||||
host: Ipv4Addr,
|
||||
#[structopt(default_value = "6600")]
|
||||
#[arg(default_value = "6600")]
|
||||
port: u16,
|
||||
#[structopt(short = "p")]
|
||||
#[arg(short = 'p')]
|
||||
password: Option<String>,
|
||||
#[structopt(long = "disable-show-title", help = "disable title display")]
|
||||
#[arg(long = "disable-show-title", help = "disable title display")]
|
||||
disable_show_title: bool,
|
||||
#[structopt(long = "disable-show-artist", help = "disable artist display")]
|
||||
#[arg(long = "disable-show-artist", help = "disable artist display")]
|
||||
disable_show_artist: bool,
|
||||
#[structopt(long = "disable-show-album", help = "disable album display")]
|
||||
#[arg(long = "disable-show-album", help = "disable album display")]
|
||||
disable_show_album: bool,
|
||||
#[structopt(long = "disable-show-filename", help = "disable filename display")]
|
||||
#[arg(long = "disable-show-filename", help = "disable filename display")]
|
||||
disable_show_filename: bool,
|
||||
#[structopt(long = "pprompt", help = "input password via prompt")]
|
||||
#[arg(long = "pprompt", help = "input password via prompt")]
|
||||
enable_prompt_password: bool,
|
||||
#[structopt(long = "pfile", help = "read password from file")]
|
||||
#[arg(long = "pfile", help = "read password from file")]
|
||||
password_file: Option<PathBuf>,
|
||||
#[structopt(
|
||||
#[arg(
|
||||
long = "no-scale-fill",
|
||||
help = "don't scale-fill the album art to the window"
|
||||
)]
|
||||
do_not_fill_scale_album_art: bool,
|
||||
#[structopt(
|
||||
short = "l",
|
||||
#[arg(
|
||||
short = 'l',
|
||||
long = "log-level",
|
||||
possible_values = &debug_log::LogLevel::variants(),
|
||||
default_value = "Error",
|
||||
case_insensitive = true,
|
||||
default_value = "error",
|
||||
)]
|
||||
log_level: debug_log::LogLevel,
|
||||
#[structopt(
|
||||
#[arg(
|
||||
short,
|
||||
long,
|
||||
help = "sets the opacity of the text background (0-255)",
|
||||
|
@ -62,7 +60,7 @@ pub struct Opt {
|
|||
}
|
||||
|
||||
fn main() -> Result<(), String> {
|
||||
let mut opt = Opt::from_args();
|
||||
let mut opt = Opt::parse();
|
||||
println!("Got host addr == {}, port == {}", opt.host, opt.port);
|
||||
|
||||
// Read password from file if exists, error otherwise.
|
||||
|
|
Loading…
Reference in a new issue