fresh fixes

master
Ondřej Hruška 6 years ago
parent 46c01c6c38
commit ef78943940
Signed by: MightyPork
GPG Key ID: 2C5FD5035250423D
  1. 16
      src/main.rs

@ -161,21 +161,29 @@ fn main() -> Result<(), Error> {
match event { match event {
Ok(event) => { Ok(event) => {
debug!("MPRIS event: {:#?}", event); debug!("MPRIS event: {:#?}", event);
match &event { match event {
Event::PlayerShutDown => { Event::PlayerShutDown => {
info!("Player shut down"); info!("Player shut down");
break 'event_loop; break 'event_loop;
} }
Event::TrackChanged(metadata) => { Event::TrackChanged(mut metadata) => {
let title = metadata.title().unwrap_or(""); let mut title = metadata.title().unwrap_or("");
info!("--- new track : {} ---", title); info!("--- new track : {} ---", title);
debug!("{:#?}", event);
if title.is_empty() { if title.is_empty() {
warn!("!!! Spotify is giving us garbage - empty metadata struct !!!"); warn!("!!! Spotify is giving us garbage - empty metadata struct !!!");
::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 // wait for next event
warn!("Still bad");
continue 'event_loop; continue 'event_loop;
} }
}
let mut artists = HashSet::new(); let mut artists = HashSet::new();

Loading…
Cancel
Save