Add option not to remove "Remastered", etc from song titles

This commit is contained in:
Jonas Kvinge
2025-10-18 19:57:38 +02:00
parent 8bfc3bc41c
commit d61adeb595
18 changed files with 69 additions and 21 deletions

View File

@@ -36,6 +36,7 @@ constexpr char kAlbumsSearchLimit[] = "albumssearchlimit";
constexpr char kSongsSearchLimit[] = "songssearchlimit";
constexpr char kBase64Secret[] = "base64secret";
constexpr char kDownloadAlbumCovers[] = "downloadalbumcovers";
constexpr char kRemoveRemastered[] = "remove_remastered";
constexpr char kUserId[] = "user_id";
constexpr char kCredentialsId[] = "credentials_id";

View File

@@ -31,6 +31,7 @@ constexpr char kAlbumsSearchLimit[] = "albumssearchlimit";
constexpr char kSongsSearchLimit[] = "songssearchlimit";
constexpr char kFetchAlbums[] = "fetchalbums";
constexpr char kDownloadAlbumCovers[] = "downloadalbumcovers";
constexpr char kRemoveRemastered[] = "remove_remastered";
constexpr char kAccessToken[] = "access_token";
constexpr char kRefreshToken[] = "refresh_token";

View File

@@ -40,6 +40,7 @@ constexpr char kDownloadAlbumCovers[] = "downloadalbumcovers";
constexpr char kCoverSize[] = "coversize";
constexpr char kStreamUrl[] = "streamurl";
constexpr char kAlbumExplicit[] = "album_explicit";
constexpr char kRemoveRemastered[] = "remove_remastered";
enum class StreamUrlMethod {
StreamUrl,

View File

@@ -1156,7 +1156,9 @@ void QobuzRequest::ParseSong(Song &song, const QJsonObject &json_obj, const Arti
url.setScheme(url_handler_->scheme());
url.setPath(song_id);
title = Song::TitleRemoveMisc(title);
if (service_->remove_remastered()) {
title = Song::TitleRemoveMisc(title);
}
//qLog(Debug) << "id" << song_id << "track" << track << "title" << title << "album" << album << "album artist" << album_artist << cover_url << streamable << url;

View File

@@ -99,6 +99,7 @@ QobuzService::QobuzService(const SharedPtr<TaskManager> task_manager,
albumssearchlimit_(1),
songssearchlimit_(1),
download_album_covers_(true),
remove_remastered_(true),
user_id_(-1),
credential_id_(-1),
pending_search_id_(0),
@@ -227,6 +228,7 @@ void QobuzService::ReloadSettings() {
albumssearchlimit_ = s.value(QobuzSettings::kAlbumsSearchLimit, 10).toInt();
songssearchlimit_ = s.value(QobuzSettings::kSongsSearchLimit, 10).toInt();
download_album_covers_ = s.value(QobuzSettings::kDownloadAlbumCovers, true).toBool();
remove_remastered_ = s.value(QobuzSettings::kRemoveRemastered, true).toBool();
user_id_ = s.value(QobuzSettings::kUserId).toInt();
device_id_ = s.value(QobuzSettings::kDeviceId).toString();

View File

@@ -95,6 +95,7 @@ class QobuzService : public StreamingService {
int albumssearchlimit() const { return albumssearchlimit_; }
int songssearchlimit() const { return songssearchlimit_; }
bool download_album_covers() const { return download_album_covers_; }
bool remove_remastered() const { return remove_remastered_; }
QString user_auth_token() const { return user_auth_token_; }
qint64 user_id() const { return user_id_; }
@@ -187,6 +188,7 @@ class QobuzService : public StreamingService {
int albumssearchlimit_;
int songssearchlimit_;
bool download_album_covers_;
bool remove_remastered_;
qint64 user_id_;
QString user_auth_token_;

View File

@@ -99,6 +99,7 @@ void QobuzSettingsPage::Load() {
ui_->songssearchlimit->setValue(s.value(kSongsSearchLimit, 10).toInt());
ui_->checkbox_base64_secret->setChecked(s.value(kBase64Secret, false).toBool());
ui_->checkbox_download_album_covers->setChecked(s.value(kDownloadAlbumCovers, true).toBool());
ui_->checkbox_remove_remastered->setChecked(s.value(kRemoveRemastered, true).toBool());
s.endGroup();
@@ -128,6 +129,7 @@ void QobuzSettingsPage::Save() {
s.setValue(kSongsSearchLimit, ui_->songssearchlimit->value());
s.setValue(kBase64Secret, ui_->checkbox_base64_secret->isChecked());
s.setValue(kDownloadAlbumCovers, ui_->checkbox_download_album_covers->isChecked());
s.setValue(kRemoveRemastered, ui_->checkbox_remove_remastered->isChecked());
s.endGroup();
}

View File

@@ -248,6 +248,13 @@
</property>
</widget>
</item>
<item row="9" column="0">
<widget class="QCheckBox" name="checkbox_remove_remastered">
<property name="text">
<string>Remove (Remastered), etc from song titles</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>

View File

@@ -100,6 +100,7 @@ void SpotifySettingsPage::Load() {
ui_->songssearchlimit->setValue(s.value(kSongsSearchLimit, 10).toInt());
ui_->checkbox_fetchalbums->setChecked(s.value(kFetchAlbums, false).toBool());
ui_->checkbox_download_album_covers->setChecked(s.value(kDownloadAlbumCovers, true).toBool());
ui_->checkbox_remove_remastered->setChecked(s.value(kRemoveRemastered, true).toBool());
s.endGroup();
@@ -122,6 +123,7 @@ void SpotifySettingsPage::Save() {
s.setValue(kSongsSearchLimit, ui_->songssearchlimit->value());
s.setValue(kFetchAlbums, ui_->checkbox_fetchalbums->isChecked());
s.setValue(kDownloadAlbumCovers, ui_->checkbox_download_album_covers->isChecked());
s.setValue(kRemoveRemastered, ui_->checkbox_remove_remastered->isChecked());
s.endGroup();
}

View File

@@ -202,6 +202,13 @@
</property>
</widget>
</item>
<item row="6" column="0">
<widget class="QCheckBox" name="checkbox_remove_remastered">
<property name="text">
<string>Remove (Remastered), etc from song titles</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>

View File

@@ -104,6 +104,7 @@ void TidalSettingsPage::Load() {
ComboBoxLoadFromSettings(s, ui_->coversize, QLatin1String(kCoverSize), u"640x640"_s);
ui_->streamurl->setCurrentIndex(ui_->streamurl->findData(s.value(kStreamUrl, static_cast<int>(StreamUrlMethod::StreamUrl)).toInt()));
ui_->checkbox_album_explicit->setChecked(s.value(kAlbumExplicit, false).toBool());
ui_->checkbox_remove_remastered->setChecked(s.value(kRemoveRemastered, true).toBool());
s.endGroup();
if (service_->authenticated()) {
@@ -144,6 +145,7 @@ void TidalSettingsPage::Save() {
s.setValue(kCoverSize, ui_->coversize->currentData().toString());
s.setValue(kStreamUrl, ui_->streamurl->currentData().toInt());
s.setValue(kAlbumExplicit, ui_->checkbox_album_explicit->isChecked());
s.setValue(kRemoveRemastered, ui_->checkbox_remove_remastered->isChecked());
s.endGroup();
}

View File

@@ -172,6 +172,19 @@
</property>
</widget>
</item>
<item row="4" column="1">
<widget class="QSpinBox" name="songssearchlimit">
<property name="minimum">
<number>1</number>
</property>
<property name="maximum">
<number>1000</number>
</property>
<property name="value">
<number>50</number>
</property>
</widget>
</item>
<item row="5" column="0">
<widget class="QCheckBox" name="checkbox_download_album_covers">
<property name="text">
@@ -186,13 +199,6 @@
</property>
</widget>
</item>
<item row="7" column="1">
<widget class="QComboBox" name="coversize">
<property name="currentText">
<string notr="true"/>
</property>
</widget>
</item>
<item row="7" column="0">
<widget class="QLabel" name="label_coversize">
<property name="text">
@@ -200,16 +206,10 @@
</property>
</widget>
</item>
<item row="4" column="1">
<widget class="QSpinBox" name="songssearchlimit">
<property name="minimum">
<number>1</number>
</property>
<property name="maximum">
<number>1000</number>
</property>
<property name="value">
<number>50</number>
<item row="7" column="1">
<widget class="QComboBox" name="coversize">
<property name="currentText">
<string notr="true"/>
</property>
</widget>
</item>
@@ -234,6 +234,13 @@
</property>
</widget>
</item>
<item row="10" column="0">
<widget class="QCheckBox" name="checkbox_remove_remastered">
<property name="text">
<string>Remove (Remastered), etc from song titles</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>

View File

@@ -1115,7 +1115,9 @@ void SpotifyRequest::ParseSong(Song &song, const QJsonObject &json_obj, const Ar
QUrl url(uri);
title = Song::TitleRemoveMisc(title);
if (service_->remove_remastered()) {
title = Song::TitleRemoveMisc(title);
}
song.set_source(Song::Source::Spotify);
song.set_song_id(song_id);

View File

@@ -86,6 +86,7 @@ SpotifyService::SpotifyService(const SharedPtr<TaskManager> task_manager,
songssearchlimit_(1),
fetchalbums_(true),
download_album_covers_(true),
remove_remastered_(true),
pending_search_id_(0),
next_pending_search_id_(1),
pending_search_type_(SearchType::Artists),
@@ -204,6 +205,7 @@ void SpotifyService::ReloadSettings() {
songssearchlimit_ = s.value(SpotifySettings::kSongsSearchLimit, 10).toInt();
fetchalbums_ = s.value(SpotifySettings::kFetchAlbums, false).toBool();
download_album_covers_ = s.value(SpotifySettings::kDownloadAlbumCovers, true).toBool();
remove_remastered_ = s.value(SpotifySettings::kRemoveRemastered, true).toBool();
s.endGroup();

View File

@@ -73,6 +73,7 @@ class SpotifyService : public StreamingService {
int songssearchlimit() const { return songssearchlimit_; }
bool fetchalbums() const { return fetchalbums_; }
bool download_album_covers() const { return download_album_covers_; }
bool remove_remastered() const { return remove_remastered_; }
bool authenticated() const override;
QByteArray authorization_header() const;
@@ -150,6 +151,7 @@ class SpotifyService : public StreamingService {
int songssearchlimit_;
bool fetchalbums_;
bool download_album_covers_;
bool remove_remastered_;
int pending_search_id_;
int next_pending_search_id_;

View File

@@ -1077,7 +1077,9 @@ void TidalRequest::ParseSong(Song &song, const QJsonObject &json_obj, const Arti
}
}
title = Song::TitleRemoveMisc(title);
if (service_->remove_remastered()) {
title = Song::TitleRemoveMisc(title);
}
//qLog(Debug) << "id" << song_id << "track" << track << "disc" << disc << "title" << title << "album" << album << "album artist" << album_artist << "artist" << artist << cover << allow_streaming << url;

View File

@@ -96,6 +96,7 @@ TidalService::TidalService(const SharedPtr<TaskManager> task_manager,
download_album_covers_(true),
stream_url_method_(TidalSettings::StreamUrlMethod::StreamUrl),
album_explicit_(false),
remove_remastered_(true),
pending_search_id_(0),
next_pending_search_id_(1),
pending_search_type_(SearchType::Artists),
@@ -232,7 +233,8 @@ void TidalService::ReloadSettings() {
coversize_ = s.value(TidalSettings::kCoverSize, u"640x640"_s).toString();
download_album_covers_ = s.value(TidalSettings::kDownloadAlbumCovers, true).toBool();
stream_url_method_ = static_cast<TidalSettings::StreamUrlMethod>(s.value(TidalSettings::kStreamUrl, static_cast<int>(TidalSettings::StreamUrlMethod::StreamUrl)).toInt());
album_explicit_ = s.value(TidalSettings::kAlbumExplicit).toBool();
album_explicit_ = s.value(TidalSettings::kAlbumExplicit, false).toBool();
remove_remastered_ = s.value(TidalSettings::kRemoveRemastered, true).toBool();
s.endGroup();
oauth_->set_client_id(client_id_);

View File

@@ -89,6 +89,7 @@ class TidalService : public StreamingService {
bool download_album_covers() const { return download_album_covers_; }
TidalSettings::StreamUrlMethod stream_url_method() const { return stream_url_method_; }
bool album_explicit() const { return album_explicit_; }
bool remove_remastered() const { return remove_remastered_; }
bool authenticated() const override;
QByteArray authorization_header() const;
@@ -171,6 +172,7 @@ class TidalService : public StreamingService {
bool download_album_covers_;
TidalSettings::StreamUrlMethod stream_url_method_;
bool album_explicit_;
bool remove_remastered_;
int pending_search_id_;
int next_pending_search_id_;