Improve album and title disc, remastered, etc matching

Don't partial remove things like "(Mono / Remastered)".

Fixes #1387
This commit is contained in:
Jonas Kvinge
2024-03-02 19:48:19 +01:00
parent b365131363
commit 7f4c61b15a
14 changed files with 96 additions and 42 deletions

View File

@@ -123,9 +123,10 @@ class Song {
static const QString kFtsBindSpec;
static const QString kFtsUpdateSpec;
static const QRegularExpression kAlbumRemoveDisc;
static const QRegularExpression kAlbumRemoveMisc;
static const QRegularExpression kTitleRemoveMisc;
using RegularExpressionList = QList<QRegularExpression>;
static const RegularExpressionList kAlbumDisc;
static const RegularExpressionList kAlbumMisc;
static const RegularExpressionList kTitleMisc;
static const QStringList kArticles;
@@ -443,6 +444,14 @@ class Song {
// It is more efficient to use IsOnSameAlbum, but this function can be used when you need to hash the key to do fast lookups.
QString AlbumKey() const;
static bool ContainsRegexList(const QString &str, const RegularExpressionList &regex_list);
static QString StripRegexList(QString str, const RegularExpressionList &regex_list);
static bool AlbumContainsDisc(const QString &album);
static QString AlbumRemoveDisc(const QString &album);
static QString AlbumRemoveMisc(const QString &album);
static QString AlbumRemoveDiscMisc(const QString &album);
static QString TitleRemoveMisc(const QString &title);
private:
struct Private;