adding keywords to try to base finding place off that

This commit is contained in:
Chris Cochrun 2022-03-25 16:43:37 -05:00
parent 9bd6adb2f3
commit fe32ccc3bb

View file

@ -145,47 +145,58 @@ QStringList SongSqlModel::getLyricList(const int &row) {
qDebug() << rawLyrics;
QStringList lyrics;
qDebug() << lyrics;
// qDebug() << lyrics;
QStringList vorder = recordData.value("vorder").toString().split(" ");
qDebug() << vorder;
int startIndex;
int endIndex;
QString line;
QStringList keywords = {"Verse 1", "Verse 2", "Verse 3", "Verse 4",
"Verse 5", "Verse 6", "Verse 7", "Verse 8",
"Chorus 1", "Chorus 2", "Chorus 3", "Chorus 4",
"Bridge 1", "Bridge 2", "Bridge 3", "Bridge 4",
"Intro 1", "Outro 2", "Ending 1", "Other 1"};
foreach (const QString &vstr, vorder) {
int startIndex;
QString verse;
qDebug() << vorder.contains("C1");
qDebug() << vorder.indexOf("C1");
foreach (QString vstr, vorder) {
qDebug() << vstr;
foreach (line, rawLyrics) {
if (keywords.contains(line)) {
if (line.startsWith(vstr.at(0)) && line.endsWith(vstr.at(1))) {
qDebug() << line;
qDebug() << vstr << line;
startIndex = rawLyrics.indexOf(line);
}
if (rawLyrics.indexOf(line) > startIndex)
verse.append(line + "\n");
}
}
foreach (line, rawLyrics) {
if (line.trimmed() == "Chorus 1") {
startIndex = rawLyrics.indexOf(line) + 1;
// qDebug() << line;
// qDebug() << startIndex;
}
if (line.trimmed() == "Verse 1") {
endIndex = rawLyrics.indexOf(line);
// qDebug() << endIndex;
break;
}
if (rawLyrics.indexOf(line) == startIndex - 1) {
continue;
}
verse.append(line + "\n");
qDebug() << "Break out";
break;
}
qDebug() << line;
// verse.append(line + "\n");
// qDebug() << verse;
}
// lyrics.append(verse);
// qDebug() << verse;
}
// foreach (line, rawLyrics) {
// if (line.trimmed() == "Chorus 1") {
// startIndex = rawLyrics.indexOf(line) + 1;
// // qDebug() << line;
// // qDebug() << startIndex;
// }
// if (line.trimmed() == "Verse 1") {
// endIndex = rawLyrics.indexOf(line);
// // qDebug() << endIndex;
// break;
// }
// if (rawLyrics.indexOf(line) == startIndex - 1) {
// continue;
// }
// verse.append(line + "\n");
// // qDebug() << verse;
// }
lyrics.append(verse);
qDebug() << lyrics;
return lyrics;
}