X-Git-Url: https://git.sesse.net/?p=ccbs;a=blobdiff_plain;f=parse%2Fparse-ddrfreak-songlist.pl;h=a880275b6f13a9022ebaba1b2568d0a005709580;hp=7c02865f3dd21f6552d7a1db001ccd30aee892e5;hb=8ac6eb68670cae63b150f5e10ad52f6cdbf2733f;hpb=0997a092b47e38af5eedff8e3c5493c55fd6e472 diff --git a/parse/parse-ddrfreak-songlist.pl b/parse/parse-ddrfreak-songlist.pl index 7c02865..a880275 100644 --- a/parse/parse-ddrfreak-songlist.pl +++ b/parse/parse-ddrfreak-songlist.pl @@ -80,12 +80,20 @@ while (<>) { or die "Parse error, line 11"; my $dc = $1; + # Blarg, hack + if ($songname eq 'FANTASY') { + $songname = "$songname ($artist)"; + } + # minimal SQL escaping $songname =~ s/'/\\'/g; $artist =~ s/'/\\'/g; - printf "INSERT INTO songs (title,artist,minbpm,maxbpm) VALUES ('%s','%s',0,0);\n", - $songname, $artist; + # Insert the song only if it doesn't already exist + printf "INSERT INTO songs SELECT nextval('songs_song_seq') AS song, '%s' AS title, '%s' AS artist, 0 AS minbpm, 0 AS maxbpm WHERE '%s' NOT IN ( SELECT title FROM songs );\n", + $songname, $artist, $songname; + printf "INSERT INTO machinesongs SELECT ( SELECT song FROM songs WHERE title='%s' ), ( SELECT machine FROM machines WHERE machinename='%s' );\n", + $songname, $machine; for my $t (['single', 'beginner', $sb], ['single', 'standard', $ss],