Make clippy happy
This commit is contained in:
parent
caa7d4c5a7
commit
87f401f5cf
5 changed files with 12 additions and 10 deletions
|
@ -265,7 +265,7 @@ impl MpvEventHandler for DiscordClient {
|
||||||
MpvEvent::FileLoaded(file_info) => self.set_presence(file_info),
|
MpvEvent::FileLoaded(file_info) => self.set_presence(file_info),
|
||||||
MpvEvent::Seek(remaining_time) => self.set_timestamps(remaining_time),
|
MpvEvent::Seek(remaining_time) => self.set_timestamps(remaining_time),
|
||||||
MpvEvent::Play(remaining_time) => self.set_timestamps(remaining_time),
|
MpvEvent::Play(remaining_time) => self.set_timestamps(remaining_time),
|
||||||
MpvEvent::Pause(_) => self.clear_timestamps(),
|
MpvEvent::Pause => self.clear_timestamps(),
|
||||||
MpvEvent::Buffering => self.clear_timestamps(),
|
MpvEvent::Buffering => self.clear_timestamps(),
|
||||||
MpvEvent::Toggle => self.toggle_activity(),
|
MpvEvent::Toggle => self.toggle_activity(),
|
||||||
MpvEvent::Exit => self.close(),
|
MpvEvent::Exit => self.close(),
|
||||||
|
|
|
@ -47,7 +47,7 @@ fn get_cover_art_from_query(query: String) -> Option<String> {
|
||||||
Err(_) => return None
|
Err(_) => return None
|
||||||
};
|
};
|
||||||
|
|
||||||
let release = match result.entities.get(0) {
|
let release = match result.entities.first() {
|
||||||
Some(group) => group,
|
Some(group) => group,
|
||||||
None => return None
|
None => return None
|
||||||
};
|
};
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
use std::env;
|
use std::env;
|
||||||
|
|
||||||
pub mod macros;
|
pub mod macros;
|
||||||
|
|
||||||
|
#[allow(unused_imports)]
|
||||||
pub use macros::{error, warning, info};
|
pub use macros::{error, warning, info};
|
||||||
|
|
||||||
#[allow(dead_code)]
|
#[allow(dead_code)]
|
||||||
|
@ -40,7 +42,7 @@ impl Logger {
|
||||||
pub fn from_env() -> Self {
|
pub fn from_env() -> Self {
|
||||||
let level = env::var("MPV_RPC_LOG").unwrap_or_default();
|
let level = env::var("MPV_RPC_LOG").unwrap_or_default();
|
||||||
let level: u32 = level.parse().unwrap_or(LogLevel::Error as u32);
|
let level: u32 = level.parse().unwrap_or(LogLevel::Error as u32);
|
||||||
|
|
||||||
let log_level = LogLevel::from(level);
|
let log_level = LogLevel::from(level);
|
||||||
Self {
|
Self {
|
||||||
log_level
|
log_level
|
||||||
|
|
|
@ -15,13 +15,13 @@ pub struct MpvEventQueue {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl MpvEventQueue {
|
impl MpvEventQueue {
|
||||||
pub fn new(mpv: Handle,logger: Rc<Logger>) -> Result<Self, &'static str> {
|
pub fn new(mpv: Handle,logger: Rc<Logger>) -> Result<Self, &'static str> {
|
||||||
let new_self = Self {
|
let new_self = Self {
|
||||||
mpv,
|
mpv,
|
||||||
logger,
|
logger,
|
||||||
};
|
};
|
||||||
|
|
||||||
new_self.initialize()?;
|
new_self.initialize()?;
|
||||||
Ok(new_self)
|
Ok(new_self)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -50,7 +50,7 @@ impl MpvEventQueue {
|
||||||
MpvRequest::OSDMessage(message) => self.display_osd_message(message)
|
MpvRequest::OSDMessage(message) => self.display_osd_message(message)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn display_osd_message(&self, message: &str) -> Result<(), &'static str> {
|
pub fn display_osd_message(&self, message: &str) -> Result<(), &'static str> {
|
||||||
match self.mpv.osd_message(message, Duration::from_secs(1)) {
|
match self.mpv.osd_message(message, Duration::from_secs(1)) {
|
||||||
Ok(()) => Ok(()),
|
Ok(()) => Ok(()),
|
||||||
|
@ -111,7 +111,7 @@ impl MpvEventQueue {
|
||||||
let time = self.get_remaining_time();
|
let time = self.get_remaining_time();
|
||||||
match pause {
|
match pause {
|
||||||
false => Some(MpvEvent::Play(time)),
|
false => Some(MpvEvent::Play(time)),
|
||||||
true => Some(MpvEvent::Pause(time))
|
true => Some(MpvEvent::Pause)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -133,7 +133,7 @@ impl MpvEventQueue {
|
||||||
fn get_toggle_event(&self, message: ClientMessage) -> Option<MpvEvent> {
|
fn get_toggle_event(&self, message: ClientMessage) -> Option<MpvEvent> {
|
||||||
let command = message.args().join(" ");
|
let command = message.args().join(" ");
|
||||||
logging::info!(self.logger, "Client message: {command}");
|
logging::info!(self.logger, "Client message: {command}");
|
||||||
|
|
||||||
if command.starts_with("key-binding toggle-rpc d-") {
|
if command.starts_with("key-binding toggle-rpc d-") {
|
||||||
Some(MpvEvent::Toggle)
|
Some(MpvEvent::Toggle)
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,7 +17,7 @@ pub enum MpvEvent {
|
||||||
Exit,
|
Exit,
|
||||||
FileLoaded(FileInfo),
|
FileLoaded(FileInfo),
|
||||||
Play(i64),
|
Play(i64),
|
||||||
Pause(i64),
|
Pause,
|
||||||
Seek(i64)
|
Seek(i64)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue