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

@@ -25,14 +25,15 @@
const char *MusixmatchProvider::kApiUrl = "https://api.musixmatch.com/ws/1.1";
const char *MusixmatchProvider::kApiKey = "Y2FhMDRlN2Y4OWE5OTIxYmZlOGMzOWQzOGI3ZGU4MjE=";
QString MusixmatchProvider::StringFixup(QString string) {
QString MusixmatchProvider::StringFixup(QString text) {
return string.replace('/', '-')
.replace('\'', '-')
.remove(QRegularExpression("[^\\w0-9\\- ]", QRegularExpression::UseUnicodePropertiesOption))
.simplified()
.replace(' ', '-')
.replace(QRegularExpression("(-)\\1+"), "-")
.toLower();
return text.replace('/', '-')
.replace('\'', '-')
.remove(QRegularExpression("[^\\w0-9\\- ]", QRegularExpression::UseUnicodePropertiesOption))
.replace(QRegularExpression(" {2,}"), " ")
.simplified()
.replace(' ', '-')
.replace(QRegularExpression("(-)\\1+"), "-")
.toLower();
}