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