3 # Do a real or test burn of a CD
5 require './burner-lib.pl';
7 $profile = &get_profile($in{'id'});
8 &can_use_profile($profile) || &error($text{'edit_ecannot'});
14 elsif ($in{'audio'}) {
15 system("rm -rf $in{'audio'} >/dev/null 2>&1");
20 if ($profile->{'type'} != 4) {
21 if ($in{'iso'} && !-r $in{'iso'}) {
22 &error(&text('burn_egone', "edit_profile.cgi?id=$profile->{'id'}"));
24 elsif ($in{'audio'} && !-d $in{'audio'}) {
25 &error(&text('burn_egone2', "edit_profile.cgi?id=$profile->{'id'}"));
30 &ui_print_unbuffered_header(undef, $text{'burn_title'}, "");
33 &ui_print_header(undef, $text{'burn_title'}, "");
36 if ($profile->{'type'} == 4) {
38 $cdrtemp = $config{'temp'} ? "$config{'temp'}/burner.bin"
39 : &tempname("burner.bin");
40 if ($in{'second_step'}) {
41 # Writing out a copied CD
42 $cmd = "$config{'cdrdao'} write --device $config{'dev'}";
43 $cmd .= " --speed $config{'speed'}";
44 $cmd .= " --eject" if ($in{'eject'});
45 $cmd .= " --driver $profile->{'dstdrv'}"
46 if ($profile->{'dstdrv'});
47 $cmd .= " $cdrtemp.toc";
48 $cmd .= " ; rm -f $cdrtemp $cdrtemp.toc";
50 elsif ($profile->{'sdev'} eq $config{'dev'}) {
51 # Using same drive .. need to create .toc and .bin files first
52 $cmd = "$config{'cdrdao'} read-cd --device $config{'dev'} --datafile $cdrtemp --eject";
53 $cmd .= " --driver $profile->{'srcdrv'}"
54 if ($profile->{'srcdrv'});
55 $cmd .= " $cdrtemp.toc";
59 # Copying from one drive to another
60 $cmd = "$config{'cdrdao'} copy --device $config{'dev'} --source-device $profile->{'sdev'}";
61 if ($profile->{'fly'}) {
62 $cmd .= " --on-the-fly";
65 $cmd .= " --datafile $cdrtemp";
67 $cmd .= " --speed $config{'speed'}";
68 $cmd .= " --eject" if ($in{'eject'});
69 $cmd .= " --driver $profile->{'dstdrv'}"
70 if ($profile->{'dstdrv'});
71 $cmd .= " --source-driver $profile->{'srcdrv'}"
72 if ($profile->{'srcdrv'});
77 $cmd = "$config{'cdrecord'} -v dev=$config{'dev'} speed=$config{'speed'}";
78 $cmd .= " $config{'extra'}" if ($config{'extra'});
79 $cmd .= " -dummy" if ($in{'test'});
80 $cmd .= " -eject" if ($in{'eject'} && !$in{'test'});
81 $cmd .= " -isosize" if ($profile->{'isosize'});
82 $cmd .= " blank=$in{'blank'}" if ($in{'blank'});
83 $cmd .= " '$in{'iso'}'";
87 $cmd = "$config{'cdrecord'} -v dev=$config{'dev'} speed=$config{'speed'}";
88 $cmd .= " -dummy" if ($in{'test'});
89 $cmd .= " -eject" if ($in{'eject'} && !$in{'test'});
90 $cmd .= " -audio -swab -pad $in{'audio'}/*.raw";
93 if ($in{'bg'} && !$second_step) {
96 close(STDIN); close(STDOUT); close(STDERR);
97 system("$cmd >/dev/null 2>&1 </dev/null");
103 system("rm -rf $in{'audio'} >/dev/null 2>&1");
108 print "<b>",&text($in{'test'} ? 'burn_theader2' : 'burn_header2',
109 "<tt>$cmd</tt>"),"</b><p>\n";
112 # Run command and show output
113 print "<b>",&text($in{'test'} ? 'burn_theader' : 'burn_header',
114 "<tt>$cmd</tt>"),"</b><br>\n";
116 &foreign_require("proc", "proc-lib.pl");
117 &foreign_call("proc", "safe_process_exec", $cmd, 0, 0, STDOUT,
126 system("rm -rf $in{'audio'} >/dev/null 2>&1");
129 if ($second_step && !$rv) {
130 # Show button to write out data
131 print "<center><form action=burn.cgi>\n";
132 print "$text{'burn_seconddesc'}<p>\n";
133 print "<input type=submit name=second_step ",
134 "value='$text{'burn_second'}'>\n";
135 foreach $k (keys %in) {
136 print "<input type=hidden name=$k value='$in{$k}'>\n";
138 print "</form></center>\n";
142 &ui_print_footer("edit_profile.cgi?id=$profile->{'id'}", $text{'edit_return'},
143 "", $text{'index_return'});