X-Git-Url: https://diplodocus.org/git/flac-archive/blobdiff_plain/3c7d23bc411654d2964b81af85b94b8f7f293436..1f9496c729e649cedae547ce6e3de04b052bb5e7:/fa-flacd diff --git a/fa-flacd b/fa-flacd index 371f20b..37e79a0 100755 --- a/fa-flacd +++ b/fa-flacd @@ -12,7 +12,7 @@ B [B<-jv>] B -B ID TRACKCOUNT OFFSET [OFFSET ...] LENGTH +B I =cut @@ -70,6 +70,7 @@ sub flac { my $artist; my $album; my @tags; + my $outfile; my $status; verbose("Renaming $dir/tags\n"); @@ -84,8 +85,16 @@ sub flac { verbose("chdir($dir)\n"); chdir($dir) or die("chdir($dir): $!"); + $outfile = "$album"; + for ($outfile) { + s/\//_/g; + s/:/_/g; + s/'/_/g; + s/"/_/g; + } + verbose("Running flac\n"); - $status = system('flac', '-o', "../$artist/$album.flac-tmp", + $status = system('flac', '-o', "../$artist/$outfile.flac-tmp", '--delete-input-file', '-V', '--cuesheet', 'cue', '--no-padding', '--best', map({ ('-T', $_) } @tags), @@ -101,15 +110,15 @@ sub flac { verbose("Cleaning up $dir\n"); unlink('using-tags') or die("unlink(using-tags): $!"); unlink('cue') or die("unlink(cue): $!"); - rename('toc', "../$artist/$album.toc") - or die("rename(toc, ../$artist/$album.toc): $!"); - rename('log', "../$artist/$album.log") - or die("rename(log, ../$artist/$album.log): $!"); + rename('toc', "../$artist/$outfile.toc") + or die("rename(toc, ../$artist/$outfile.toc): $!"); + rename('log', "../$artist/$outfile.log") + or die("rename(log, ../$artist/$outfile.log): $!"); chdir('..') or die("chdir(..): $!"); rmdir($dir) or die("rmdir($dir): $!"); - rename("$artist/$album.flac-tmp", "$artist/$album.flac") - or die("rename($artist/$album.flac-tmp, $artist/$album.flac): $!"); + rename("$artist/$outfile.flac-tmp", "$artist/$outfile.flac") + or die("rename($artist/$outfile.flac-tmp, $artist/$outfile.flac): $!"); return 0; } @@ -117,7 +126,7 @@ sub flac { sub reaper { my $pid; - while (($pid = waitpid(0, WNOHANG)) > 0) { + while (($pid = waitpid(-1, WNOHANG)) > 0) { push(@finished, [$pid, $?]); } @@ -196,7 +205,7 @@ MAIN: { $opts{'j'} = 4; $opts{'v'} = 0; if (not getopts('j:v', \%opts)) { - print("usage: flacd [-jN -v]\n"); + print(STDERR "usage: flacd [-jN -v]\n"); exit(2); } @@ -271,11 +280,6 @@ B requires the number of tracks as its sole argument. =over 4 -=item CDDBURL - -B uses this to retrieve candidate Vorbis tags. Defaults to -"http://freedb.freedb.org/~cddb/cddb.cgi". - =item CDDEV B uses this to rip audio and save the cuesheet for a CD. It