Support more collections

This commit is contained in:
Jonas Kvinge
2025-03-08 22:24:28 +01:00
parent 5ae0320911
commit bdbe66b116
28 changed files with 327 additions and 341 deletions

View File

@@ -439,6 +439,7 @@ int Song::samplerate() const { return d->samplerate_; }
int Song::bitdepth() const { return d->bitdepth_; }
Song::Source Song::source() const { return d->source_; }
int Song::source_id() const { return static_cast<int>(d->source_); }
int Song::directory_id() const { return d->directory_id_; }
const QUrl &Song::url() const { return d->url_; }
const QString &Song::basefilename() const { return d->basefilename_; }
@@ -661,7 +662,8 @@ const QString &Song::playlist_albumartist() const { return is_compilation() ? d-
const QString &Song::playlist_albumartist_sortable() const { return is_compilation() ? d->albumartist_sortable_ : effective_albumartist_sortable(); }
bool Song::is_metadata_good() const { return !d->url_.isEmpty() && !d->artist_.isEmpty() && !d->title_.isEmpty(); }
bool Song::is_collection_song() const { return d->source_ == Source::Collection; }
bool Song::is_local_collection_song() const { return d->source_ == Source::Collection; }
bool Song::is_linked_collection_song() const { return IsLinkedCollectionSource(d->source_); }
bool Song::is_stream() const { return is_radio() || d->source_ == Source::Tidal || d->source_ == Source::Subsonic || d->source_ == Source::Qobuz || d->source_ == Source::Spotify; }
bool Song::is_radio() const { return d->source_ == Source::Stream || d->source_ == Source::SomaFM || d->source_ == Source::RadioParadise; }
bool Song::is_cdda() const { return d->source_ == Source::CDDA; }
@@ -1331,6 +1333,12 @@ Song::FileType Song::FiletypeByExtension(const QString &ext) {
}
bool Song::IsLinkedCollectionSource(const Source source) {
return source == Source::Collection;
}
QString Song::ImageCacheDir(const Source source) {
switch (source) {
@@ -1831,8 +1839,8 @@ bool Song::MergeFromEngineMetadata(const EngineMetadata &engine_metadata) {
bool minor = true;
if (d->init_from_file_ || is_collection_song() || d->url_.isLocalFile()) {
// This Song was already loaded using taglib. Our tags are probably better than the engine's.
if (d->init_from_file_ || is_local_collection_song() || d->url_.isLocalFile()) {
// This Song was already loaded using TagLib. Our tags are probably better than the engine's.
if (title() != engine_metadata.title && title().isEmpty() && !engine_metadata.title.isEmpty()) {
set_title(engine_metadata.title);
minor = false;