Commit 063d6835 authored by nanahira's avatar nanahira

add preview parsing

parent b2a967ce
...@@ -17,7 +17,7 @@ const courseTypes = { ...@@ -17,7 +17,7 @@ const courseTypes = {
} }
function get_sql(song) { function get_sql(song) {
return "INSERT INTO songs VALUES("+song.song_id+",'"+song.title+"',NULL,"+(song.subtitle ? "'"+song.subtitle+"'" : "NULL")+",NULL,"+(song.difficulty.easy ? song.difficulty.easy : "NULL")+","+(song.difficulty.normal ? song.difficulty.normal : "NULL")+","+(song.difficulty.hard ? song.difficulty.hard : "NULL")+","+(song.difficulty.oni ? song.difficulty.oni : "NULL")+","+(song.difficulty.ura ? song.difficulty.ura : "NULL")+",1,"+song.category+",'tja',-0.023,NULL);"; return "INSERT INTO songs VALUES(" + song.song_id + ",'" + song.title + "',NULL," + (song.subtitle ? "'" + song.subtitle + "'" : "NULL") + ",NULL," + (song.difficulty.easy ? song.difficulty.easy : "NULL") + "," + (song.difficulty.normal ? song.difficulty.normal : "NULL") + "," + (song.difficulty.hard ? song.difficulty.hard : "NULL") + "," + (song.difficulty.oni ? song.difficulty.oni : "NULL") + "," + (song.difficulty.ura ? song.difficulty.ura : "NULL") + ",1," + song.category + ",'tja',-0.023,NULL," + (song.preview ? song.preview : "NULL") + ",NULL);";
} }
//console.log("Reading: " + fpath); //console.log("Reading: " + fpath);
...@@ -51,6 +51,7 @@ for (var category_raw of category_array) { ...@@ -51,6 +51,7 @@ for (var category_raw of category_array) {
}, },
song_id: song_id, song_id: song_id,
category: category, category: category,
preview: null,
branch: { branch: {
easy: false, easy: false,
normal: false, normal: false,
...@@ -75,6 +76,8 @@ for (var category_raw of category_array) { ...@@ -75,6 +76,8 @@ for (var category_raw of category_array) {
case "subtitle": case "subtitle":
res.subtitle = value.replace("'","''"); res.subtitle = value.replace("'","''");
break; break;
case "demostart":
res.preview = value;
case "course": case "course":
const diff = value.toLowerCase(); const diff = value.toLowerCase();
if(diff in courseTypes){ if(diff in courseTypes){
...@@ -88,7 +91,6 @@ for (var category_raw of category_array) { ...@@ -88,7 +91,6 @@ for (var category_raw of category_array) {
break; break;
} }
} else if (line_.startsWith("#BRANCHSTART")) { } else if (line_.startsWith("#BRANCHSTART")) {
console.log("branch", res.title, courseName);
res.branch[courseName] = true; res.branch[courseName] = true;
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment