Improve lyrics match

This commit is contained in:
Jonas Kvinge
2023-10-08 23:55:05 +02:00
parent 1a07404c10
commit 505329730c
10 changed files with 38 additions and 31 deletions

View File

@@ -43,12 +43,14 @@ QUrl LyricsModeComLyricsProvider::Url(const LyricsSearchRequest &request) {
}
QString LyricsModeComLyricsProvider::StringFixup(QString string) {
QString LyricsModeComLyricsProvider::StringFixup(QString text) {
return string
.replace(' ', '_')
.remove(QRegularExpression("[^\\w0-9_-]", QRegularExpression::UseUnicodePropertiesOption))
return text
.remove(QRegularExpression("[^\\w0-9_\\- ]"))
.replace(QRegularExpression(" {2,}"), " ")
.simplified()
.replace(' ', '_')
.replace('-', '_')
.toLower();
}