Skip to content

Commit

Permalink
Fix album art backgrounds disappearing when playing the same track twice
Browse files Browse the repository at this point in the history
Fixes #318
  • Loading branch information
jacquesh committed Jul 28, 2024
1 parent 2469e42 commit 063f885
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 12 deletions.
1 change: 1 addition & 0 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ void OpenLyricsVersion::get_about_message(pfc::string_base & out)
"- Fix the lyric editor sometimes responding badly to Ctrl-A/Ctrl-Backspace\n"
"- Fix possibly using the wrong background colour when changing FB2K colours\n"
"- Fix Metal Archives possibly returning 'lyrics not available'\n"
"- Fix album art backgrounds disappearing when playing the same track twice\n"
"- Many, many minor non-functional internal code improvements\n"
"\n";
out += "Version 1.9 (2024-06-12):\n"
Expand Down
24 changes: 12 additions & 12 deletions src/ui_lyrics_panel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ void LyricPanel::on_playback_new_track(metadb_handle_ptr track)
m_now_playing = track;
m_now_playing_info = get_full_metadata(track);
m_manual_scroll_distance = 0;
m_search_pending = !track_is_remote(track); // If this is an internet radio then don't search until we get dynamic track info
m_search_pending = track_changed && !track_is_remote(track); // If this is an internet radio then don't search until we get dynamic track info
m_now_playing_time_offset = 0.0;

// NOTE: If playback is paused on startup then this gets called with the paused track,
Expand All @@ -224,17 +224,10 @@ void LyricPanel::on_playback_new_track(metadb_handle_ptr track)
StartTimer();
}

m_albumart_original = {};
if(preferences::background::image_type() == BackgroundImageType::AlbumArt)
if(track_changed && (preferences::background::image_type() == BackgroundImageType::AlbumArt))
{
if(track_changed)
{
m_background_img = {};
}
}
else
{
compute_background_image();
m_background_img = {};
m_albumart_original = {};
}
}

Expand All @@ -259,8 +252,15 @@ void LyricPanel::on_playback_dynamic_info_track(const file_info& info)
m_now_playing_time_offset = playback->playback_get_position();
}

void LyricPanel::on_playback_stop(play_control::t_stop_reason /*reason*/)
void LyricPanel::on_playback_stop(play_control::t_stop_reason reason)
{
// When starting another track, track-change calculations will all be
// handled when the new track starts (immediately after this callback).
if(reason == play_control::t_stop_reason::stop_reason_starting_another)
{
return;
}

m_now_playing = nullptr;
m_now_playing_info = {};
m_lyrics = {};
Expand Down

0 comments on commit 063f885

Please sign in to comment.