From 7bc5579fb7e4fcad5abbb4c63661010d828f48bc Mon Sep 17 00:00:00 2001 From: Jonas Kvinge Date: Wed, 3 Apr 2024 20:45:52 +0200 Subject: [PATCH] Song: Check that filetype is supported for writing tags Fixes #1413 --- src/core/song.cpp | 22 +++++++++++++++++++++- src/core/song.h | 1 + 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/src/core/song.cpp b/src/core/song.cpp index 7b9bac76..471d4135 100644 --- a/src/core/song.cpp +++ b/src/core/song.cpp @@ -549,6 +549,26 @@ bool Song::has_valid_art() const { return art_embedded() || art_automatic_is_val void Song::clear_art_automatic() { d->art_automatic_.clear(); } void Song::clear_art_manual() { d->art_manual_.clear(); } +bool Song::write_tags_supported() const { + + return d->filetype_ == FileType::FLAC || + d->filetype_ == FileType::WavPack || + d->filetype_ == FileType::OggFlac || + d->filetype_ == FileType::OggVorbis || + d->filetype_ == FileType::OggOpus || + d->filetype_ == FileType::OggSpeex || + d->filetype_ == FileType::MPEG || + d->filetype_ == FileType::MP4 || + d->filetype_ == FileType::ASF || + d->filetype_ == FileType::AIFF || + d->filetype_ == FileType::MPC || + d->filetype_ == FileType::TrueAudio || + d->filetype_ == FileType::APE || + d->filetype_ == FileType::DSF || + d->filetype_ == FileType::DSDIFF; + +} + bool Song::additional_tags_supported() const { return d->filetype_ == FileType::FLAC || @@ -752,7 +772,7 @@ QString Song::PrettyRating() const { } bool Song::IsEditable() const { - return d->valid_ && d->url_.isValid() && (d->url_.isLocalFile() || d->source_ == Source::Stream) && !has_cue(); + return d->valid_ && d->url_.isValid() && ((d->url_.isLocalFile() && write_tags_supported() && !has_cue()) || d->source_ == Source::Stream); } bool Song::IsMetadataEqual(const Song &other) const { diff --git a/src/core/song.h b/src/core/song.h index 16c7e1ff..fde0356e 100644 --- a/src/core/song.h +++ b/src/core/song.h @@ -335,6 +335,7 @@ class Song { void clear_art_automatic(); void clear_art_manual(); + bool write_tags_supported() const; bool additional_tags_supported() const; bool albumartist_supported() const; bool composer_supported() const;