QueueSave: use DatabaseDetachSong()

This commit is contained in:
Max Kellermann 2014-01-17 23:49:53 +01:00
parent 32ec672311
commit 75b847132a
1 changed files with 3 additions and 11 deletions

View File

@ -23,8 +23,7 @@
#include "PlaylistError.hxx" #include "PlaylistError.hxx"
#include "DetachedSong.hxx" #include "DetachedSong.hxx"
#include "SongSave.hxx" #include "SongSave.hxx"
#include "DatabasePlugin.hxx" #include "DatabaseSong.hxx"
#include "DatabaseGlue.hxx"
#include "fs/TextFile.hxx" #include "fs/TextFile.hxx"
#include "util/StringUtil.hxx" #include "util/StringUtil.hxx"
#include "util/UriUtil.hxx" #include "util/UriUtil.hxx"
@ -111,16 +110,9 @@ queue_load_song(TextFile &file, const char *line, queue &queue)
if (uri_has_scheme(uri)) { if (uri_has_scheme(uri)) {
song = new DetachedSong(uri); song = new DetachedSong(uri);
} else { } else {
const Database *db = GetDatabase(); song = DatabaseDetachSong(uri, IgnoreError());
if (db == nullptr) if (song == nullptr)
return; return;
Song *tmp = db->GetSong(uri, IgnoreError());
if (tmp == nullptr)
return;
song = new DetachedSong(*tmp);
db->ReturnSong(tmp);
} }
} }