SongUpdate: use Storage::OpenFile()

This commit is contained in:
Max Kellermann 2024-05-15 14:43:07 +02:00
parent f578a1cb2b
commit 81c778a529
1 changed files with 7 additions and 3 deletions

View File

@ -7,9 +7,12 @@
#include "db/plugins/simple/Directory.hxx" #include "db/plugins/simple/Directory.hxx"
#include "storage/StorageInterface.hxx" #include "storage/StorageInterface.hxx"
#include "storage/FileInfo.hxx" #include "storage/FileInfo.hxx"
#include "input/InputStream.hxx"
#include "input/WaitReady.hxx"
#include "decoder/DecoderList.hxx" #include "decoder/DecoderList.hxx"
#include "fs/AllocatedPath.hxx" #include "fs/AllocatedPath.hxx"
#include "fs/FileInfo.hxx" #include "fs/FileInfo.hxx"
#include "thread/Mutex.hxx"
#include "tag/Builder.hxx" #include "tag/Builder.hxx"
#include "TagFile.hxx" #include "TagFile.hxx"
#include "TagStream.hxx" #include "TagStream.hxx"
@ -64,9 +67,10 @@ Song::UpdateFile(Storage &storage, const StorageFileInfo &info)
try { try {
const auto path_fs = storage.MapFS(relative_uri); const auto path_fs = storage.MapFS(relative_uri);
if (path_fs.IsNull()) { if (path_fs.IsNull()) {
const auto absolute_uri = Mutex mutex;
storage.MapUTF8(relative_uri); const auto is = storage.OpenFile(relative_uri, mutex);
if (!tag_stream_scan(absolute_uri.c_str(), tag_builder, LockWaitReady(*is);
if (!tag_stream_scan(*is, tag_builder,
&new_audio_format)) &new_audio_format))
return false; return false;
} else { } else {