wav2dao.pl
上传用户:weiliju62
上传日期:2007-01-06
资源大小:619k
文件大小:2k
- #!/usr/bin/perl
- use strict 'subs';
- use strict 'refs';
- @dev = ('--device', '/dev/pg0:0,0');
- sub help {
- print "Syntax: $0 [-H] [options] audiofilesn";
- print <<"EOF" ;
- Use cdrdao on the wav audio file arguments, making an appropriate toc file.
- -d cdrw Use cdrw as the CDRW device (default: $dev[1]).
- -o file Output the toc file on this file - do not use a temporary file.
- -p Perform a 'print-size' cdrdao command.
- -i Perform a 'toc-info' cdrdao command.
- -c Perform a 'show-toc' cdrdao command.
- -t Perform a 'read-test' cdrdao command.
- -w Write the CD in DAO mode (default, if no other action is specified).
- -s Simulate writing only ('simulate' instead of 'write' command).
- -j Do not eject the CD after writing it.
- -n Print the cdrdao commands, instead of executing them.
- EOF
- }
- require 'getopts.pl';
- &Getopts('o:pictwsjnH');
- if ($opt_H) { &help ; exit }
- $dev[1] = $opt_d if $opt_d;
- $opt_w = 1 unless $opt_p || $opt_i || $opt_c || $opt_t || $opt_w || $opt_s || $opt_o ne "";
- die "Usage: $0 [options] audiofiles" unless @ARGV;
- $fname = $opt_o ne "" ? $opt_o : "/tmp/toc$$";
- open(F, "> $fname") || die "open($fname): $!, stopped";
- print F "CD_DAn";
- foreach (@ARGV) {
- print F "nTRACK AUDIOnNO COPYn";
- # print F "NO PRE_EMPHASISnTWO_CHANNEL_AUDIOn";
- print F "FILE "$_" 0n";
- # print F "START 00:02:00n" if $no++;
- }
- close F;
- if ($opt_p) {
- if ($opt_n) { print "cdrdao print-size $fnamen" }
- else { system 'cdrdao', 'print-size', $fname}
- }
- if ($opt_i) {
- if ($opt_n) { print "cdrdao toc-info $fnamen" }
- else { system 'cdrdao', 'toc-info', $fname}
- }
- if ($opt_c) {
- if ($opt_n) { print "cdrdao show-toc $fnamen" }
- else { system 'cdrdao', 'show-toc', $fname}
- }
- if ($opt_t) {
- if ($opt_n) { print "cdrdao read-test $fnamen" }
- else { system 'cdrdao', 'read-test', $fname}
- }
- if ($opt_w || $opt_s) {
- unshift @dev, $opt_s ? 'simulate' : 'write';
- push @dev, '--eject' unless $opt_s || $opt_j;
- push @dev, $fname;
- if ($opt_n) { print "cdrdao @devn" } else { system 'cdrdao', @dev }
- }
- unlink $fname unless $opt_o ne "";
- __END__