Merge branch 'iss-1546' of https://github.com/sp1ff/MPD
This commit is contained in:
commit
d7de8b1453
@ -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<DetachedSong> 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;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user