From 74bc2e0684e136f6e9cf0586ef5d8f060df1a9db Mon Sep 17 00:00:00 2001 From: Jonas Kvinge Date: Tue, 13 Mar 2018 17:48:25 +0100 Subject: [PATCH] Improve regex for removing Disc # from album title --- src/covermanager/albumcoverchoicecontroller.cpp | 3 ++- src/covermanager/albumcoverfetcher.cpp | 5 +++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/covermanager/albumcoverchoicecontroller.cpp b/src/covermanager/albumcoverchoicecontroller.cpp index f5e62458c..f4cede4b0 100644 --- a/src/covermanager/albumcoverchoicecontroller.cpp +++ b/src/covermanager/albumcoverchoicecontroller.cpp @@ -31,6 +31,7 @@ #include #include #include +#include #include "covermanager/albumcoverchoicecontroller.h" @@ -171,7 +172,7 @@ QString AlbumCoverChoiceController::LoadCoverFromURL(Song *song) { QString AlbumCoverChoiceController::SearchForCover(Song *song) { QString album = song->effective_album(); - album = album.remove(QRegExp(" ?-? ?(\\(|\\[)(Disc|CD)? ?[0-9](\\)|\\])$")); + album = album.remove(QRegExp(" ?-? ((\\(|\\[)?)(Disc|CD) ?([0-9]{1,2})((\\)|\\])?)$")); // Get something sensible to stick in the search box QImage image = cover_searcher_->Exec(song->effective_albumartist(), album); diff --git a/src/covermanager/albumcoverfetcher.cpp b/src/covermanager/albumcoverfetcher.cpp index 674f885ef..e7e01fc7b 100644 --- a/src/covermanager/albumcoverfetcher.cpp +++ b/src/covermanager/albumcoverfetcher.cpp @@ -21,6 +21,7 @@ #include "config.h" #include +#include #include #include "albumcoverfetcher.h" @@ -43,7 +44,7 @@ AlbumCoverFetcher::AlbumCoverFetcher(CoverProviders *cover_providers, QObject *p quint64 AlbumCoverFetcher::FetchAlbumCover(const QString &artist, const QString &album) { QString album2(album); - album2 = album2.remove(QRegExp(" ?-? ?(\\(|\\[)(Disc|CD)? ?[0-9](\\)|\\])$")); + album2 = album2.remove(QRegExp(" ?-? ((\\(|\\[)?)(Disc|CD) ?([0-9]{1,2})((\\)|\\])?)$")); CoverSearchRequest request; request.artist = artist; @@ -61,7 +62,7 @@ quint64 AlbumCoverFetcher::SearchForCovers(const QString &artist, const QString fetchall_ = false; QString album2(album); - album2 = album2.remove(QRegExp(" ?-? ?(\\(|\\[)(Disc|CD)? ?[0-9](\\)|\\])$")); + album2 = album2.remove(QRegExp(" ?-? ((\\(|\\[)?)(Disc|CD) ?([0-9]{1,2})((\\)|\\])?)$")); CoverSearchRequest request; request.artist = artist;