Added support for record labels, fixes #502

This commit is contained in:
emeric
2024-09-02 08:06:17 +02:00
parent 24e867ea8c
commit cb4014b0e5
17 changed files with 267 additions and 12 deletions
+7 -1
View File
@@ -36,6 +36,7 @@
#include "responses/DiscTitle.hpp"
#include "responses/ItemDate.hpp"
#include "responses/ItemGenre.hpp"
#include "responses/RecordLabel.hpp"
namespace lms::api::subsonic
{
@@ -186,7 +187,6 @@ namespace lms::api::subsonic
albumNode.setAttribute("isCompilation", isCompilation);
}
// disc titles
albumNode.createEmptyArrayChild("discTitles");
for (const DiscInfo& discInfo : release->getDiscs())
{
@@ -194,6 +194,12 @@ namespace lms::api::subsonic
albumNode.addArrayChild("discTitles", createDiscTitle(discInfo));
}
albumNode.createEmptyArrayChild("recordLabels");
release->visitLabels([&](const Label::pointer& label)
{
albumNode.addArrayChild("recordLabels", createRecordLabel(label));
});
return albumNode;
}
} // namespace lms::api::subsonic
@@ -0,0 +1,34 @@
/*
* Copyright (C) 2024 Emeric Poupon
*
* This file is part of LMS.
*
* LMS is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* LMS is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with LMS. If not, see <http://www.gnu.org/licenses/>.
*/
#include "responses/RecordLabel.hpp"
#include "database/Release.hpp"
namespace lms::api::subsonic
{
Response::Node createRecordLabel(const db::ObjectPtr<db::Label>& label)
{
Response::Node recordLabelNode;
recordLabelNode.setAttribute("name", label->getName());
return recordLabelNode;
}
} // namespace lms::api::subsonic
@@ -0,0 +1,34 @@
/*
* Copyright (C) 2024 Emeric Poupon
*
* This file is part of LMS.
*
* LMS is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* LMS is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with LMS. If not, see <http://www.gnu.org/licenses/>.
*/
#pragma once
#include "database/Object.hpp"
#include "SubsonicResponse.hpp"
namespace lms::db
{
class Label;
}
namespace lms::api::subsonic
{
Response::Node createRecordLabel(const db::ObjectPtr<db::Label>& label);
}