#!/usr/bin/perl -w ###################################### # Hacburn-0.1.5 # # Perl/tk tool for writing cd's # # There's no license on this software# # because it sucks ;) # # # # author: hacnslash@binrev.com # ###################################### use Tk; use Tk::FileDialog; use Tk::Checkbutton; use Tk::ProgressBar; $mw = MainWindow->new; $mw->title('my_burner.pl'); $mw->geometry("460x240"); $mw->Button( -width => 9 , - text => 'burn' , -command => sub{burn(), size()} ) ->place(-x=>1, -y=>1); $mw->Button( -width => 9 , - text => 'eject cd' , -command => sub{eject()} ) ->place(-x=>90, -y=>1); $mw->Button( -width => 9 , - text => 'load cd' , -command => sub{load()} ) ->place(-x=>180, -y=>1); $mw->Button( -width => 9 , - text => 'blank rw' , -command => sub{blank()} ) ->place(-x=>270, -y=>1); $mw->Button( -width => 9 , - text => 'exit' , -command => sub{exit} ) ->place(-x=>360, -y=>1); $mw->Button( -width => 9 , - text => 'file for iso', -command => sub{fileselect()} ) ->place(-x=>1, -y=>30); $mw->Button( -width => 9 , - text => 'save iso' , -command => sub{filesave()} ) ->place(-x=>90, -y=>30); $mw->Button( -width => 9 , - text => 'make iso' , -command => sub{mkisofs()} ) ->place(-x=>180, -y=>30); $mw->Button( -width => 9 , - text => 'select iso' , -command => sub{isoselect()} ) ->place(-x=>270, -y=>30); $mw->Button( -width => 9 , - text => 'help' , -command => sub{help()} ) ->place(-x=>360, -y=>30); $mw->Entry( - width => 42 , - textvariable => \$dev ) ->place(-x=>1, -y=>60); $mw->Label( - text =>'writer device (/dev/hdx/)') ->place(-x=>305, -y=>60); $mw->Entry( - width => 42 , - textvariable => \$iso ) ->place(-x=>1, -y=>80); $mw->Label( - text =>'iso image to be written') ->place(-x=>305, -y=>80); $mw->Entry( - width => 42 , - textvariable => \$file) ->place(-x=>1, -y=>100); $mw->Label( - text =>'file to be iso`d') ->place(-x=>305, -y=>100); $mw->Entry( - width => 42 , - textvariable => \$file_save ) ->place(-x=>1, -y=>120); $mw->Label( - text =>'save the iso as') ->place(-x=>305, -y=>120); $mw->Entry( - width => 42 , - textvariable => \$speed ) ->place(-x=>1, -y=>140); $mw->Label( - text =>'burn speed') ->place(-x=>305, -y=>140); $chk1 = $mw->Checkbutton( - text =>'data cd' , - variable => \$data , command => sub {clear_button2()}) ->place(-x=> 1, -y=>162); $chk2 = $mw->Checkbutton( - text =>'audio cd' , command => sub {clear_button1()}) ->place(-x=> 1, -y=>182); $chk3 = $mw->Checkbutton( - text =>'blank all' , - variable => \$all , command => sub {clear_button4()}) ->place(-x=> 80, -y=>162); $chk4 = $mw->Checkbutton( - text =>'blank fast' , - variable => \$fast , command => sub {clear_button3()}) ->place(-x=> 80, -y=>182); $mw->Checkbutton( - text =>'eject when done' , -offvalue => ' ' , - onvalue => '-eject' , - variable => \$eject) ->place(-x=> 160, -y=>162); $progress = $mw->ProgressBar( -width => 20, -length => 460, -from => 0, -to => 100, -blocks => 100, -troughcolor=>'white', -colors => [0, 'green'], -variable =>\$percent )->pack(-side =>'bottom'); resume: MainLoop; sub size { sleep (9); if ($speed == 1) { $est_speed = 153600; } if ($speed == 2) { $est_speed = 307200; } if ($speed == 3) { $est_speed = 460800; } if ($speed == 4) { $est_speed = 614400; } if ($speed == 6) { $est_speed = 921600; } if ($speed == 8) { $est_speed = 1228800; } if ($speed == 10) { $est_speed = 1536000; } if ($speed == 12) { $est_speed = 1843200; } if ($speed == 16) { $est_speed = 2457600; } if ($speed == 18) { $est_speed = 2764800; } if ($speed == 24) { $est_speed = 3686400; } if ($speed == 32) { $est_speed = 4915200; } $iso_size = -s $iso; $total = $iso_size; $iso_size2 = $iso_size; while ($iso_size2 > 0 ) { $iso_size2 = $iso_size2 - $est_speed; $m = -100 / $total; $n = 100; $percent = $m * $iso_size2 + $n; print "$percent\n"; $progress->update(); sleep(1); } } sub burn { if ($data == 1) { system ('cdrecord ' . '-v- ' . $eject . ' ' . 'speed=' . $speed . ' ' . 'dev=' . $dev . ' ' . '-data '. $iso); } } sub blank { if ($all == 1) { system ('cdrecord ' . 'dev=' . $dev . ' ' . 'blank=all'); } if ($fast == 1) { system ('cdrecord ' . 'dev=' . $dev . ' ' . 'blank=fast'); } } sub eject { if ($dev eq '') { print "insert a device (/dev/hdx)\n"; goto resume; } else { system ('eject ' . $dev); } } sub load { if ($dev eq '') { print "insert a device (/dev/hdx)\n"; goto resume; } else { system ('eject ' . '-t ' . $dev) } } sub isoselect { $iso = $mw->FileDialog()->Show; } sub fileselect { $file = $mw->FileDialog()->Show; } sub filesave { $file_save = $mw->FileDialog()->Show; } sub mkisofs { system ('mkisofs -o ' . $file_save . ' ' . $file); } sub help { $help = $mw->Toplevel(-title => "Help"); $help_text = $help->Text(-height => "18", -width => "57", -wrap => "word")->pack; $help_text->insert('end' , 'The usage of this script is fairly intuitive. You can figure it out on your own what the buttons do. There are no command line arguments since its a tk script. Other than that, i really dont have any other suggestions, except do NOT input a higher write speed than what your drive/disc supports since i dont know if it will mess anything up, im not gonna try it out anyway. Also make sure to input the device and the write speed and the other info BEFORE clicking burn. You have to use this script with the 2.6 kernel to be able to input /dev/hdx for the device, if not then youre stuck with a 0.1.0 type of deal. If you find any problems, or have any questions: hacnslash@binrev.com' ); $help->Button(-text => "Close Window" , -command => sub { $help->withdraw })->place(-x=>1, -y=>200); $help->Button(-text => "About" , -command => sub {about()})->place(-x=>150, -y=>200); } sub about { $about = $mw->Toplevel(-title => "about info"); $about->geometry("429x103"); $about->Label( - text =>"This is a cdrecord/mkisofs/mpg123 gui for linux.") ->place(-x=>1, -y=>10); $about->Label( - text =>"It was written by Hacnslash for personal use..but you can use it too :)") ->place(-x=>1, -y=>30); $about->Label( - text =>"December 28th, 2003") ->place(-x=>1, -y=>50); $about->Button(-text => "Close Window" , -command => sub { $about->withdraw })->place(-x=>1, -y=>70); } sub clear_button1 { $chk1->deselect; $music = $mw->Toplevel(-title => "burn music disc"); $music->geometry("780x300"); $progress2 = $music->ProgressBar( -width => 20, -length => 800, -from => 0, -to => 734003200, -blocks => 1000, -troughcolor=>'white', -colors => [0, 'green'], -variable =>\$percent_ofcd )->pack(-side =>'bottom'); $music->Label( - text =>'1') ->place(-x=>1, -y=>40); $music->Label( - text =>'2') ->place(-x=>1, -y=>60); $music->Label( - text =>'3') ->place(-x=>1, -y=>80); $music->Label( - text =>'4') ->place(-x=>1, -y=>100); $music->Label( - text =>'5') ->place(-x=>1, -y=>120); $music->Label( - text =>'6') ->place(-x=>1, -y=>140); $music->Label( - text =>'7') ->place(-x=>1, -y=>160); $music->Label( - text =>'8') ->place(-x=>1, -y=>180); $music->Label( - text =>'9') ->place(-x=>1, -y=>200); $music->Label( - text =>'10') ->place(-x=>1, -y=>220); $music->Label( - text =>'11') ->place(-x=>383, -y=>40); $music->Label( - text =>'12') ->place(-x=>383, -y=>60); $music->Label( - text =>'13') ->place(-x=>383, -y=>80); $music->Label( - text =>'14') ->place(-x=>383, -y=>100); $music->Label( - text =>'15') ->place(-x=>383, -y=>120); $music->Label( - text =>'16') ->place(-x=>383, -y=>140); $music->Label( - text =>'17') ->place(-x=>383, -y=>160); $music->Label( - text =>'18') ->place(-x=>383, -y=>180); $music->Label( - text =>'19') ->place(-x=>383, -y=>200); $music->Label( - text =>'20') ->place(-x=>383, -y=>220); $music->Button( -width => 5 , - text => 'file', -command => sub{musicfileselect()} ) ->place(-x=>310, -y=>40); $music->Button( -width => 5 , - text => 'file', -command => sub{musicfileselect1()} ) ->place(-x=>310, -y=>60); $music->Button( -width => 5 , - text => 'file', -command => sub{musicfileselect2()} ) ->place(-x=>310, -y=>80); $music->Button( -width => 5 , - text => 'file', -command => sub{musicfileselect3()} ) ->place(-x=>310, -y=>100); $music->Button( -width => 5 , - text => 'file', -command => sub{musicfileselect4()} ) ->place(-x=>310, -y=>120); $music->Button( -width => 5 , - text => 'file', -command => sub{musicfileselect5()} ) ->place(-x=>310, -y=>140); $music->Button( -width => 5 , - text => 'file', -command => sub{musicfileselect6()} ) ->place(-x=>310, -y=>160); $music->Button( -width => 5 , - text => 'file', -command => sub{musicfileselect7()} ) ->place(-x=>310, -y=>180); $music->Button( -width => 5 , - text => 'file', -command => sub{musicfileselect8()} ) ->place(-x=>310, -y=>200); $music->Button( -width => 5 , - text => 'file', -command => sub{musicfileselect9()} ) ->place(-x=>310, -y=>220); $music->Button( -width => 5 , - text => 'file', -command => sub{musicfileselect10()} ) ->place(-x=>690, -y=>40); $music->Button( -width => 5 , - text => 'file', -command => sub{musicfileselect11()} ) ->place(-x=>690, -y=>60); $music->Button( -width => 5 , - text => 'file', -command => sub{musicfileselect12()} ) ->place(-x=>690, -y=>80); $music->Button( -width => 5 , - text => 'file', -command => sub{musicfileselect13()} ) ->place(-x=>690, -y=>100); $music->Button( -width => 5 , - text => 'file', -command => sub{musicfileselect14()} ) ->place(-x=>690, -y=>120); $music->Button( -width => 5 , - text => 'file', -command => sub{musicfileselect15()} ) ->place(-x=>690, -y=>140); $music->Button( -width => 5 , - text => 'file', -command => sub{musicfileselect16()} ) ->place(-x=>690, -y=>160); $music->Button( -width => 5 , - text => 'file', -command => sub{musicfileselect17()} ) ->place(-x=>690, -y=>180); $music->Button( -width => 5 , - text => 'file', -command => sub{musicfileselect18()} ) ->place(-x=>690, -y=>200); $music->Button( -width => 5 , - text => 'file', -command => sub{musicfileselect19()} ) ->place(-x=>690, -y=>220); $m1 = $music->Entry( - width => 40 , - textvariable => \$file1 ) ->place(-x=>18, -y=>40); $m2 = $music->Entry( - width => 40 , - textvariable => \$file2 ) ->place(-x=>18, -y=>60); $m3 = $music->Entry( - width => 40 , - textvariable => \$file3 ) ->place(-x=>18, -y=>80); $m4 = $music->Entry( - width => 40 , - textvariable => \$file4 ) ->place(-x=>18, -y=>100); $m5 = $music->Entry( - width => 40 , - textvariable => \$file5 ) ->place(-x=>18, -y=>120); $m6 = $music->Entry( - width => 40 , - textvariable => \$file6 ) ->place(-x=>18, -y=>140); $m7 = $music->Entry( - width => 40 , - textvariable => \$file7 ) ->place(-x=>18, -y=>160); $m8 = $music->Entry( - width => 40 , - textvariable => \$file8 ) ->place(-x=>18, -y=>180); $m9 = $music->Entry( - width => 40 , - textvariable => \$file9 ) ->place(-x=>18, -y=>200); $m10 = $music->Entry( - width => 40 , - textvariable => \$file10 ) ->place(-x=>18, -y=>220); $m11 = $music->Entry( - width => 40 , - textvariable => \$file11 ) ->place(-x=>400, -y=>40); $m12 = $music->Entry( - width => 40 , - textvariable => \$file12 ) ->place(-x=>400, -y=>60); $m13 = $music->Entry( - width => 40 , - textvariable => \$file13 ) ->place(-x=>400, -y=>80); $m14 = $music->Entry( - width => 40 , - textvariable => \$file14 ) ->place(-x=>400, -y=>100); $m15 = $music->Entry( - width => 40 , - textvariable => \$file15 ) ->place(-x=>400, -y=>120); $m16 = $music->Entry( - width => 40 , - textvariable => \$file16 ) ->place(-x=>400, -y=>140); $m17 = $music->Entry( - width => 40 , - textvariable => \$file17 ) ->place(-x=>400, -y=>160); $m18 = $music->Entry( - width => 40 , - textvariable => \$file18 ) ->place(-x=>400, -y=>180); $m19 = $music->Entry( - width => 40 , - textvariable => \$file19 ) ->place(-x=>400, -y=>200); $m20 = $music->Entry( - width => 40 , - textvariable => \$file20 ) ->place(-x=>400, -y=>220); $music->Button( -width => 20 , - text => 'Burn audio disc', -command => sub{musicburn()} ) ->place(-x=>18, -y=>7); $music->Button( -width => 20 , - text => 'Convert to .cdr', -command => sub{musicconvert()} ) ->place(-x=>190, -y=>7); } sub musicconvert { foreach $var ($file1, $file2, $file3, $file4, $file5, $file6, $file7, $file8, $file9, $file10, $file11, $file12, $file13, $file14, $file15, $file16, $file17, $file18, $file19, $file20) { system ('mpg123 ' . '--cdr ' . '- ' . $var . ' > ' . $var . '.cdr'); } foreach $var1 ($file1, $file2, $file3, $file4, $file5, $file6, $file7, $file8, $file9, $file10, $file11, $file12, $file13, $file14, $file15, $file16, $file17, $file18, $file19, $file20) { $var1 = $var1 . ".cdr"; } $ext1 = ".mp3"; $ext2 = ".cdr"; foreach $var2 ($file1, $file2, $file3, $file4, $file5, $file6, $file7, $file8, $file9, $file10, $file11, $file12, $file13, $file14, $file15, $file16, $file17, $file18, $file19, $file20) { unless ($var2 =~ /(?<=$ext1)$ext2/) { $var2 =~ s/.cdr//; } } foreach $var3 ($m1, $m2, $m3, $m4, $m5, $m6, $m7, $m8, $m9, $m10, $m11, $m12, $m13, $m14, $m15, $m16, $m17, $m18, $m19, $m20) { $var3->update(); } $progress2->update(); } sub musicburn { system ('cdrecord ' . '-v ' . $eject . 'speed=' . $speed . ' dev=' . $dev . ' -dao' . ' -pad' . ' -audio ' . $file1 . ' ' . $file2 . ' ' . $file3 . ' ' . $file4 . ' ' . $file5 . ' ' . $file6 . ' ' . $file7 . ' ' . $file8 . ' ' . $file9 . ' ' . $file10 . ' ' . $file11 . ' ' . $file12 . ' ' . $file13 . ' ' . $file14 . ' ' . $file15 . ' ' . $file16 . ' ' . $file17 . ' ' . $file18 . ' ' . $file19 . ' ' . $file20); system ('rm ' . $file1 . ' ' . $file2 . ' ' . $file3 . ' ' . $file4 . ' ' . $file5 . ' ' . $file6 . ' ' . $file7 . ' ' . $file8 . ' ' . $file9 . ' ' . $file10 . ' ' . $file11 . ' ' . $file12 . ' ' . $file13 . ' ' . $file14 . ' ' . $file15 . ' ' . $file16 . ' ' . $file17 . ' ' . $file18 . ' ' . $file19 . ' ' . $file20); } sub clear_button2 { $chk2->deselect; } sub clear_button3 { $chk3->deselect; } sub clear_button4 { $chk4->deselect; } sub musicfileselect { $file1 = $music-> FileDialog() -> Show;$fsize1 = -s $file1; $fsize1 = $fsize1 * 10; $percent_ofcd = $fsize1; $progress2->update(); } sub musicfileselect1 { $file2 = $music-> FileDialog() -> Show;$fsize2 = -s $file2; $fsize2 = $fsize2 * 10; $percent_ofcd = $fsize1 + $fsize2; $progress2->update(); } sub musicfileselect2 { $file3 = $music-> FileDialog() -> Show;$fsize3 = -s $file3; $fsize3 = $fsize3 * 10; $percent_ofcd = $fsize1 + $fsize2 + $fsize3; $progress2->update(); } sub musicfileselect3 { $file4 = $music-> FileDialog() -> Show;$fsize4 = -s $file4; $fsize4 = $fsize4 * 10; $percent_ofcd = $fsize1 + $fsize2 + $fsize3 + $fsize4;$progress2->update(); } sub musicfileselect4 { $file5 = $music-> FileDialog() -> Show;$fsize5 = -s $file5; $fsize5 = $fsize5 * 10; $percent_ofcd = $fsize1 + $fsize2 + $fsize3 + $fsize4 + $fsize5;$progress2->update(); } sub musicfileselect5 { $file6 = $music-> FileDialog() -> Show;$fsize6 = -s $file6; $fsize6 = $fsize6 * 10; $percent_ofcd = $fsize1 + $fsize2 + $fsize3 + $fsize4 + $fsize5 + $fsize6;$progress2->update(); } sub musicfileselect6 { $file7 = $music-> FileDialog() -> Show;$fsize7 = -s $file7; $fsize7 = $fsize7 * 10; $percent_ofcd = $fsize1 + $fsize2 + $fsize3 + $fsize4 + $fsize5 + $fsize6 + $fsize7;$progress2->update(); } sub musicfileselect7 { $file8 = $music-> FileDialog() -> Show;$fsize8 = -s $file8; $fsize8 = $fsize8 * 10; $percent_ofcd = $fsize1 + $fsize2 + $fsize3 + $fsize4 + $fsize5 + $fsize6 + $fsize7 + $fsize8;$progress2->update(); } sub musicfileselect8 { $file9 = $music-> FileDialog() -> Show;$fsize9 = -s $file9; $fsize9 = $fsize9 * 10; $percent_ofcd = $fsize1 + $fsize2 + $fsize3 + $fsize4 + $fsize5 + $fsize6 + $fsize7 + $fsize8 + $fsize9;$progress2->update(); } sub musicfileselect9 { $file10 = $music-> FileDialog() -> Show;$fsize10 = -s $file10; $fsize10 = $fsize10 * 10; $percent_ofcd = $fsize1 + $fsize2 + $fsize3 + $fsize4 + $fsize5 + $fsize6 + $fsize7 + $fsize8 + $fsize9 + $fsize10;$progress2->update(); } sub musicfileselect10 { $file11 = $music-> FileDialog() -> Show;$fsize11 = -s $file11; $fsize11 = $fsize11 * 10; $percent_ofcd = $fsize1 + $fsize2 + $fsize3 + $fsize4 + $fsize5 + $fsize6 + $fsize7 + $fsize8 + $fsize9 + $fsize10 + $fsize11;$progress2->update(); } sub musicfileselect11 { $file12 = $music-> FileDialog() -> Show;$fsize12 = -s $file12; $fsize12 = $fsize12 * 10; $percent_ofcd = $fsize1 + $fsize2 + $fsize3 + $fsize4 + $fsize5 + $fsize6 + $fsize7 + $fsize8 + $fsize9 + $fsize10 + $fsize11 + $fsize12;$progress2->update(); } sub musicfileselect12 { $file13 = $music-> FileDialog() -> Show;$fsize13 = -s $file13; $fsize13 = $fsize13 * 10; $percent_ofcd = $fsize1 + $fsize2 + $fsize3 + $fsize4 + $fsize5 + $fsize6 + $fsize7 + $fsize8 + $fsize9 + $fsize10 + $fsize11 + $fsize12 + $fsize13;$progress2->update(); } sub musicfileselect13 { $file14 = $music-> FileDialog() -> Show;$fsize14 = -s $file14; $fsize14 = $fsize14 * 10; $percent_ofcd = $fsize1 + $fsize2 + $fsize3 + $fsize4 + $fsize5 + $fsize6 + $fsize7 + $fsize8 + $fsize9 + $fsize10 + $fsize11 + $fsize12 + $fsize13 + $fsize14;$progress2->update(); } sub musicfileselect14 { $file15 = $music-> FileDialog() -> Show;$fsize15 = -s $file15; $fsize15 = $fsize15 * 10; $percent_ofcd = $fsize1 + $fsize2 + $fsize3 + $fsize4 + $fsize5 + $fsize6 + $fsize7 + $fsize8 + $fsize9 + $fsize10 + $fsize11 + $fsize12 + $fsize13 + $fsize14 + $fsize15;$progress2->update(); } sub musicfileselect15 { $file16 = $music-> FileDialog() -> Show;$fsize16 = -s $file16; $fsize16 = $fsize16 * 10; $percent_ofcd = $fsize1 + $fsize2 + $fsize3 + $fsize4 + $fsize5 + $fsize6 + $fsize7 + $fsize8 + $fsize9 + $fsize10 + $fsize11 + $fsize12 + $fsize13 + $fsize14 + $fsize15 + $fsize16;$progress2->update(); } sub musicfileselect16 { $file17 = $music-> FileDialog() -> Show;$fsize17 = -s $file17; $fsize17 = $fsize17 * 10; $percent_ofcd = $fsize1 + $fsize2 + $fsize3 + $fsize4 + $fsize5 + $fsize6 + $fsize7 + $fsize8 + $fsize9 + $fsize10 + $fsize11 + $fsize12 + $fsize13 + $fsize14 + $fsize15 + $fsize16 + $fsize17;$progress2->update(); } sub musicfileselect17 { $file18 = $music-> FileDialog() -> Show;$fsize18 = -s $file18; $fsize18 = $fsize18 * 10; $percent_ofcd = $fsize1 + $fsize2 + $fsize3 + $fsize4 + $fsize5 + $fsize6 + $fsize7 + $fsize8 + $fsize9 + $fsize10 + $fsize11 + $fsize12 + $fsize13 + $fsize14 + $fsize15 + $fsize16 + $fsize17 + $fsize18;$progress2->update(); } sub musicfileselect18 { $file19 = $music-> FileDialog() -> Show;$fsize19 = -s $file19; $fsize19 = $fsize19 * 10; $percent_ofcd = $fsize1 + $fsize2 + $fsize3 + $fsize4 + $fsize5 + $fsize6 + $fsize7 + $fsize8 + $fsize9 + $fsize10 + $fsize11 + $fsize12 + $fsize13 + $fsize14 + $fsize15 + $fsize16 + $fsize17 + $fsize18 + $fsize19;$progress2->update(); } sub musicfileselect19 { $file20 = $music-> FileDialog() -> Show;$fsize20 = -s $file20; $fsize20 = $fsize20 * 10; $percent_ofcd = $fsize1 + $fsize2 + $fsize3 + $fsize4 + $fsize5 + $fsize6 + $fsize7 + $fsize8 + $fsize9 + $fsize10 + $fsize11 + $fsize12 + $fsize13 + $fsize14 + $fsize15 + $fsize16 + $fsize17 + $fsize18 + $fsize19 + $fsize20;$progress2->update(); }