-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathutils.js
78 lines (65 loc) · 3.19 KB
/
utils.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
import { config } from 'dotenv/mod.ts'
export const expressURL = config().EXPRESS_URL
export const outputPath = './Output'
export const inputPath = './Input'
export const readSimfile = (target) => {
const decoder = new TextDecoder('utf-8')
const raw = Deno.readFileSync(target)
return decoder.decode(raw)
}
export const template = readSimfile('./template.ssc').toLowerCase()
const [header, chart] = template.split('//')
const splitSectionProps = (section) => section
.split('\n')
.filter(line => line.includes('#'))
.map(line => line
.trim()
.replace(';', '')
.replace('#', '')
)
export const getSectionProps = (section) => splitSectionProps(section)
.map(line => {
const prop = line
.split(':')
const key = prop[0].toLowerCase()
if (!prop[1]) return key
const value = prop.slice(1).join(':')
return { [key]: value }
})
export const [headerProps, chartProps] = [header, chart]
.map(section => getSectionProps(section))
// Edit below this line to use with custom song packs
const constructAlbum = (title, releaseDate, scale = 'DDR', numPanels = 4, albumType = 'arcade') => (
{ title, releaseDate, scale, numPanels, albumType }
)
const constructXScaleAlbum = (title, releaseDate) => constructAlbum(title, releaseDate, 'DDR X')
export const originalScaleAlbums = [
{ title: 'Dance Dance Revolution', releaseDate: '1998-09-26' },
{ title: 'Dance Dance Revolution 2ndMIX', releaseDate: '1999-01-19' },
{ title: 'Dance Dance Revolution 2ndMIX LINK Version', releaseDate: '1999-04-28' },
{ title: 'Dance Dance Revolution 2ndMIX CLUB Version', releaseDate: '1999-04-21' },
{ title: 'Dance Dance Revolution 2ndMIX CLUB Version 2', releaseDate: '1999-07-27' },
{ title: 'Dance Dance Revolution 3rdMIX', releaseDate: '1999-10-30' },
{ title: 'Dance Dance Revolution 3rdMIX PLUS', releaseDate: '2000-06-21' },
{ title: 'Dance Dance Revolution 4thMIX', releaseDate: '2000-08-24' },
{ title: 'Dance Dance Revolution 4thMIX PLUS', releaseDate: '2000-12-28' },
{ title: 'Dance Dance Revolution 5thMIX', releaseDate: '2001-03-27' },
{ title: 'DDRMAX -Dance Dance Revolution 6thMIX-', releaseDate: '2001-10-19' },
{ title: 'DDRMAX2 -Dance Dance Revolution 7thMIX-', releaseDate: '2002-03-27' },
{ title: 'Dance Dance Revolution EXTREME', releaseDate: '2002-12-25' },
{ title: 'Dance Dance Revolution SuperNOVA', releaseDate: '2006-07-12' },
{ title: 'Dance Dance Revolution SuperNOVA2', releaseDate: '2007-08-22' }
].map(({ title, releaseDate }) => constructAlbum(title, new Date(releaseDate)))
export const xScaleAlbums = [
{ title: 'X', releaseDate: '2008-12-24' },
{ title: 'X2', releaseDate: '2010-07-07' },
{ title: 'X3 vs 2ndMIX', releaseDate: '2011-11-16' },
{ title: '2013', releaseDate: '2013-03-14' },
{ title: '2014', releaseDate: '2014-05-12' },
{ title: 'A', releaseDate: '2016-03-30' },
{ title: 'A20', releaseDate: '2019-03-20' }//,
// { title: 'A20 Plus', releaseDate: '2020-07-01' }
]
.map(({ title, releaseDate }) =>
constructXScaleAlbum(`DanceDanceRevolution ${title}`, new Date(releaseDate)))
export const allArcadeAlbums = [...originalScaleAlbums, ...xScaleAlbums]