Added Album Artist support

This commit is contained in:
emeric
2019-05-15 13:15:18 +02:00
parent 397c6f4e9c
commit 3aa6edd74f
25 changed files with 1327 additions and 98 deletions
+22 -2
View File
@@ -120,6 +120,7 @@ Artist::refresh()
Wt::WContainerWidget* releasesContainer = t->bindNew<Wt::WContainerWidget>("releases");
auto releases = artist->getReleases(_filters->getClusterIds());
for (auto release : releases)
{
auto releaseId = release.id();
@@ -139,8 +140,27 @@ Artist::refresh()
entry->bindWidget("name", LmsApplication::createReleaseAnchor(release));
if (release->hasVariousArtists())
entry->setCondition("if-has-various-artists", true);
auto artists {release->getReleaseArtists()};
LMS_LOG(UI, DEBUG) << "Found " << artists.size() << " release artists";
for (auto artist : artists)
LMS_LOG(UI, DEBUG) << "\tArtist = '" << artist->getName() << "'";
if (artists.empty())
artists = release->getArtists();
bool isSameArtist {(std::find(std::cbegin(artists), std::cend(artists), artist) != artists.end())};
if (artists.size() > 1)
{
entry->setCondition("if-has-artist", true);
entry->bindNew<Wt::WText>("artist", Wt::WString::tr("Lms.Explore.various-artists"));
}
else if (artists.size() == 1 && !isSameArtist)
{
entry->setCondition("if-has-artist", true);
entry->bindWidget("artist", LmsApplication::createArtistAnchor(artists.front()));
}
boost::optional<int> year = release->getReleaseYear();
if (year)
+4 -1
View File
@@ -44,7 +44,10 @@ ReleaseLink::ReleaseLink(Database::Release::pointer release)
cover->setWidth(48);
anchor->setImage(std::move(cover));
auto artists = release->getArtists();
auto artists = release->getReleaseArtists();
if (artists.empty())
artists = release->getArtists();
if (artists.size() > 1)
{
setCondition("if-has-artist", true);
+9 -4
View File
@@ -96,16 +96,21 @@ Release::refresh()
}
{
auto artists {release->getArtists()};
std::vector<Wt::Dbo::ptr<Database::Artist>> artists;
artists = release->getReleaseArtists();
if (artists.empty())
artists = release->getArtists();
if (artists.size() > 1)
{
t->setCondition("if-has-artist", true);
t->bindNew<Wt::WText>("artist-name", Wt::WString::tr("Lms.Explore.various-artists"));
t->bindNew<Wt::WText>("artist", Wt::WString::tr("Lms.Explore.various-artists"));
}
else if (artists.size() == 1)
{
t->setCondition("if-has-artist", true);
t->bindWidget("artist-name", LmsApplication::createArtistAnchor(artists.front()));
t->bindWidget("artist", LmsApplication::createArtistAnchor(artists.front()));
}
}
@@ -181,7 +186,7 @@ Release::refresh()
}
auto discNumber {track->getDiscNumber()};
auto totalDiscNumber {track->getTotalDiscNumber()};
auto totalDiscNumber {release->getTotalDiscNumber()};
if (discNumber && totalDiscNumber && *totalDiscNumber > 1)
{
entry->setCondition("if-has-disc-number", true);
+4 -1
View File
@@ -96,7 +96,10 @@ Releases::addSome()
entry->bindWidget("release-name", LmsApplication::createReleaseAnchor(release));
auto artists = release->getArtists();
auto artists = release->getReleaseArtists();
if (artists.empty())
artists = release->getArtists();
if (artists.size() > 1)
{
entry->setCondition("if-has-artist", true);