diff --git a/src/SongLoader.hxx b/src/SongLoader.hxx index e1c233c59..f259ed4da 100644 --- a/src/SongLoader.hxx +++ b/src/SongLoader.hxx @@ -26,16 +26,16 @@ class SongLoader { #ifdef ENABLE_DATABASE const Database *const db; - const Storage *const storage; + Storage *const storage; #endif public: #ifdef ENABLE_DATABASE explicit SongLoader(const IClient &_client) noexcept; - SongLoader(const Database *_db, const Storage *_storage) noexcept + SongLoader(const Database *_db, Storage *_storage) noexcept :client(nullptr), db(_db), storage(_storage) {} SongLoader(const IClient &_client, const Database *_db, - const Storage *_storage) noexcept + Storage *_storage) noexcept :client(&_client), db(_db), storage(_storage) {} #else explicit SongLoader(const IClient &_client) noexcept @@ -45,7 +45,7 @@ public: #endif #ifdef ENABLE_DATABASE - const Storage *GetStorage() const noexcept { + Storage *GetStorage() const noexcept { return storage; } #endif diff --git a/src/client/Client.cxx b/src/client/Client.cxx index 0e1462b09..f393c6982 100644 --- a/src/client/Client.cxx +++ b/src/client/Client.cxx @@ -99,7 +99,7 @@ Client::GetDatabaseOrThrow() const return partition->instance.GetDatabaseOrThrow(); } -const Storage * +Storage * Client::GetStorage() const noexcept { return partition->instance.storage; diff --git a/src/client/Client.hxx b/src/client/Client.hxx index 64e466ec8..d440aad0e 100644 --- a/src/client/Client.hxx +++ b/src/client/Client.hxx @@ -248,7 +248,7 @@ public: #ifdef ENABLE_DATABASE const Database *GetDatabase() const noexcept override; - const Storage *GetStorage() const noexcept override; + Storage *GetStorage() const noexcept override; #endif // ENABLE_DATABASE private: diff --git a/src/client/IClient.hxx b/src/client/IClient.hxx index 3a24a19fd..c5fc48a97 100644 --- a/src/client/IClient.hxx +++ b/src/client/IClient.hxx @@ -34,6 +34,6 @@ public: virtual const Database *GetDatabase() const noexcept = 0; [[gnu::pure]] - virtual const Storage *GetStorage() const noexcept = 0; + virtual Storage *GetStorage() const noexcept = 0; #endif // ENABLE_DATABASE }; diff --git a/src/playlist/PlaylistAny.cxx b/src/playlist/PlaylistAny.cxx index ce8a9f81a..84ea7a496 100644 --- a/src/playlist/PlaylistAny.cxx +++ b/src/playlist/PlaylistAny.cxx @@ -11,7 +11,7 @@ std::unique_ptr playlist_open_any(const LocatedUri &located_uri, #ifdef ENABLE_DATABASE - const Storage *storage, + Storage *storage, #endif Mutex &mutex) { diff --git a/src/playlist/PlaylistAny.hxx b/src/playlist/PlaylistAny.hxx index 9c24c5379..9c11a17ed 100644 --- a/src/playlist/PlaylistAny.hxx +++ b/src/playlist/PlaylistAny.hxx @@ -23,6 +23,6 @@ class Storage; std::unique_ptr playlist_open_any(const LocatedUri &located_uri, #ifdef ENABLE_DATABASE - const Storage *storage, + Storage *storage, #endif Mutex &mutex); diff --git a/src/playlist/PlaylistMapper.cxx b/src/playlist/PlaylistMapper.cxx index 970f6f0f9..12dceb75e 100644 --- a/src/playlist/PlaylistMapper.cxx +++ b/src/playlist/PlaylistMapper.cxx @@ -3,9 +3,12 @@ #include "PlaylistMapper.hxx" #include "PlaylistFile.hxx" +#include "PlaylistRegistry.hxx" #include "PlaylistStream.hxx" #include "SongEnumerator.hxx" #include "Mapper.hxx" +#include "input/InputStream.hxx" +#include "input/WaitReady.hxx" #include "fs/AllocatedPath.hxx" #include "storage/StorageInterface.hxx" #include "util/UriUtil.hxx" @@ -33,7 +36,7 @@ playlist_open_in_playlist_dir(const char *uri, Mutex &mutex) * Load a playlist from the configured music directory. */ static std::unique_ptr -playlist_open_in_storage(const char *uri, const Storage *storage, Mutex &mutex) +playlist_open_in_storage(const char *uri, Storage *storage, Mutex &mutex) { assert(uri_safe_local(uri)); @@ -43,8 +46,9 @@ playlist_open_in_storage(const char *uri, const Storage *storage, Mutex &mutex) if (const auto path = storage->MapFS(uri); !path.IsNull()) return playlist_open_path(path, mutex); - const auto uri2 = storage->MapUTF8(uri); - return playlist_open_remote(uri2.c_str(), mutex); + auto is = storage->OpenFile(uri, mutex); + LockWaitReady(*is); + return playlist_list_open_stream(std::move(is), uri); } #endif @@ -52,7 +56,7 @@ playlist_open_in_storage(const char *uri, const Storage *storage, Mutex &mutex) std::unique_ptr playlist_mapper_open(const char *uri, #ifdef ENABLE_DATABASE - const Storage *storage, + Storage *storage, #endif Mutex &mutex) { diff --git a/src/playlist/PlaylistMapper.hxx b/src/playlist/PlaylistMapper.hxx index b3c78c0be..fa07b5f74 100644 --- a/src/playlist/PlaylistMapper.hxx +++ b/src/playlist/PlaylistMapper.hxx @@ -22,6 +22,6 @@ class Storage; std::unique_ptr playlist_mapper_open(const char *uri, #ifdef ENABLE_DATABASE - const Storage *storage, + Storage *storage, #endif Mutex &mutex); diff --git a/test/test_translate_song.cxx b/test/test_translate_song.cxx index ebcb420d2..798cc63e7 100644 --- a/test/test_translate_song.cxx +++ b/test/test_translate_song.cxx @@ -123,7 +123,7 @@ public: return reinterpret_cast(this); } - const Storage *GetStorage() const noexcept override { + Storage *GetStorage() const noexcept override { return ::storage; } #endif // ENABLE_DATABASE