]> git.sesse.net Git - ccbs/blobdiff - parse/parse-wiki-songlist.pl
Let each screen get width and height in as a parameter on draw() instead of hardcodin...
[ccbs] / parse / parse-wiki-songlist.pl
index 3f1311839bb9cc2ea88b28584002956e174fa602..4303c2d39bdf31a504e2e7f33f1935d4a7ee0d8c 100644 (file)
@@ -2,6 +2,9 @@
 use strict;
 use warnings;
 
 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";
 # Parses songlist from the DDRNO wiki
 
 print "begin;\n";
@@ -10,7 +13,7 @@ while (<>) {
        m/
          \|   \s* \[\[ (.*?) \]\] \s*    # song name
           \|\| \s* \[\[ (.*?) \]\] \s*    # artist
        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 
          \|\| \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]) {
                    ['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];
        }
 }
 
        }
 }