X-Git-Url: https://git.sesse.net/?p=ccbs;a=blobdiff_plain;f=parse%2Fparse-wiki-songlist.pl;h=4303c2d39bdf31a504e2e7f33f1935d4a7ee0d8c;hp=3f1311839bb9cc2ea88b28584002956e174fa602;hb=09ae4d8636130d4c86ab3f8df8f823482f948f97;hpb=606aed7e01531ba0273139b69bc445b9f9bdf053 diff --git a/parse/parse-wiki-songlist.pl b/parse/parse-wiki-songlist.pl index 3f13118..4303c2d 100644 --- a/parse/parse-wiki-songlist.pl +++ b/parse/parse-wiki-songlist.pl @@ -2,6 +2,9 @@ use strict; use warnings; +my $machine = shift; +die "Missing machine (first argument on the command line)" if (!defined($machine)); + # Parses songlist from the DDRNO wiki print "begin;\n"; @@ -10,7 +13,7 @@ while (<>) { m/ \| \s* \[\[ (.*?) \]\] \s* # song name \|\| \s* \[\[ (.*?) \]\] \s* # artist - \|\| \s* (\d+(-\d+)?) \s* # bpm + \|\| \s* (\d+(?:-(\d+))?) \s* # bpm \|\| \s* (\d+) \s* # single beginner \|\| \s* (\d+) \s* # single standard \|\| \s* (\d+) \s* # single difficult @@ -45,8 +48,8 @@ while (<>) { ['double', 'standard', $ds], ['double', 'difficult', $dd], ['double', 'expert', $de]) { - printf "INSERT INTO songratings (song,playmode,difficulty,feetrating) VALUES ((SELECT song FROM songs WHERE title='%s'),'%s','%s',%u);\n", - $songname, $t->[0], $t->[1], $t->[2]; + printf "INSERT INTO songratings (song,machine,playmode,difficulty,feetrating) VALUES ((SELECT song FROM songs WHERE title='%s'),(SELECT machine FROM machines WHERE machinename='%s'),'%s','%s',%u);\n", + $songname, $machine, $t->[0], $t->[1], $t->[2]; } }