master 0.1
Ondřej Hruška 6 years ago
parent 170b6ebc7b
commit d9df5c0d17
Signed by: MightyPork
GPG Key ID: 2C5FD5035250423D
  1. 15
      src/main.rs

@ -169,26 +169,17 @@ fn main() -> Result<(), Error> {
break 'event_loop; break 'event_loop;
} }
Event::TrackChanged(mut metadata) => { Event::TrackChanged(mut metadata) => {
// we can't use the event metadata - it's incomplete
::std::thread::sleep(Duration::from_millis(250)); ::std::thread::sleep(Duration::from_millis(250));
metadata = player.get_metadata().unwrap_or(metadata); metadata = player.get_metadata().unwrap_or(metadata);
let mut title = metadata.title().unwrap_or(""); let title = metadata.title().unwrap_or("");
info!("--- new track : {} ---", title); info!("--- new track : {} ---", title);
if title.is_empty() { if title.is_empty() {
warn!("!!! Spotify is giving us garbage - empty metadata struct !!!"); warn!("Empty metadata! Wait for next track...");
::std::thread::sleep(Duration::from_millis(250));
metadata = player.get_metadata().unwrap_or(metadata);
title = metadata.title().unwrap_or("");
info!("After metadata reload -> new track : {}", title);
if title.is_empty() {
// wait for next event
warn!("Still bad");
continue 'event_loop; continue 'event_loop;
} }
}
let mut skip = !config.allow_by_default; let mut skip = !config.allow_by_default;
let mut confidence = false; let mut confidence = false;

Loading…
Cancel
Save