beginning to create a lyric parser
This commit is contained in:
parent
bbdd837b50
commit
e4768b44be
3 changed files with 31 additions and 4 deletions
|
@ -194,7 +194,7 @@ ColumnLayout {
|
||||||
|
|
||||||
if (type == "song") {
|
if (type == "song") {
|
||||||
const lyrics = songsqlmodel.getLyricList(itemID);
|
const lyrics = songsqlmodel.getLyricList(itemID);
|
||||||
print(lyrics);
|
/* print(lyrics); */
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -184,7 +184,6 @@ Item {
|
||||||
editorTimer.running = false;
|
editorTimer.running = false;
|
||||||
}
|
}
|
||||||
onPressed: editorTimer.running = true
|
onPressed: editorTimer.running = true
|
||||||
/* Component.onCompleted: text = songsqlmodel.getLyrics(songIndex); */
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Controls.TextField {
|
Controls.TextField {
|
||||||
|
|
|
@ -141,10 +141,38 @@ QStringList SongSqlModel::getLyricList(const int &row) {
|
||||||
return empty;
|
return empty;
|
||||||
}
|
}
|
||||||
|
|
||||||
QString rawLyrics = recordData.value("lyrics").toString();
|
QStringList rawLyrics = recordData.value("lyrics").toString().split("\n");
|
||||||
qDebug() << rawLyrics;
|
qDebug() << rawLyrics;
|
||||||
|
|
||||||
QStringList lyrics = rawLyrics.split("\n");
|
QStringList lyrics;
|
||||||
|
qDebug() << lyrics;
|
||||||
|
|
||||||
|
QStringList vorder = recordData.value("vorder").toString().split(" ");
|
||||||
|
qDebug() << vorder;
|
||||||
|
|
||||||
|
int startIndex;
|
||||||
|
int endIndex;
|
||||||
|
QString line;
|
||||||
|
QString 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;
|
qDebug() << lyrics;
|
||||||
|
|
||||||
return lyrics;
|
return lyrics;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue