Do not report OpenSubsonic extra fields for selected legacy clients. This made DSub behave badly. fixes #356
This commit is contained in:
@@ -74,7 +74,7 @@ namespace API::Subsonic
|
||||
}
|
||||
}
|
||||
|
||||
Response::Node createAlbumNode(const Release::pointer& release, Session& dbSession, const User::pointer& user, bool id3)
|
||||
Response::Node createAlbumNode(RequestContext& context, const Release::pointer& release, const User::pointer& user, bool id3)
|
||||
{
|
||||
Response::Node albumNode;
|
||||
|
||||
@@ -125,7 +125,7 @@ namespace API::Subsonic
|
||||
}
|
||||
|
||||
// Report the first GENRE for this track
|
||||
const ClusterType::pointer genreClusterType{ ClusterType::find(dbSession, "GENRE") };
|
||||
const ClusterType::pointer genreClusterType{ ClusterType::find(context.dbSession, "GENRE") };
|
||||
if (genreClusterType)
|
||||
{
|
||||
auto clusters{ release->getClusterGroups({genreClusterType}, 1) };
|
||||
@@ -136,6 +136,9 @@ namespace API::Subsonic
|
||||
if (const Wt::WDateTime dateTime{ Service<Feedback::IFeedbackService>::get()->getStarredDateTime(user->getId(), release->getId()) }; dateTime.isValid())
|
||||
albumNode.setAttribute("starred", StringUtils::toISO8601String(dateTime));
|
||||
|
||||
if (!context.enableOpenSubsonic)
|
||||
return albumNode;
|
||||
|
||||
// OpenSubsonic specific fields (must always be set)
|
||||
if (!id3)
|
||||
albumNode.setAttribute("mediaType", "album");
|
||||
@@ -154,14 +157,14 @@ namespace API::Subsonic
|
||||
{
|
||||
albumNode.createEmptyArrayValue(field);
|
||||
|
||||
ClusterType::pointer clusterType{ ClusterType::find(dbSession, clusterTypeName) };
|
||||
ClusterType::pointer clusterType{ ClusterType::find(context.dbSession, clusterTypeName) };
|
||||
if (clusterType)
|
||||
{
|
||||
Cluster::FindParameters params;
|
||||
params.setRelease(release->getId());
|
||||
params.setClusterType(clusterType->getId());
|
||||
|
||||
for (const auto& cluster : Cluster::find(dbSession, params).results)
|
||||
for (const auto& cluster : Cluster::find(context.dbSession, params).results)
|
||||
albumNode.addArrayValue(field, std::get<std::string>(cluster));
|
||||
}
|
||||
} };
|
||||
@@ -176,7 +179,7 @@ namespace API::Subsonic
|
||||
params.setRelease(release->getId());
|
||||
params.setClusterType(genreClusterType->getId());
|
||||
|
||||
for (const auto& cluster : Cluster::find(dbSession, params).results)
|
||||
for (const auto& cluster : Cluster::find(context.dbSession, params).results)
|
||||
albumNode.addArrayChild("genres", createItemGenreNode(std::get<std::string>(cluster)));
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user