Added support for explcit tags (rtng, ITUNESADVISORY)
This commit is contained in:
@@ -35,7 +35,7 @@ namespace lms::db
|
||||
{
|
||||
namespace
|
||||
{
|
||||
static constexpr Version LMS_DATABASE_VERSION{ 78 };
|
||||
static constexpr Version LMS_DATABASE_VERSION{ 79 };
|
||||
}
|
||||
|
||||
VersionInfo::VersionInfo()
|
||||
@@ -1035,6 +1035,15 @@ FROM tracklist)");
|
||||
utils::executeCommand(*session.getDboSession(), "ALTER TABLE scan_settings ADD COLUMN skip_single_release_playlists BOOLEAN NOT NULL DEFAULT(FALSE)");
|
||||
}
|
||||
|
||||
void migrateFromV78(Session& session)
|
||||
{
|
||||
// added advisory tag support
|
||||
utils::executeCommand(*session.getDboSession(), "ALTER TABLE track ADD COLUMN advisory INTEGER NOT NULL DEFAULT(0)"); // 0 means unset
|
||||
|
||||
// Just increment the scan version of the settings to make the next scan rescan everything
|
||||
utils::executeCommand(*session.getDboSession(), "UPDATE scan_settings SET scan_version = scan_version + 1");
|
||||
}
|
||||
|
||||
bool doDbMigration(Session& session)
|
||||
{
|
||||
constexpr std::string_view outdatedMsg{ "Outdated database, please rebuild it (delete the .db file and restart)" };
|
||||
@@ -1089,6 +1098,7 @@ FROM tracklist)");
|
||||
{ 75, migrateFromV75 },
|
||||
{ 76, migrateFromV76 },
|
||||
{ 77, migrateFromV77 },
|
||||
{ 78, migrateFromV78 },
|
||||
};
|
||||
|
||||
bool migrationPerformed{};
|
||||
|
||||
@@ -666,6 +666,19 @@ namespace lms::db
|
||||
utils::forEachQueryResult(query, _func);
|
||||
}
|
||||
|
||||
core::EnumSet<Advisory> Release::getAdvisories() const
|
||||
{
|
||||
core::EnumSet<Advisory> res;
|
||||
|
||||
auto query{ session()->query<Advisory>("SELECT DISTINCT advisory FROM track t").where("t.release_id = ?").bind(getId()) };
|
||||
|
||||
utils::forEachQueryResult(query, [&](Advisory advisory) {
|
||||
res.insert(advisory);
|
||||
});
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
std::chrono::milliseconds Release::getDuration() const
|
||||
{
|
||||
assert(session());
|
||||
|
||||
@@ -252,6 +252,7 @@ namespace lms::db
|
||||
std::vector<std::string> getLabelNames() const;
|
||||
std::vector<std::string> getReleaseTypeNames() const;
|
||||
void visitLabels(const std::function<void(const Label::pointer& label)>& _func) const;
|
||||
core::EnumSet<Advisory> getAdvisories() const;
|
||||
std::string_view getBarcode() const { return _barcode; }
|
||||
ObjectPtr<Image> getImage() const;
|
||||
|
||||
|
||||
@@ -193,12 +193,6 @@ namespace lms::db
|
||||
}
|
||||
};
|
||||
|
||||
struct PathResult
|
||||
{
|
||||
TrackId trackId;
|
||||
std::filesystem::path path;
|
||||
};
|
||||
|
||||
Track() = default;
|
||||
|
||||
// Find utility functions
|
||||
@@ -244,6 +238,7 @@ namespace lms::db
|
||||
void setRecordingMBID(const std::optional<core::UUID>& MBID) { _recordingMBID = MBID ? MBID->getAsString() : ""; }
|
||||
void setCopyright(std::string_view copyright);
|
||||
void setCopyrightURL(std::string_view copyrightURL);
|
||||
void setAdvisory(Advisory advisory) { _advisory = advisory; }
|
||||
void setTrackReplayGain(std::optional<float> replayGain) { _trackReplayGain = replayGain; }
|
||||
void setReleaseReplayGain(std::optional<float> replayGain) { _releaseReplayGain = replayGain; } // may be by disc!
|
||||
void setArtistDisplayName(std::string_view name) { _artistDisplayName = name; }
|
||||
@@ -285,6 +280,7 @@ namespace lms::db
|
||||
std::optional<core::UUID> getRecordingMBID() const { return core::UUID::fromString(_recordingMBID); }
|
||||
std::optional<std::string> getCopyright() const;
|
||||
std::optional<std::string> getCopyrightURL() const;
|
||||
Advisory getAdvisory() const { return _advisory; }
|
||||
std::optional<float> getTrackReplayGain() const { return _trackReplayGain; }
|
||||
std::optional<float> getReleaseReplayGain() const { return _releaseReplayGain; }
|
||||
std::string_view getArtistDisplayName() const { return _artistDisplayName; }
|
||||
@@ -333,6 +329,7 @@ namespace lms::db
|
||||
Wt::Dbo::field(a, _recordingMBID, "recording_mbid");
|
||||
Wt::Dbo::field(a, _copyright, "copyright");
|
||||
Wt::Dbo::field(a, _copyrightURL, "copyright_url");
|
||||
Wt::Dbo::field(a, _advisory, "advisory");
|
||||
Wt::Dbo::field(a, _trackReplayGain, "track_replay_gain");
|
||||
Wt::Dbo::field(a, _releaseReplayGain, "release_replay_gain"); // here in Track since Release does not have concept of "disc" (yet?)
|
||||
Wt::Dbo::field(a, _artistDisplayName, "artist_display_name");
|
||||
@@ -381,11 +378,11 @@ namespace lms::db
|
||||
std::string _recordingMBID;
|
||||
std::string _copyright;
|
||||
std::string _copyrightURL;
|
||||
Advisory _advisory{ Advisory::UnSet };
|
||||
std::optional<float> _trackReplayGain;
|
||||
std::optional<float> _releaseReplayGain;
|
||||
std::string _artistDisplayName;
|
||||
std::string _comment;
|
||||
|
||||
Wt::Dbo::ptr<Release> _release;
|
||||
Wt::Dbo::ptr<MediaLibrary> _mediaLibrary;
|
||||
Wt::Dbo::ptr<Directory> _directory;
|
||||
|
||||
@@ -256,4 +256,12 @@ namespace lms::db
|
||||
PlayList = 0, // user controlled playlists
|
||||
Internal = 1, // internal usage (current playqueue, history, ...)
|
||||
};
|
||||
|
||||
enum class Advisory
|
||||
{
|
||||
UnSet = 0,
|
||||
Unknown = 1,
|
||||
Clean = 2,
|
||||
Explicit = 3,
|
||||
};
|
||||
} // namespace lms::db
|
||||
|
||||
Reference in New Issue
Block a user