From 14fb4ca2020ba36231cc20f6eaedace36fb0a2aa Mon Sep 17 00:00:00 2001 From: David Sansome Date: Sat, 16 Oct 2010 12:37:33 +0000 Subject: [PATCH] Ignore playlists when loading local directories. Fixes issue #886 --- src/core/songloader.cpp | 10 ++++++++-- src/core/songloader.h | 2 +- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/src/core/songloader.cpp b/src/core/songloader.cpp index 8d5de7e1d..e66c0808c 100644 --- a/src/core/songloader.cpp +++ b/src/core/songloader.cpp @@ -90,7 +90,8 @@ SongLoader::Result SongLoader::Load(const QUrl& url) { #endif } -SongLoader::Result SongLoader::LoadLocal(const QString& filename, bool block) { +SongLoader::Result SongLoader::LoadLocal(const QString& filename, bool block, + bool ignore_playlists) { qDebug() << "Loading local file" << filename; // First check to see if it's a directory - if so we can load all the songs @@ -120,6 +121,11 @@ SongLoader::Result SongLoader::LoadLocal(const QString& filename, bool block) { } if (parser) { + if (ignore_playlists) { + qDebug() << "Skipping" << parser->name() << "playlist while loading directory"; + return Success; + } + qDebug() << "Parsing using" << parser->name(); // It's a playlist! @@ -182,7 +188,7 @@ void SongLoader::LoadLocalDirectory(const QString& filename) { while (it.hasNext()) { // This is in another thread so we can do blocking calls. - LoadLocal(it.next(), true); + LoadLocal(it.next(), true, true); } qStableSort(songs_.begin(), songs_.end(), CompareSongs); diff --git a/src/core/songloader.h b/src/core/songloader.h index b881f7cc8..fcad6e526 100644 --- a/src/core/songloader.h +++ b/src/core/songloader.h @@ -70,7 +70,7 @@ private: Finished, }; - Result LoadLocal(const QString& filename, bool block = false); + Result LoadLocal(const QString& filename, bool block = false, bool ignore_playlists = false); void LoadLocalDirectory(const QString& filename); void LoadPlaylist(ParserBase* parser, const QString& filename); void LoadLocalDirectoryAndEmit(const QString& filename);