From dfa03abfefa74c072c2bd6ec0cfc546307a88981 Mon Sep 17 00:00:00 2001 From: emeric Date: Wed, 18 Dec 2024 15:13:40 +0100 Subject: [PATCH] OpenSubsonic API: root music folders are returned using ids --- src/libs/subsonic/impl/SubsonicId.cpp | 6 ------ src/libs/subsonic/impl/SubsonicId.hpp | 1 - src/libs/subsonic/impl/endpoints/Browsing.cpp | 2 +- src/libs/subsonic/impl/responses/User.cpp | 2 +- 4 files changed, 2 insertions(+), 9 deletions(-) diff --git a/src/libs/subsonic/impl/SubsonicId.cpp b/src/libs/subsonic/impl/SubsonicId.cpp index 13e75909..4b3ae57d 100644 --- a/src/libs/subsonic/impl/SubsonicId.cpp +++ b/src/libs/subsonic/impl/SubsonicId.cpp @@ -33,12 +33,6 @@ namespace lms::api::subsonic return "dir-" + id.toString(); } - std::string idToString(db::MediaLibraryId id) - { - // No need to prefix as this is only used at well known places - return id.toString(); - } - std::string idToString(db::ReleaseId id) { return "al-" + id.toString(); diff --git a/src/libs/subsonic/impl/SubsonicId.hpp b/src/libs/subsonic/impl/SubsonicId.hpp index 7b285b08..f0db1e48 100644 --- a/src/libs/subsonic/impl/SubsonicId.hpp +++ b/src/libs/subsonic/impl/SubsonicId.hpp @@ -31,7 +31,6 @@ namespace lms::api::subsonic { std::string idToString(db::ArtistId id); std::string idToString(db::DirectoryId id); - std::string idToString(db::MediaLibraryId id); std::string idToString(db::ReleaseId id); std::string idToString(db::TrackId id); std::string idToString(db::TrackListId id); diff --git a/src/libs/subsonic/impl/endpoints/Browsing.cpp b/src/libs/subsonic/impl/endpoints/Browsing.cpp index 79fe87ed..aa5a25fe 100644 --- a/src/libs/subsonic/impl/endpoints/Browsing.cpp +++ b/src/libs/subsonic/impl/endpoints/Browsing.cpp @@ -228,7 +228,7 @@ namespace lms::api::subsonic MediaLibrary::find(context.dbSession, [&](const MediaLibrary::pointer& library) { Response::Node& musicFolderNode{ musicFoldersNode.createArrayChild("musicFolder") }; - musicFolderNode.setAttribute("id", idToString(library->getId())); + musicFolderNode.setAttribute("id", library->getId().getValue()); musicFolderNode.setAttribute("name", library->getName()); }); diff --git a/src/libs/subsonic/impl/responses/User.cpp b/src/libs/subsonic/impl/responses/User.cpp index 557b6acb..885d2189 100644 --- a/src/libs/subsonic/impl/responses/User.cpp +++ b/src/libs/subsonic/impl/responses/User.cpp @@ -47,7 +47,7 @@ namespace lms::api::subsonic // users can access all libraries db::MediaLibrary::find(context.dbSession, [&](const db::MediaLibrary::pointer& library) { - userNode.addArrayValue("folder", idToString(library->getId())); + userNode.addArrayValue("folder", library->getId().getValue()); }); return userNode;