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