From 9152f8559f911ba0d30b0bae7e06aedf0046e923 Mon Sep 17 00:00:00 2001 From: Jonas Kvinge Date: Sun, 3 Mar 2024 01:50:05 +0100 Subject: [PATCH] Song: Split remastered and explicit regex --- src/core/song.cpp | 20 ++++++++++++++------ src/core/song.h | 2 ++ 2 files changed, 16 insertions(+), 6 deletions(-) diff --git a/src/core/song.cpp b/src/core/song.cpp index 97123d4e..9ee713f6 100644 --- a/src/core/song.cpp +++ b/src/core/song.cpp @@ -172,15 +172,23 @@ const Song::RegularExpressionList Song::kAlbumDisc = Song::RegularExpressionList << QRegularExpression("\\s+-*\\s*\\(\\s*(Disc|CD)\\s*([0-9]{1,2})\\)$", QRegularExpression::CaseInsensitiveOption) << QRegularExpression("\\s+-*\\s*\\[\\s*(Disc|CD)\\s*([0-9]{1,2})\\]$", QRegularExpression::CaseInsensitiveOption); +const Song::RegularExpressionList Song::kRemastered = Song::RegularExpressionList() + << QRegularExpression("\\s+-*\\s*(([0-9]{4})*\\s*Remastered|([0-9]{4})*\\s*Remaster)\\s*(Version)*\\s*$", QRegularExpression::CaseInsensitiveOption) + << QRegularExpression("\\s+-*\\s*\\(\\s*(([0-9]{4})*\\s*Remastered|([0-9]{4})*\\s*Remaster)\\s*(Version)*\\s*\\)\\s*$", QRegularExpression::CaseInsensitiveOption) + << QRegularExpression("\\s+-*\\s*\\[\\s*(([0-9]{4})*\\s*Remastered|([0-9]{4})*\\s*Remaster)\\s*(Version)*\\s*\\]\\s*$", QRegularExpression::CaseInsensitiveOption); + +const Song::RegularExpressionList Song::kExplicit = Song::RegularExpressionList() + << QRegularExpression("\\s+-*\\s*Explicit\\s*$", QRegularExpression::CaseInsensitiveOption) + << QRegularExpression("\\s+-*\\s*\\(\\s*Explicit\\s*\\)\\s*$", QRegularExpression::CaseInsensitiveOption) + << QRegularExpression("\\s+-*\\s*\\[\\s*Explicit\\s*\\]\\s*$", QRegularExpression::CaseInsensitiveOption); + const Song::RegularExpressionList Song::kAlbumMisc = Song::RegularExpressionList() - << QRegularExpression("\\s+-*\\s*(Remastered|([0-9]{1,4})\\s*Remaster|Explicit)\\s*$", QRegularExpression::CaseInsensitiveOption) - << QRegularExpression("\\s+-*\\s*\\(\\s*(Remastered|([0-9]{1,4})\\s*Remaster|Explicit)\\s*\\)\\s*$", QRegularExpression::CaseInsensitiveOption) - << QRegularExpression("\\s+-*\\s*\\[\\s*(Remastered|([0-9]{1,4})\\s*Remaster|Explicit)\\s*\\]\\s*$", QRegularExpression::CaseInsensitiveOption); + << kRemastered + << kExplicit; const Song::RegularExpressionList Song::kTitleMisc = Song::RegularExpressionList() - << QRegularExpression("\\s+-*\\s*(Remastered|Remastered Version|([0-9]{1,4})\\s*Remaster)\\s*$", QRegularExpression::CaseInsensitiveOption) - << QRegularExpression("\\s+-*\\s*\\(\\s*(Remastered|Remastered Version|([0-9]{1,4})\\s*Remaster)\\s*\\)\\s*$", QRegularExpression::CaseInsensitiveOption) - << QRegularExpression("\\s+-*\\s*\\[\\s*(Remastered|Remastered Version|([0-9]{1,4})\\s*Remaster)\\s*\\]\\s*$", QRegularExpression::CaseInsensitiveOption); + << kRemastered + << kExplicit; const QStringList Song::kArticles = QStringList() << "the " << "a " << "an "; diff --git a/src/core/song.h b/src/core/song.h index 8fcc2ea6..1c328347 100644 --- a/src/core/song.h +++ b/src/core/song.h @@ -125,6 +125,8 @@ class Song { using RegularExpressionList = QList; static const RegularExpressionList kAlbumDisc; + static const RegularExpressionList kRemastered; + static const RegularExpressionList kExplicit; static const RegularExpressionList kAlbumMisc; static const RegularExpressionList kTitleMisc;