Commit fde04e3c authored by nanahira's avatar nanahira

finish

parent 9eed3194
const fs = require('fs'); const fs = require('fs');
const sqlite3 = require('sqlite3').verbose(); //const sqlite3 = require('sqlite3').verbose();
//const iconv = require('iconv-lite'); //const iconv = require('iconv-lite');
//const convert = require('encoding').convert //const convert = require('encoding').convert
const dbfile = process.argv[3];
const fpath = process.argv[2]; const fpath = process.argv[2];
var all_songs = []; var all_songs = [];
...@@ -17,6 +16,10 @@ const courseTypes = { ...@@ -17,6 +16,10 @@ const courseTypes = {
"edit": "ura" "edit": "ura"
} }
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.0,NULL);";
}
//console.log("Reading: " + fpath); //console.log("Reading: " + fpath);
const category_array = fs.readdirSync(fpath); const category_array = fs.readdirSync(fpath);
...@@ -79,4 +82,6 @@ for (var category_raw of category_array) { ...@@ -79,4 +82,6 @@ for (var category_raw of category_array) {
} }
} }
console.log(JSON.stringify(all_songs, null, 2)) for (var song of all_songs) {
console.log(get_sql(song));
}
This diff is collapsed.
...@@ -22,7 +22,6 @@ ...@@ -22,7 +22,6 @@
}, },
"homepage": "https://github.com/purerosefallen/taiko-db-writer#readme", "homepage": "https://github.com/purerosefallen/taiko-db-writer#readme",
"dependencies": { "dependencies": {
"fs": "0.0.1-security", "fs": "0.0.1-security"
"sqlite3": "^4.0.6"
} }
} }
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