Improve regex for removing Disc # from album title

This commit is contained in:
Jonas Kvinge 2018-03-13 17:48:25 +01:00
parent 0022264757
commit 74bc2e0684
2 changed files with 5 additions and 3 deletions

View File

@ -31,6 +31,7 @@
#include <QMenu>
#include <QUrl>
#include <QMimeData>
#include <QRegExp>
#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);

View File

@ -21,6 +21,7 @@
#include "config.h"
#include <QTimer>
#include <QRegExp>
#include <QDebug>
#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;