Subsonic API: added musicBrainzId extra field
This commit is contained in:
@@ -81,21 +81,24 @@ namespace API::Subsonic
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (id3)
|
// Report the first GENRE for this track
|
||||||
|
ClusterType::pointer clusterType{ ClusterType::find(dbSession, "GENRE") };
|
||||||
|
if (clusterType)
|
||||||
{
|
{
|
||||||
// Report the first GENRE for this track
|
auto clusters{ release->getClusterGroups({clusterType}, 1) };
|
||||||
ClusterType::pointer clusterType{ ClusterType::find(dbSession, "GENRE") };
|
if (!clusters.empty() && !clusters.front().empty())
|
||||||
if (clusterType)
|
albumNode.setAttribute("genre", clusters.front().front()->getName());
|
||||||
{
|
|
||||||
auto clusters{ release->getClusterGroups({clusterType}, 1) };
|
|
||||||
if (!clusters.empty() && !clusters.front().empty())
|
|
||||||
albumNode.setAttribute("genre", clusters.front().front()->getName());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (const Wt::WDateTime dateTime{ Service<Scrobbling::IScrobblingService>::get()->getStarredDateTime(user->getId(), release->getId()) }; dateTime.isValid())
|
if (const Wt::WDateTime dateTime{ Service<Scrobbling::IScrobblingService>::get()->getStarredDateTime(user->getId(), release->getId()) }; dateTime.isValid())
|
||||||
albumNode.setAttribute("starred", StringUtils::toISO8601String(dateTime)); // TODO report correct date/time
|
albumNode.setAttribute("starred", StringUtils::toISO8601String(dateTime)); // TODO report correct date/time
|
||||||
|
|
||||||
|
// OpenSubsonic specific field
|
||||||
|
{
|
||||||
|
std::optional<UUID> mbid {release->getMBID()};
|
||||||
|
albumNode.setAttribute("musicBrainzId", mbid ? mbid->getAsString() : "");
|
||||||
|
}
|
||||||
|
|
||||||
return albumNode;
|
return albumNode;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -68,6 +68,12 @@ namespace API::Subsonic
|
|||||||
if (const Wt::WDateTime dateTime{ Service<Scrobbling::IScrobblingService>::get()->getStarredDateTime(user->getId(), artist->getId()) }; dateTime.isValid())
|
if (const Wt::WDateTime dateTime{ Service<Scrobbling::IScrobblingService>::get()->getStarredDateTime(user->getId(), artist->getId()) }; dateTime.isValid())
|
||||||
artistNode.setAttribute("starred", StringUtils::toISO8601String(dateTime));
|
artistNode.setAttribute("starred", StringUtils::toISO8601String(dateTime));
|
||||||
|
|
||||||
|
// OpenSubsonic specific field
|
||||||
|
{
|
||||||
|
std::optional<UUID> mbid {artist->getMBID()};
|
||||||
|
artistNode.setAttribute("musicBrainzId", mbid ? mbid->getAsString() : "");
|
||||||
|
}
|
||||||
|
|
||||||
return artistNode;
|
return artistNode;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -153,6 +153,12 @@ namespace API::Subsonic
|
|||||||
trackResponse.setAttribute("genre", clusters.front().front()->getName());
|
trackResponse.setAttribute("genre", clusters.front().front()->getName());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// OpenSubsonic specific field
|
||||||
|
{
|
||||||
|
std::optional<UUID> mbid {track->getTrackMBID()};
|
||||||
|
trackResponse.setAttribute("musicBrainzId", mbid ? mbid->getAsString() : "");
|
||||||
|
}
|
||||||
|
|
||||||
return trackResponse;
|
return trackResponse;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user