Display disc subtitles if it is set, even for single disc releases, fixes #492
This commit is contained in:
@@ -514,6 +514,11 @@ namespace lms::db
|
|||||||
return getArtists().size() > 1;
|
return getArtists().size() > 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool Release::hasDiscSubtitle() const
|
||||||
|
{
|
||||||
|
return utils::fetchQuerySingleResult(session()->query<int>("SELECT EXISTS (SELECT 1 FROM track WHERE disc_subtitle IS NOT NULL AND disc_subtitle <> '' AND release_id = ?)").bind(getId()));
|
||||||
|
}
|
||||||
|
|
||||||
std::size_t Release::getTrackCount() const
|
std::size_t Release::getTrackCount() const
|
||||||
{
|
{
|
||||||
assert(session());
|
assert(session());
|
||||||
|
|||||||
@@ -218,6 +218,7 @@ namespace lms::db
|
|||||||
std::vector<ObjectPtr<Artist>> getReleaseArtists() const { return getArtists(TrackArtistLinkType::ReleaseArtist); }
|
std::vector<ObjectPtr<Artist>> getReleaseArtists() const { return getArtists(TrackArtistLinkType::ReleaseArtist); }
|
||||||
bool hasVariousArtists() const;
|
bool hasVariousArtists() const;
|
||||||
std::vector<pointer> getSimilarReleases(std::optional<std::size_t> offset = {}, std::optional<std::size_t> count = {}) const;
|
std::vector<pointer> getSimilarReleases(std::optional<std::size_t> offset = {}, std::optional<std::size_t> count = {}) const;
|
||||||
|
bool hasDiscSubtitle() const;
|
||||||
|
|
||||||
template<class Action>
|
template<class Action>
|
||||||
void persist(Action& a)
|
void persist(Action& a)
|
||||||
|
|||||||
@@ -321,7 +321,8 @@ namespace lms::ui
|
|||||||
const bool variousArtists{ release->hasVariousArtists() };
|
const bool variousArtists{ release->hasVariousArtists() };
|
||||||
const auto totalDisc{ release->getTotalDisc() };
|
const auto totalDisc{ release->getTotalDisc() };
|
||||||
const std::size_t discCount{ release->getDiscCount() };
|
const std::size_t discCount{ release->getDiscCount() };
|
||||||
const bool isReleaseMultiDisc{ (discCount > 1) || (totalDisc && *totalDisc > 1) };
|
const bool hasDiscSubtitle{ release->hasDiscSubtitle() };
|
||||||
|
const bool useSubtitleContainers{ (discCount > 1) || (totalDisc && *totalDisc > 1) || hasDiscSubtitle };
|
||||||
|
|
||||||
// Expect to be called in asc order
|
// Expect to be called in asc order
|
||||||
std::map<std::size_t, Wt::WContainerWidget*> trackContainers;
|
std::map<std::size_t, Wt::WContainerWidget*> trackContainers;
|
||||||
@@ -392,8 +393,10 @@ namespace lms::ui
|
|||||||
const auto discNumber{ track->getDiscNumber() };
|
const auto discNumber{ track->getDiscNumber() };
|
||||||
|
|
||||||
Wt::WContainerWidget* container;
|
Wt::WContainerWidget* container;
|
||||||
if (isReleaseMultiDisc && discNumber)
|
if (useSubtitleContainers && discNumber)
|
||||||
container = getOrAddDiscContainer(*discNumber, track->getDiscSubtitle());
|
container = getOrAddDiscContainer(*discNumber, track->getDiscSubtitle());
|
||||||
|
else if (hasDiscSubtitle && !discNumber)
|
||||||
|
container = getOrAddDiscContainer(0, track->getDiscSubtitle());
|
||||||
else
|
else
|
||||||
container = getOrAddNoDiscContainer();
|
container = getOrAddNoDiscContainer();
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user