5 # Parses songlist from the DDRNO wiki
9 \| \s* \[\[ (.*?) \]\] \s* # song name
10 \|\| \s* \[\[ (.*?) \]\] \s* # artist
11 \|\| \s* (\d+(-\d+)?) \s* # bpm
12 \|\| \s* (\d+) \s* # single beginner
13 \|\| \s* (\d+) \s* # single standard
14 \|\| \s* (\d+) \s* # single difficult
15 \|\| \s* (\d+) \s* # single expert
17 \|\| \s* (\d+) \s* # double standard
18 \|\| \s* (\d+) \s* # double difficult
19 \|\| \s* (\d+) \s* # double expert
22 my ($songname, $artist, $minbpm, $maxbpm, $sb, $ss, $sd, $se, $ds, $dd, $de) =
23 ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11);
25 # fix some wikisyntax ickyness :-)
29 # minimal SQL escaping
30 $songname =~ s/'/\'/g;
33 $maxbpm = $minbpm if (!defined($maxbpm));
34 ($maxbpm,$minbpm) = ($minbpm,$maxbpm) if ($maxbpm < $minbpm);
36 printf "INSERT INTO songs (title,artist,minbpm,maxbpm) VALUES ('%s','%s',%u,%u);\n",
37 $songname, $artist, $minbpm, $maxbpm;
39 for my $t (['single', 'beginner', $sb],
40 ['single', 'standard', $ss],
41 ['single', 'difficulty', $sd],
42 ['single', 'expert', $se],
43 ['double', 'standard', $ds],
44 ['double', 'difficulty', $dd],
45 ['double', 'expert', $de]) {
46 printf "INSERT INTO songratings (song,playmode,difficulty,feetrating) VALUES ((SELECT song FROM songs WHERE title='%s'),'%s','%s',%u);\n",
47 $songname, $t->[0], $t->[1], $t->[2];