Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
T
taiko-db-writer
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Packages
Packages
List
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issues
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nanahira
taiko-db-writer
Commits
e9de83f7
Commit
e9de83f7
authored
Jan 27, 2019
by
nanahira
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
unfinished
parent
915b8b2b
Changes
2
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
1900 additions
and
0 deletions
+1900
-0
index.js
index.js
+82
-0
test.txt
test.txt
+1818
-0
No files found.
index.js
0 → 100644
View file @
e9de83f7
const
fs
=
require
(
'
fs
'
);
const
sqlite3
=
require
(
'
sqlite3
'
).
verbose
();
//const iconv = require('iconv-lite');
const
convert
=
require
(
'
encoding
'
).
convert
const
dbfile
=
process
.
argv
[
3
];
const
fpath
=
process
.
argv
[
2
];
var
all_songs
=
[];
const
courseTypes
=
{
"
0
"
:
"
easy
"
,
"
1
"
:
"
normal
"
,
"
2
"
:
"
hard
"
,
"
3
"
:
"
oni
"
,
"
4
"
:
"
ura
"
,
"
edit
"
:
"
ura
"
}
//console.log("Reading: " + fpath);
const
category_array
=
fs
.
readdirSync
(
fpath
);
for
(
var
category_raw
of
category_array
)
{
const
category
=
parseInt
(
category_raw
);
const
category_path
=
fpath
+
"
/
"
+
category
;
//console.log("Reading: " + category_path);
const
songs
=
fs
.
readdirSync
(
category_path
);
for
(
var
song_raw
of
songs
)
{
const
song_id
=
parseInt
(
song_raw
);
const
tja_path
=
category_path
+
"
/
"
+
song_id
+
"
/main.tja
"
//console.log("Reading: " + tja_path);
const
tja_text
=
fs
.
readFileSync
(
tja_path
,
{
encoding
:
"
utf8
"
})
//var buf = Buffer.from(tja_base64, "base64");
//var encoded_buf = convert(buf, "UTF-8", "SHIFT-JIS");
//const tja_text = encoded_buf.toString('utf8');
const
tja_lines
=
tja_text
.
split
(
"
\n
"
);
var
res
=
{
difficulty
:
{
easy
:
null
,
normal
:
null
,
hard
:
null
,
oni
:
null
,
ura
:
null
,
},
song_id
:
song_id
,
category
:
category
}
var
courseName
=
"
oni
"
;
for
(
var
line
of
tja_lines
)
{
if
(
line
.
indexOf
(
"
:
"
)
>
0
)
{
const
line_
=
line
.
trim
();
const
line__
=
convert
(
line_
,
"
UTF-8
"
,
"
SHIFT-JIS
"
).
toString
(
'
utf8
'
);
const
temp
=
line__
.
split
(
"
:
"
);
const
key
=
temp
[
0
].
toLowerCase
();
const
value
=
temp
[
1
];
//console.log("Find value: " + key +" --> " + value);
switch
(
key
)
{
case
"
title
"
:
res
.
title
=
value
;
break
;
case
"
subtitle
"
:
res
.
subtitle
=
value
;
break
;
case
"
course
"
:
const
diff
=
value
.
toLowerCase
();
if
(
diff
in
courseTypes
){
courseName
=
courseTypes
[
diff
];
}
else
{
courseName
=
diff
;
}
break
;
case
"
level
"
:
res
.
difficulty
[
courseName
]
=
parseInt
(
value
);
break
;
}
}
}
all_songs
.
push
(
res
);
}
}
console
.
log
(
JSON
.
stringify
(
all_songs
,
null
,
2
))
test.txt
0 → 100644
View file @
e9de83f7
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment