Skip to content

Commit f48a941

Browse files
committed
chore: update
1 parent 4514f53 commit f48a941

2 files changed

Lines changed: 13 additions & 21 deletions

File tree

src/get_media.rs

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,19 +11,13 @@ use dbus::blocking::Connection;
1111
use dbus::blocking::Proxy;
1212

1313
#[derive(Clone, PartialEq)]
14+
#[derive(Default)]
1415
pub struct MediaMetadata {
1516
pub title: Option<String>,
1617
pub artist: Option<String>,
1718
}
1819

19-
impl Default for MediaMetadata {
20-
fn default() -> Self {
21-
MediaMetadata {
22-
title: None,
23-
artist: None,
24-
}
25-
}
26-
}
20+
2721
mod constants {
2822
pub const MEDIA_PLAYER_IDENTIFIERS: [&str; 2] = [
2923
"org.mpris.MediaPlayer2.yesplaymusic",

src/main.rs

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -75,19 +75,17 @@ async fn run_loop(config: Config) {
7575
previous_process_name = process_name;
7676
previous_media_metadata = media_metadata;
7777
last_time = utc_now;
78-
} else {
79-
if config.log_enable {
80-
let next_watch_time = utc_now
81-
.checked_add_signed(chrono::Duration::seconds(config.watch_time))
82-
.unwrap()
83-
.format("%Y-%m-%d %H:%M:%S");
84-
let utc_now = utc_now.format("%Y-%m-%d %H:%M:%S");
85-
println!("--------------------------------------------------");
86-
println!("This Watch Time : {}", utc_now);
87-
println!("No change in process or media metadata");
88-
println!("Next Watch Time : {}", next_watch_time);
89-
println!("--------------------------------------------------");
90-
}
78+
} else if config.log_enable {
79+
let next_watch_time = utc_now
80+
.checked_add_signed(chrono::Duration::seconds(config.watch_time))
81+
.unwrap()
82+
.format("%Y-%m-%d %H:%M:%S");
83+
let utc_now = utc_now.format("%Y-%m-%d %H:%M:%S");
84+
println!("--------------------------------------------------");
85+
println!("This Watch Time : {}", utc_now);
86+
println!("No change in process or media metadata");
87+
println!("Next Watch Time : {}", next_watch_time);
88+
println!("--------------------------------------------------");
9189
}
9290
let sleep_interval_secs = config.watch_time.to_string().parse::<u64>().unwrap_or(5);
9391
sleep(Duration::from_secs(sleep_interval_secs)).await;

0 commit comments

Comments
 (0)