X-Git-Url: https://git.sesse.net/?p=ccbs;a=blobdiff_plain;f=parse%2Fparse-wiki-songlist.pl;h=5a35d67a51fe69e711e7c038bbeb876b0a22ca5f;hp=49934c84d4327a005fed9fce9a86d228d1108c19;hb=d660a4666bdc97237f19a8d1d3afbb137c753691;hpb=a24b59a81c140c475c5ecfd195e562cf67e5b607 diff --git a/parse/parse-wiki-songlist.pl b/parse/parse-wiki-songlist.pl index 49934c8..5a35d67 100644 --- a/parse/parse-wiki-songlist.pl +++ b/parse/parse-wiki-songlist.pl @@ -4,11 +4,13 @@ use warnings; # Parses songlist from the DDRNO wiki +print "begin;\n"; + 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 @@ -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); @@ -46,5 +48,6 @@ while (<>) { 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";