diff --git a/src/playlist/PlaylistQueue.cxx b/src/playlist/PlaylistQueue.cxx index 8500b2b07..89ce1fd1c 100644 --- a/src/playlist/PlaylistQueue.cxx +++ b/src/playlist/PlaylistQueue.cxx @@ -28,6 +28,7 @@ #include "song/DetachedSong.hxx" #include "thread/Mutex.hxx" #include "fs/Traits.hxx" +#include "Log.hxx" #ifdef ENABLE_DATABASE #include "SongLoader.hxx" @@ -41,12 +42,14 @@ playlist_load_into_queue(const char *uri, SongEnumerator &e, playlist &dest, PlayerControl &pc, const SongLoader &loader) { + const unsigned max_log_msgs = 8; + const auto base_uri = uri != nullptr ? PathTraitsUTF8::GetParent(uri) : "."; std::unique_ptr song; - for (unsigned i = 0; + for (unsigned i = 0, failures = 0; i < end_index && (song = e.NextSong()) != nullptr; ++i) { if (i < start_index) { @@ -56,6 +59,12 @@ playlist_load_into_queue(const char *uri, SongEnumerator &e, if (!playlist_check_translate_song(*song, base_uri, loader)) { + failures += 1; + if (failures < max_log_msgs) { + FmtError(playlist_domain, "Failed to load \"{}\".", song->GetURI()); + } else if (failures == max_log_msgs) { + LogError(playlist_domain, "Further errors for this playlist will not be logged."); + } continue; }