db/update/Paylist: use Storage::OpenFile()
This commit is contained in:
parent
81c778a529
commit
1b6c279850
|
@ -10,6 +10,7 @@
|
||||||
#include "lib/fmt/ExceptionFormatter.hxx"
|
#include "lib/fmt/ExceptionFormatter.hxx"
|
||||||
#include "song/DetachedSong.hxx"
|
#include "song/DetachedSong.hxx"
|
||||||
#include "input/InputStream.hxx"
|
#include "input/InputStream.hxx"
|
||||||
|
#include "input/WaitReady.hxx"
|
||||||
#include "playlist/PlaylistPlugin.hxx"
|
#include "playlist/PlaylistPlugin.hxx"
|
||||||
#include "playlist/PlaylistRegistry.hxx"
|
#include "playlist/PlaylistRegistry.hxx"
|
||||||
#include "playlist/PlaylistStream.hxx"
|
#include "playlist/PlaylistStream.hxx"
|
||||||
|
@ -65,14 +66,16 @@ UpdateWalk::UpdatePlaylistFile(Directory &parent, std::string_view name,
|
||||||
/* not modified */
|
/* not modified */
|
||||||
return;
|
return;
|
||||||
|
|
||||||
const auto uri_utf8 = storage.MapUTF8(directory->GetPath());
|
const char *const path = directory->GetPath();
|
||||||
|
|
||||||
FmtDebug(update_domain, "scanning playlist {:?}", uri_utf8);
|
FmtDebug(update_domain, "scanning playlist {:?}", path);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
Mutex mutex;
|
Mutex mutex;
|
||||||
auto e = plugin.open_stream(InputStream::OpenReady(uri_utf8.c_str(),
|
auto is = storage.OpenFile(path, mutex);
|
||||||
mutex));
|
LockWaitReady(*is);
|
||||||
|
|
||||||
|
auto e = plugin.open_stream(std::move(is));
|
||||||
if (!e) {
|
if (!e) {
|
||||||
/* unsupported URI? roll back.. */
|
/* unsupported URI? roll back.. */
|
||||||
editor.LockDeleteDirectory(directory);
|
editor.LockDeleteDirectory(directory);
|
||||||
|
@ -86,7 +89,7 @@ UpdateWalk::UpdatePlaylistFile(Directory &parent, std::string_view name,
|
||||||
} catch (...) {
|
} catch (...) {
|
||||||
FmtError(update_domain,
|
FmtError(update_domain,
|
||||||
"Failed to scan playlist {:?}: {}",
|
"Failed to scan playlist {:?}: {}",
|
||||||
uri_utf8, std::current_exception());
|
path, std::current_exception());
|
||||||
editor.LockDeleteDirectory(directory);
|
editor.LockDeleteDirectory(directory);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue