X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=parse%2Fparse-wiki-songlist.pl;h=3f1311839bb9cc2ea88b28584002956e174fa602;hb=606aed7e01531ba0273139b69bc445b9f9bdf053;hp=bfd4ccfb6a44e6f7a15a06c956912615bea0f4aa;hpb=5c5d48e56dcc7014a265bc61cd54378fad401c40;p=ccbs diff --git a/parse/parse-wiki-songlist.pl b/parse/parse-wiki-songlist.pl index bfd4ccf..3f13118 100644 --- a/parse/parse-wiki-songlist.pl +++ b/parse/parse-wiki-songlist.pl @@ -4,6 +4,8 @@ use warnings; # Parses songlist from the DDRNO wiki +print "begin;\n"; + while (<>) { m/ \| \s* \[\[ (.*?) \]\] \s* # song name @@ -27,8 +29,8 @@ while (<>) { $artist =~ s/\[\[//g; # minimal SQL escaping - $songname =~ s/'/\'/g; - $artist =~ s/'/\'/g; + $songname =~ s/'/\\'/g; + $artist =~ s/'/\\'/g; $maxbpm = $minbpm if (!defined($maxbpm)); ($maxbpm,$minbpm) = ($minbpm,$maxbpm) if ($maxbpm < $minbpm); @@ -38,13 +40,14 @@ while (<>) { for my $t (['single', 'beginner', $sb], ['single', 'standard', $ss], - ['single', 'difficulty', $sd], + ['single', 'difficult', $sd], ['single', 'expert', $se], ['double', 'standard', $ds], - ['double', 'difficulty', $dd], + ['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 "commit;\n";