|
|
@ -169,25 +169,16 @@ 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..."); |
|
|
|
|
|
|
|
continue 'event_loop; |
|
|
|
::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; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
let mut skip = !config.allow_by_default; |
|
|
|
let mut skip = !config.allow_by_default; |
|
|
|