Merge pull request #4248 from abika/master
Fix for saving the playlist multiple times when adding files to it
This commit is contained in:
commit
d03c1aa241
|
@ -29,6 +29,7 @@
|
||||||
|
|
||||||
#include "core/application.h"
|
#include "core/application.h"
|
||||||
#include "core/database.h"
|
#include "core/database.h"
|
||||||
|
#include "core/logging.h"
|
||||||
#include "core/scopedtransaction.h"
|
#include "core/scopedtransaction.h"
|
||||||
#include "core/song.h"
|
#include "core/song.h"
|
||||||
#include "library/librarybackend.h"
|
#include "library/librarybackend.h"
|
||||||
|
@ -287,6 +288,8 @@ void PlaylistBackend::SavePlaylist(int playlist, const PlaylistItemList& items,
|
||||||
QMutexLocker l(db_->Mutex());
|
QMutexLocker l(db_->Mutex());
|
||||||
QSqlDatabase db(db_->Connect());
|
QSqlDatabase db(db_->Connect());
|
||||||
|
|
||||||
|
qLog(Debug) << "Saving playlist" << playlist;
|
||||||
|
|
||||||
QSqlQuery clear("DELETE FROM playlist_items WHERE playlist = :playlist", db);
|
QSqlQuery clear("DELETE FROM playlist_items WHERE playlist = :playlist", db);
|
||||||
QSqlQuery insert(
|
QSqlQuery insert(
|
||||||
"INSERT INTO playlist_items"
|
"INSERT INTO playlist_items"
|
||||||
|
|
|
@ -151,11 +151,13 @@ void SongLoaderInserter::PartiallyFinished() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void SongLoaderInserter::EffectiveLoad() {
|
void SongLoaderInserter::EffectiveLoad() {
|
||||||
|
SongList songs;
|
||||||
for (SongLoader* loader : pending_async_) {
|
for (SongLoader* loader : pending_async_) {
|
||||||
loader->EffectiveSongsLoad();
|
loader->EffectiveSongsLoad();
|
||||||
task_manager_->SetTaskProgress(async_load_id_, ++async_progress_);
|
task_manager_->SetTaskProgress(async_load_id_, ++async_progress_);
|
||||||
emit EffectiveLoadFinished(loader->songs());
|
songs << loader->songs();
|
||||||
}
|
}
|
||||||
|
emit EffectiveLoadFinished(songs);
|
||||||
task_manager_->SetTaskFinished(async_load_id_);
|
task_manager_->SetTaskFinished(async_load_id_);
|
||||||
|
|
||||||
deleteLater();
|
deleteLater();
|
||||||
|
|
Loading…
Reference in New Issue