diff --git a/Userland/Applications/SoundPlayer/Player.h b/Userland/Applications/SoundPlayer/Player.h index c6876459e7e..f0b27655337 100644 --- a/Userland/Applications/SoundPlayer/Player.h +++ b/Userland/Applications/SoundPlayer/Player.h @@ -39,6 +39,7 @@ public: bool is_playlist(DeprecatedString const& path); Playlist& playlist() { return m_playlist; } + PlaybackManager const& playback_manager() const { return m_playback_manager; } DeprecatedString const& loaded_filename() const { return m_loaded_filename; } PlayState play_state() const { return m_play_state; } diff --git a/Userland/Applications/SoundPlayer/SoundPlayerWidgetAdvancedView.cpp b/Userland/Applications/SoundPlayer/SoundPlayerWidgetAdvancedView.cpp index c3fe2f1f19d..9fe0fc8aaef 100644 --- a/Userland/Applications/SoundPlayer/SoundPlayerWidgetAdvancedView.cpp +++ b/Userland/Applications/SoundPlayer/SoundPlayerWidgetAdvancedView.cpp @@ -9,6 +9,7 @@ #include "BarsVisualizationWidget.h" #include "M3UParser.h" #include "PlaybackManager.h" +#include #include #include #include @@ -215,7 +216,17 @@ void SoundPlayerWidgetAdvancedView::time_elapsed(int seconds) void SoundPlayerWidgetAdvancedView::file_name_changed(StringView name) { m_visualization->start_new_file(name); - m_window.set_title(DeprecatedString::formatted("{} - Sound Player", name)); + DeprecatedString title = name; + if (playback_manager().loader()) { + auto const& metadata = playback_manager().loader()->metadata(); + if (auto artists_or_error = metadata.all_artists(" / "_short_string); + !artists_or_error.is_error() && artists_or_error.value().has_value() && metadata.title.has_value()) { + title = DeprecatedString::formatted("{} – {}", metadata.title.value(), artists_or_error.release_value().release_value()); + } else if (metadata.title.has_value()) { + title = metadata.title.value().to_deprecated_string(); + } + } + m_window.set_title(DeprecatedString::formatted("{} — Sound Player", title)); } void SoundPlayerWidgetAdvancedView::total_samples_changed(int total_samples)