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
1b2d8f92
Commit
1b2d8f92
authored
Feb 20, 2021
by
nanahira
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
rewrite
parent
91a62fd6
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
33 additions
and
41 deletions
+33
-41
index.js
index.js
+33
-41
No files found.
index.js
View file @
1b2d8f92
...
...
@@ -20,14 +20,14 @@ const courseTypes = {
async
function
main
()
{
const
category_array
=
await
fs
.
promises
.
readdir
(
fpath
);
for
(
let
category_raw
of
category_array
)
{
for
(
let
category_raw
of
category_array
)
{
const
category
=
parseInt
(
category_raw
);
if
(
isNaN
(
category
))
continue
;
const
category_path
=
fpath
+
"
/
"
+
category
;
//console.log("Reading: " + category_path);
const
songs
=
await
fs
.
promises
.
readdir
(
category_path
);
for
(
let
song_raw
of
songs
)
{
for
(
let
song_raw
of
songs
)
{
const
song_id
=
parseInt
(
song_raw
);
if
(
isNaN
(
song_id
))
continue
;
...
...
@@ -43,7 +43,22 @@ async function main() {
//const tja_text = encoded_buf.toString('utf8');
const
tja_lines
=
tja_text
.
split
(
"
\n
"
);
let
res
=
{
skin_id
:
null
,
title
:
null
,
category_id
:
category
,
enabled
:
true
,
type
:
"
tja
"
,
courses
:
{
easy
:
null
,
normal
:
null
,
hard
:
null
,
oni
:
null
,
ura
:
null
,
},
volume
:
1
,
id
:
song_id
,
preview
:
null
,
order
:
song_id
,
title_lang
:
{
ja
:
null
,
en
:
null
,
...
...
@@ -51,6 +66,9 @@ async function main() {
tw
:
null
,
ko
:
null
},
hash
:
tja_hash
,
offset
:
process
.
env
.
OFFSET
?
parseFloat
(
process
.
env
.
OFFSET
)
:
-
0.023
,
maker_id
:
process
.
env
.
MAKER
?
parseFloat
(
process
.
env
.
MAKER
)
:
null
,
subtitle
:
null
,
subtitle_lang
:
{
ja
:
null
,
...
...
@@ -59,31 +77,11 @@ async function main() {
tw
:
null
,
ko
:
null
},
courses
:
{
easy
:
null
,
normal
:
null
,
hard
:
null
,
oni
:
null
,
ura
:
null
,
},
id
:
song_id
,
category_id
:
category
,
type
:
"
tja
"
,
enabled
:
true
,
preview
:
null
,
branch
:
{
easy
:
false
,
normal
:
false
,
hard
:
false
,
oni
:
false
,
ura
:
false
,
},
hash
:
tja_hash
}
let
courseName
=
"
oni
"
;
for
(
let
line
of
tja_lines
)
{
for
(
let
line
of
tja_lines
)
{
const
line_
=
line
.
trim
();
if
(
line_
.
indexOf
(
"
:
"
)
>
0
)
{
if
(
line_
.
indexOf
(
"
:
"
)
>
0
)
{
//const line__ = convert(line_, "UTF-8", "SHIFT-JIS").toString('utf8');
const
temp
=
line_
.
split
(
"
:
"
);
const
key
=
temp
[
0
].
toLowerCase
();
...
...
@@ -91,36 +89,30 @@ async function main() {
//console.log("Find value: " + key +" --> " + value);
switch
(
key
)
{
case
"
title
"
:
res
.
title
=
value
.
replace
(
"
'
"
,
"
''
"
)
;
res
.
title
=
value
;
break
;
case
"
subtitle
"
:
res
.
subtitle
=
value
.
replace
(
"
'
"
,
"
''
"
)
;
res
.
subtitle
=
value
;
break
;
case
"
demostart
"
:
res
.
preview
=
value
;
res
.
preview
=
parseFloat
(
volume
)
;
case
"
course
"
:
const
diff
=
value
.
toLowerCase
();
if
(
diff
in
courseTypes
)
{
if
(
diff
in
courseTypes
)
{
courseName
=
courseTypes
[
diff
];
}
else
{
}
else
{
courseName
=
diff
;
}
break
;
case
"
level
"
:
res
.
courses
[
courseName
]
=
value
;
case
"
level
"
:
res
.
courses
[
courseName
]
=
{
stars
:
parseInt
(
value
),
branch
:
false
};
break
;
}
}
else
if
(
line_
.
startsWith
(
"
#BRANCHSTART
"
))
{
res
.
branch
[
courseName
]
=
true
;
}
}
for
(
let
diff
of
[
"
easy
"
,
"
normal
"
,
"
hard
"
,
"
oni
"
,
"
ura
"
])
{
if
(
res
.
courses
[
diff
])
{
if
(
res
.
branch
[
diff
])
{
res
.
courses
[
diff
]
=
"
'
"
+
res
.
courses
[
diff
]
+
"
B'
"
;
}
else
{
res
.
courses
[
diff
]
=
"
'
"
+
res
.
courses
[
diff
]
+
"
'
"
;
}
res
.
courses
[
courseName
].
branch
=
true
;
}
}
all_songs
.
push
(
res
);
...
...
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