home *** CD-ROM | disk | FTP | other *** search
/ Geek 6 / Geek-006.iso / linux / cds / CDR-Toaster / cdrtoaster-1.02.tgz / cdrtoaster-1.02.tar / usr / local / bin / cdrtoaster
Text File  |  1999-09-20  |  27KB  |  928 lines

  1. #!/usr/bin/wish
  2. proc interface {} {
  3.  
  4. wm title . "CDR Toaster"
  5.  
  6. label .title -text {CDR Toaster} -font -*-times-bold-r-*-*-30-*-*-*-*-*-*-*
  7.  
  8. frame .b -border 3 -relief raised
  9. button .b.burn -text {Have a Cook-Off}
  10.  
  11. set m .b.trick.m
  12. menubutton .b.trick -text {Do Tricks} -menu $m -relief raised -border 2
  13. menu $m -tearoff 0
  14. $m add command -label "Read CDROM to create ISO image" -command read_iso
  15. $m add command -label "Read audio tracks from CDROM" -command read_audio
  16. $m add command -label "Blank a CDRW Media" -command blank_cdrw
  17.  
  18. button .b.quit -text {Never Mind}
  19.  
  20. set m .b.help.m
  21. menubutton .b.help -text {Get Help!} -menu $m -relief raised -border 2
  22. menu $m -tearoff 0
  23. $m add command -label "About" -command help
  24. $m add command -label "Clarifications" -command help_clarify
  25.  
  26. frame .audio
  27. label .audio.la -text {Audio Track List} 
  28. frame .audio.f -border 3 -relief sunken 
  29. listbox .audio.f.lb -height 16 -width 30 -selectmode browse  -yscrollcommand {.audio.f.sb set}
  30. scrollbar .audio.f.sb -orient v -command {.audio.f.lb yview}
  31. frame .audio.m
  32. button .audio.m.up -text {Move up} -command {
  33.  set num [.audio.f.lb curselection]
  34.  if {""==$num} return
  35.  if {$num==0} return
  36.  flip $num
  37.  incr num -1
  38.  .audio.f.lb selection set $num
  39.  .audio.f.lb see $num
  40. }
  41. button .audio.m.dn -text {Move Down} -command {
  42.  set num [.audio.f.lb curselection]
  43.  if {""==$num} return
  44.  incr num 1
  45.  if {$num==[.audio.f.lb index end]} return
  46.  flip $num
  47.  .audio.f.lb selection set $num
  48.  .audio.f.lb see $num
  49. }
  50. frame .audio.ar -relief flat 
  51. button .audio.ar.add -text {Add} -command {
  52. audio_add
  53. }
  54. button .audio.ar.rem -text {Remove} -command {
  55. audio_remove
  56. }
  57. button .audio.remall -text {Remove All} -command audio_removeall
  58.  
  59. label .lds -text "Data Track Source"
  60.  
  61. frame .ds -border 3 -relief sunken 
  62. radiobutton .ds.none -text {Make audio-only disk} -variable {ds} -value none
  63. radiobutton .ds.mk -text {Make data track on the fly} -variable {ds} -value mkisofs
  64. radiobutton .ds.pre -text {Use pre-made data track} -variable {ds} -value premade
  65. entry .ds.tname -width 20 -font 7x14
  66. .ds.tname insert 0 "image.iso"
  67.  
  68. label .lm -text {Data Track Creation Options}
  69. frame .m -border 3 -relief sunken
  70.  
  71. frame .m.scan
  72. checkbutton .m.scan.all -text {All files (keep backups etc.)} -variable {all}
  73. checkbutton .m.scan.links -text {Follow SymLinks} -variable {follow}
  74.  
  75. frame .m.file
  76. checkbutton .m.file.joliet -text {Joliet support} -variable {joliet}
  77. checkbutton .m.file.trans -text {Translation Tables (old)} -variable {trans}
  78.  
  79. frame .m.rock -border 0 -relief flat 
  80. label .m.rock.l -text {Rock Ridge:}
  81. radiobutton .m.rock.none -text {None} -variable {rock} -value none
  82. radiobutton .m.rock.rational -text {Rationalized} -variable {rock} -value rat
  83. radiobutton .m.rock.literal -text {Literal} -variable {rock} -value lit
  84.  
  85. frame .m.volid -border 0
  86. label .m.volid.l -text {Volume ID}
  87. entry .m.volid.e -width 32 -font 7x14
  88. frame .m.root -border 0 -relief flat
  89. label .m.root.l -text {Root of Tree}
  90. entry .m.root.e -width 24 -font 7x14
  91. button .m.root.p -text "Peruse" -command {
  92.  peruse
  93.  .m.root.e delete 0 end
  94.  .m.root.e insert 0 $perused
  95. }
  96.  
  97. frame .m.boot
  98. checkbutton .m.boot.check -text "El Torito Bootable CD" -variable boot
  99. button .m.boot.opts -text "Boot Setup" -command boot_setup
  100.  
  101. label .lc -text {cdrecord options} 
  102. frame .c -border 3 -relief sunken
  103. frame .c.flag
  104. checkbutton .c.flag.dummy -text {Dummy Burn} -variable {dummy}
  105. checkbutton .c.flag.eject -text {Eject when done} -variable {eject}
  106. button .c.flag.pad -text "Padding..." -command padbox
  107. frame .c.dev -border 0 -relief flat 
  108. label .c.dev.l -text {Device} 
  109. entry .c.dev.e -width 20 -font 7x14 
  110. frame .c.speed
  111. label .c.speed.l -text "Speed:"
  112. radiobutton .c.speed.1 -text "1x" -variable speed -value 1
  113. radiobutton .c.speed.2 -text "2x" -variable speed -value 2
  114. radiobutton .c.speed.4 -text "4x" -variable speed -value 4
  115. radiobutton .c.speed.6 -text "6x" -variable speed -value 6
  116. radiobutton .c.speed.8 -text "8x" -variable speed -value 8
  117.  
  118. pack .title -side top
  119. pack .b -side top -ipadx 30 -ipady 10
  120. pack .b.burn -side left -expand 1
  121. pack .b.trick -side left -expand 1 -ipady 1 -ipadx 1
  122. pack .b.quit -side left -expand 1
  123. pack .b.help -side left -expand 1
  124. pack .audio -side right -anchor n
  125. pack .audio.la -side top
  126. pack .audio.f -side top
  127. pack .audio.f.lb -side left
  128. pack .audio.f.sb -side left -fill y
  129. pack .audio.m -side top
  130. pack .audio.m.up -side left
  131. pack .audio.m.dn -side left
  132. pack .audio.ar -side top
  133. pack .audio.ar.add -side left
  134. pack .audio.ar.rem -side left
  135. pack .audio.remall -side top
  136. pack .lds -side top
  137. pack .ds -side top -padx 5
  138. pack .ds.none -side bottom -anchor w
  139. pack .ds.mk -side bottom -anchor w
  140. pack .ds.pre -side left -anchor w
  141. pack .ds.tname -side left -anchor w
  142. pack .lm -side top
  143. pack .m -side top
  144. pack .m.scan -side top -fill x
  145. pack .m.scan.all -side left
  146. pack .m.scan.links -side right
  147. pack .m.file -side top -fill x
  148. pack .m.file.joliet -side left
  149. pack .m.file.trans -side right
  150. pack .m.rock -side top -anchor w
  151. pack .m.rock.l -side left
  152. pack .m.rock.none -side left
  153. pack .m.rock.rational -side left
  154. pack .m.rock.literal -side left
  155. pack .m.volid -side top -anchor w
  156. pack .m.volid.l -side left
  157. pack .m.volid.e -side left
  158. pack .m.root -side top -anchor w
  159. pack .m.root.l -side left
  160. pack .m.root.e .m.root.p -side left
  161. pack .m.boot -side top -anchor w -fill x
  162. pack .m.boot.check -side left
  163. pack .m.boot.opts -side left -expand 1
  164. pack .lc -side top
  165. pack .c -side top
  166. pack .c.flag -side top
  167. pack .c.flag.dummy -side left
  168. pack .c.flag.eject -side left
  169. pack .c.flag.pad -side left
  170. pack .c.dev -side top
  171. pack .c.dev.l -side left
  172. pack .c.dev.e -side left
  173. pack .c.speed -side top
  174. pack .c.speed.l .c.speed.1 .c.speed.2 .c.speed.4 .c.speed.6 .c.speed.8 -side left
  175.  
  176. frame .spacer -height 10
  177. pack .spacer -side top
  178.  
  179. .c.dev.e insert 0 "/dev/sg0"
  180.  
  181. }
  182. proc toast {} {
  183. global all joliet follow trans ds rock boot apad dpad bootimg bootcat
  184.  
  185. if {$ds == "none"} {
  186. set source ""
  187. }
  188.  
  189. if {$ds == "premade"} {
  190.  set source [.ds.tname get]
  191.  if {![file isfile $source]} {
  192.  alert "Premade data track must be a regular file."
  193.  return
  194.  }
  195. }
  196.  
  197. if {$ds == "mkisofs"} {
  198.  set source -
  199.  
  200.  set vol [.m.volid.e get]
  201.  set root [.m.root.e get]
  202.  if {![file isdirectory $root]} {
  203.  alert "For on-the-fly ISO image creation, the root of tree must be a directory."
  204.  return
  205.  }
  206.  
  207.  set mk mkisofs
  208.  if {$all} {lappend mk -all-files}
  209.  if {$joliet} {lappend mk -joliet}
  210.  switch -exact $rock {
  211.   none {}
  212.   rat {lappend mk -r}
  213.   lit {lappend mk -R}
  214.  }
  215.  if {$follow} {lappend mk -follow-links}
  216.  if {$trans} {lappend mk -translation-table}
  217.  if {$boot} {
  218.   if {($bootimg == "") || ($bootcat == "")} {
  219.    alert "You selected 'Bootable CD' but either the boot image or boot catalog entries are blank. This will not work."
  220.    return
  221.   }
  222.   if {![file exists [file join $root $bootimg]]} {
  223.    alert "[file join $root $bootimg] is not there. You can't make a bootable CD without a bootimage."
  224.    return
  225.   }
  226.   if {[file exists [file join $root $bootcat]]} {
  227.    if {![sure "[file join $root $bootcat] will be overwritten if you continue. Is this ok?"]} {return}
  228.   }
  229.   lappend mk -b $bootimg -c $bootcat
  230.  } else {
  231.   if {$bootimg != ""} {
  232.    set ok [sure "You have stuff in the bootimage entry, but have not chosen the 'Bootable CD' option. Do you want a standard non-bootable cd?"]
  233.    if {!$ok} {return}
  234.   }
  235.  }
  236.  if {$vol != ""} {lappend mk -volid $vol}
  237.  lappend mk $root "|"
  238.  
  239. }
  240.  
  241. set cd [base_cdrec]
  242.  
  243. set nuke ""
  244. set convlist ""
  245.  
  246. if {$source != ""} {
  247.  lappend cd -data
  248.  if $dpad {lappend cd "-pad"}
  249.  lappend cd $source
  250. }
  251. set tmp [.audio.f.lb get 0 end]
  252. if {$tmp == ""} {
  253.  if {$ds == "none"} {
  254.   alert "No audio tracks were specified for an audio-only disk. This makes no sense."
  255.   return
  256.  }
  257. } else {
  258.  lappend cd -audio
  259.  if $apad {lappend cd "-pad"} else {
  260.   if $dpad {lappend cd "-nopad"}
  261.  }
  262.  set warned 0
  263.  foreach i $tmp {
  264.   ## Have to validate audio track type
  265.   switch [file extension $i] {
  266.    .mp2 -
  267.    .mpg -
  268.    .mp3 {
  269.     if {$warned == 0} {
  270.      # Give use opportunity to opt out. Also collect info for conversion.
  271.      set tempdir [get_mp3_burn_info]
  272.      if {$tempdir==""} {
  273.       alert "An understandable choice."
  274.       return
  275.      }
  276.      set warned 1
  277.     }
  278.     # Queue for conversion burning, and nuking.
  279.     # Yes, there are race conditions. No, I don't care too much. If
  280.     # you have a fix for the race conditions which is not too complicated,
  281.     # tell me and I'll probably add your fix. Thanks.
  282.     set tail [file tail $i]
  283.     set tempfile [file join $tempdir "###${tail}.raw"]
  284.     if [file exists $tempfile] {
  285.      alert "$tempfile already exists. I will cancel the burn and let you decide what to do."
  286.      return
  287.     }
  288.     lappend convlist $i
  289.     lappend nuke $tempfile
  290.     lappend cd $tempfile
  291.    }
  292.    
  293.    .wav -
  294.    .raw -
  295.    .pcm {
  296.     # queue for burning
  297.     lappend cd $i
  298.    }
  299.    
  300.    default {
  301.     # Note the offending file for the user.
  302.     alert "I don't recognize the file extention on '$i'. For safety reasons, I won't burn that file as an audio track.\n\nI'd suggest removing it and others like it from the audio track list."
  303.     return
  304.    }
  305.   }
  306.  }
  307. }
  308.  
  309. if {$ds == "mkisofs"} { set cd [concat $mk $cd] }
  310.  
  311. if {[sure "About to run command:\n\n$cd\n\nAre you sure?"]} {
  312.  set err 0
  313.  set err [catch {
  314.   # Run necessary conversions
  315.   foreach orig $convlist tempfile $nuke {
  316.    exec mpg123 -s $orig | sox -t raw -w -s -c 2 -r 44100 - $tempfile >&/dev/null
  317.   }
  318.  }]
  319.  
  320.  if $err {
  321.   alert "Some error occured during the MPEG conversion process. You probably ran out of space or don't have the mpg123 and sox tools installed."
  322.  } else {
  323.   dispatch $cd {CD Burn Progress}
  324.  }
  325.  
  326.  # Remove temp files
  327.  catch {
  328.   foreach tempfile $nuke {
  329.    exec rm $tempfile
  330.   }
  331.  }
  332. }
  333.  
  334. }
  335. proc audio_add {} {
  336. catch {destroy .add}
  337. toplevel .add
  338. wm title .add {Add Audio Tracks}
  339.  
  340.  
  341. label .add.l -text {Track Name (Globals OK)} 
  342. entry .add.e -width 32 -font 7x14 
  343. button .add.ok -text {OK} -command {
  344. set tmp [glob -nocomplain [.add.e get]]
  345. foreach i $tmp {.audio.f.lb insert end $i}
  346. destroy .add
  347. }
  348. button .add.cancel -text {Cancel} -command {
  349. destroy .add
  350. }
  351.  
  352. pack .add.l -side top
  353. pack .add.e -side top
  354. pack .add.ok -side left
  355. pack .add.cancel -side right
  356.  
  357.  
  358. }
  359. proc audio_remove {} {
  360. set victim [.audio.f.lb curselection]
  361. catch {.audio.f.lb delete $victim}
  362. }
  363. proc audio_removeall {} {
  364. .audio.f.lb delete 0 end
  365. }
  366. proc flip n {
  367. .audio.f.lb selection clear 0 end
  368. set above [expr $n - 1]
  369. set tmp [.audio.f.lb get $n]
  370. .audio.f.lb insert $above $tmp
  371. .audio.f.lb delete [expr $n + 1]
  372. }
  373. proc alert msg {
  374. tk_dialog .alert Alert $msg info 0 "So it goes."
  375. }
  376. proc help {} {
  377. catch {destroy .help}
  378. toplevel .help
  379. wm title .help {Help!}
  380.  
  381. button .help.ok -text {This Rules!} -command {destroy .help}
  382. text .help.t -width 60 -height 18 -yscrollcommand {.help.sb set} -wrap word
  383. scrollbar .help.sb -orient v -command {.help.t yview}
  384.  
  385. pack .help.ok -side bottom
  386. pack .help.t -side left
  387. pack .help.sb -side left -fill y
  388.  
  389. .help.t insert 1.0 {About CDR-Toaster version 1.02
  390.  
  391. This is a graphical front-end for the excelent programs 'mkisofs', 'cdrecord', and 'cdparanoia'.
  392.  
  393. It's good for:
  394.  o Avoiding coasters due to command-line mistakes
  395.  o Eliminating the tedium of consulting documentation
  396.  o Feeling more secure in a correct set of options
  397.  o Being lazy
  398.  
  399. As you can guess, I wrote it for what it's good for.
  400.  
  401. CDR-Toaster is copyright 1999 Ian Kjos <brooke@jump.net>
  402.  
  403. CDR-Toaster is availible under the GNU General
  404. Public License version 2.0 or later (at your option).
  405. This license can be found at 
  406. http://www.gnu.org/copyleft/gpl.html
  407.  
  408. }
  409.  
  410. .help.t config -state disabled
  411.  
  412. }
  413. proc sure msg {
  414. return [expr ![tk_dialog .alert Confirmation $msg questhead -1 yes no]]
  415. }
  416. proc read_iso {} {
  417. catch {destroy .top}
  418. toplevel .top
  419. wm title .top "Read ISO image"
  420.  
  421. frame .top.dev -border 0 -relief flat 
  422. frame .top.file -border 0 -relief flat 
  423. frame .top.b -border 0 -relief flat 
  424. label .top.dev.l -text {device to read:} 
  425. label .top.file.l -text {file to write:} 
  426. entry .top.dev.e -width 20 -font 7x14 
  427. entry .top.file.e -width 20 -font 7x14 
  428. button .top.b.ok -text {Do it} -command {
  429. if {![file readable [.top.dev.e get]]} {
  430.  alert "You do not have read permissions on '[.top.dev.e get]'. You should probably be running this as root."
  431.  return
  432. }
  433. set tmp "echo 'This takes a good while.';dd if=[.top.dev.e get] of=[.top.file.e get] bs=1024k; eject [.top.dev.e get]"
  434. dispatch $tmp "Reading ISO Image"
  435. destroy .top
  436. }
  437. button .top.b.dis -text {Forget it} -command {
  438. destroy .top
  439. }
  440.  
  441. pack .top.dev -side top
  442. pack .top.file -side top
  443. pack .top.b -side top -fill x
  444. pack .top.dev.l -side left
  445. pack .top.file.l -side left
  446. pack .top.dev.e -side left
  447. pack .top.file.e -side left
  448. pack .top.b.ok -side left -expand 1
  449. pack .top.b.dis -side left -expand 1
  450.  
  451. .top.dev.e insert 0 "/dev/cdrom"
  452. .top.file.e insert 0 "image.iso"
  453.  
  454. }
  455. proc read_audio {} {
  456. catch {destroy .top}
  457. toplevel .top
  458. wm title .top "Read audio tracks"
  459.  
  460. frame .top.path
  461. label .top.path.l -text "Rip Destination: "
  462. entry .top.path.dest
  463. button .top.path.peruse -text "Peruse" -command {
  464. peruse
  465. .top.path.dest delete 0 end
  466. .top.path.dest insert 0 $perused
  467. }
  468.  
  469. frame .top.1 -border 0 -relief flat 
  470. frame .top.2 -border 0 -relief flat 
  471. frame .top.3 -border 0 -relief flat 
  472. frame .top.4 -border 0 -relief flat 
  473. radiobutton .top.1.entire -text {Rip Entire Disk} -variable {rip} -value {all}
  474. radiobutton .top.2.track -text {Tracks:} -variable {rip} -value {track}
  475. radiobutton .top.3.custom -text {Custom Options} -variable {rip} -value {custom}
  476. button .top.4.ok -text {Do it} -command {
  477.  set tmp "Ripping Audio"
  478.  switch $rip {
  479.   all {
  480.    set dp "cdparanoia -w -B 1-"
  481.   }
  482.   track {
  483.    set dp "cdparanoia -w -B [.top.2.from get]-[.top.2.to get]"
  484.   }
  485.   custom {
  486.    set dp "cdparanoia [.top.3.opt get]"
  487.   }
  488.  }
  489.  if {[.top.path.dest get] != ""} {
  490.   set dp "cd [.top.path.dest get];$dp"
  491.  }
  492.  dispatch $dp $dp
  493.  destroy .top
  494. }
  495. button .top.4.dis -text {Not now.} -command {
  496.  destroy .top
  497. }
  498. label .top.2.lfr -text {From:} 
  499. entry .top.2.from -width 4 -font 7x14 
  500. label .top.2.lto -text {To:} 
  501. entry .top.2.to -width 4 -font 7x14 
  502. entry .top.3.opt -width 20 -font 7x14 
  503.  
  504. pack .top.path -side top -fill x
  505. pack .top.path.l .top.path.dest .top.path.peruse -side left
  506. pack .top.1 -side top -fill x
  507. pack .top.2 -side top -fill x
  508. pack .top.3 -side top -fill x
  509. pack .top.4 -side top -fill x
  510. pack .top.1.entire -side left -anchor w
  511. pack .top.2.track -side left -anchor w
  512. pack .top.3.custom -side left -anchor w
  513. pack .top.4.ok -side left -expand 1
  514. pack .top.4.dis -side left -expand 1
  515. pack .top.2.lfr -side left -anchor e
  516. pack .top.2.from -side left -anchor e
  517. pack .top.2.lto -side left -anchor e
  518. pack .top.2.to -side left -anchor e
  519. pack .top.3.opt -side left -anchor e
  520.  
  521. global rip
  522. set rip all
  523.  
  524.  
  525. }
  526. proc blank_cdrw {} {
  527. global blank
  528.  
  529. catch {destroy .top}
  530. toplevel .top
  531. wm title .top "Blank CDRW Media"
  532.  
  533. frame .top.type -border 0 -relief flat 
  534. frame .top.b -border 0 -relief flat 
  535. label .top.type.l -text {Blank Type} 
  536. frame .top.type.r
  537. radiobutton .top.type.all -text {Entire Disk} -variable {blank} -value {all}
  538. radiobutton .top.type.session -text {Session} -variable {blank} -value {session}
  539. radiobutton .top.type.track -text {Track} -variable {blank} -value {track}
  540. radiobutton .top.type.fast -text {Fast} -variable {blank} -value {fast}
  541. radiobutton .top.type.r.unreserve -text {Unreserve} -variable {blank} -value {unreserve}
  542. radiobutton .top.type.r.trtail -text {Track Tail} -variable {blank} -value {trtail}
  543. radiobutton .top.type.r.unclose -text {Unclose} -variable {blank} -value {unclose}
  544. button .top.b.ok -text {Do it} -command {
  545.  set cmd [base_cdrec]
  546.  lappend cmd "blank=${blank}"
  547.  dispatch $cmd "Blanking CDRW: ${blank}"
  548.  destroy .top
  549. }
  550. button .top.b.dis -text {Let's not.} -command {
  551.  destroy .top
  552. }
  553.  
  554. pack .top.type -side top
  555. pack .top.b -side top -fill x
  556. pack .top.type.l -side left
  557. pack .top.type.r -side right -fill y
  558. pack .top.type.all -side top -anchor w
  559. pack .top.type.session -side top -anchor w
  560. pack .top.type.track -side top -anchor w
  561. pack .top.type.fast -side top -anchor w
  562. pack .top.type.r.unreserve -side top -anchor w
  563. pack .top.type.r.trtail -side top -anchor w
  564. pack .top.type.r.unclose -side top -anchor w
  565. pack .top.b.ok -side left -expand 1
  566. pack .top.b.dis -side left -expand 1
  567.  
  568. set blank session
  569.  
  570. }
  571. proc dispatch {cmd title} {
  572.  exec /usr/X11R6/bin/xterm -geometry 80x6 -title $title -e sh -c [concat $cmd \; echo Done. Press Enter\; read] &
  573. }
  574. proc base_cdrec {} {
  575. global dummy eject speed
  576. set cd [list cdrecord -v]
  577. if {$dummy} {lappend cd -dummy}
  578. if {$eject} {lappend cd -eject}
  579. set dev [.c.dev.e get]
  580. if {![file writable $dev]} {
  581.  alert "You don't have write permission to the device you selected. You should probably be running this as root. If that is not an option, get the system administrator to give you write priveleges for the cd-writer."
  582.  return -code return
  583. }
  584. lappend cd "dev=$dev" "speed=$speed"
  585. return $cd
  586. }
  587. proc help_clarify {} {
  588. catch {destroy .help}
  589. toplevel .help
  590. wm title .help {Help!}
  591.  
  592. frame .help.b
  593.  
  594. set m .help.b.topic.m
  595. menubutton .help.b.topic -menu $m -text Topic -relief raised
  596. menu $m
  597. foreach line {2 8 15 31 37 42 53} topic {
  598.  "All Files"
  599.  "Joliet support"
  600.  "Rock Ridge"
  601.  "Follow SymLinks"
  602.  "Translation Tables"
  603.  "MPEG Compressed Audio"
  604.  "PCM vs. WAV"
  605. } {
  606.  $m add command -label $topic -command ".help.t yview $line"
  607. }
  608.  
  609. button .help.b.ok -text {This Rules!} -command {destroy .help}
  610. text .help.t -width 60 -height 18 -yscrollcommand {.help.sb set} -wrap word
  611. scrollbar .help.sb -orient v -command {.help.t yview}
  612.  
  613. pack .help.b -side bottom -fill x
  614. pack .help.b.topic -side left
  615. pack .help.b.ok -side bottom
  616. pack .help.t -side left
  617. pack .help.sb -side left -fill y
  618.  
  619. .help.t insert 1.0 {Clarifications:
  620.  
  621.  o All Files
  622.    Ordinarily files with names contataing '#' or '~'
  623.    are backup files on Linux. CDR-Toaster will instruct
  624.    mkisofs to skip these files in the creation of a
  625.    CD. If you DON'T want to skip them, click this box.
  626.  
  627.  o Joliet support
  628.    This stores long filenames on a CD so Windows 9x/NT
  629.    machines can read them. Unlike the Joliet CDs produced
  630.    on MS-Windows, you can still see the 8.3 filenames on
  631.    MS-Dos and other systems that don't support Joliet.
  632.    Linux kernels 2.2 and up can also read Joliet names.
  633.  
  634.  o Rock Ridge
  635.    This is another way to store long filenames on a CD.
  636.    It works with all Un*x-like systems that also support
  637.    CDs. It allows file permissions, ownership info, and
  638.    symbolic links to be stored and appear as such on the
  639.    CD. If you choose "Literal", the final CD will look in
  640.    all respects identical to the directory hierarchy it
  641.    was created from, except for some reason you can't
  642.    write to it. This could be good for system backups.
  643.    If you choose "Rationalized", you get a more generally
  644.    useful CD. It sets the user and group of all files to
  645.    root, removes SUID and SGID bits, makes all files and
  646.    folders readable globally, sets all execute bits for
  647.    anything that has any execute bits, and clears all
  648.    write bits.
  649.  
  650.  o Follow SymLinks
  651.    Normally symbolic links are ignored, unless you use
  652.    Rock Ridge, when they are copied literally. If you
  653.    want the actual files and folders pointed to by the
  654.    symbolic links to show up on the CD, check this box.
  655.  
  656.  o Translation Tables
  657.    Puts a file called "TRANS.TBL" in every directory on
  658.    the CD which maps 8.3 files to their long equivalents.
  659.    Very simple, very old.
  660.  
  661.  o MPEG Compressed Audio
  662.    CDR-Toaster will extract MPEG Compressed audio (mp3)
  663.    if you have mpg123 and sox installed. This way you
  664.    can burn an audio CD from mp3 files. The sound will
  665.    not be as good quality as the original uncompressed
  666.    audio, but that's the trade off that a lossy compression
  667.    like MPEG makes to attain the high ratios that it does.
  668.    For more information, point your web browser at these:
  669.    http://www.mpeg.org/MPEG/
  670.    http://drogo.cselt.stet.it/mpeg/
  671.  
  672.  o PCM vs. WAV
  673.    WAV is a format composed of 44 bytes of header data,
  674.    then raw PCM data. PCM means only pulse code modulation,
  675.    which is to say a digitial audio format made of numbers
  676.    to signify each sample. There is no attempt made to
  677.    compress the signals beyond the decisions of sample rate
  678.    and dynamic range.
  679.  
  680.    For CDR-Toaster to burn audio, you can feed it either a
  681.    raw PCM file or a WAV file. WAV files are better because
  682.    they contain enough information in the header to ensure
  683.    that the audio format is correct. To get an audio track
  684.    to burn properly, the PCM data needs to be composed of
  685.    exactly the same structure as on a CD - that is 41.1 khz
  686.    16 bit stereo. Anything else and you get an unusable
  687.    audio track. 
  688.  
  689.    When using WAV files ripped from a CD, (as CDPARANOIA
  690.    does) you will get files that are already correct. If
  691.    you want to use a WAV file you recorded yourself, it is
  692.    wise to ensure you recorded cd-quality (16 bit stereo
  693.    44.1khz) uncompressed audio. If you did otherwise, there
  694.    are many format converters availible which can convert to
  695.    this format without any signal loss. The other issue with
  696.    audio files you record yourself is that they must be a
  697.    precise multiple of 1/75th of a second. This is where
  698.    audio padding comes into play. If you do not have the
  699.    right number of samples, the Pad Audio option can round
  700.    up using absolute silence.
  701.  
  702. }
  703.  
  704. .help.t config -state disabled
  705.  
  706. }
  707. proc padbox {} {
  708.  
  709. catch {destroy .pad}
  710. toplevel .pad
  711. wm title .pad {Padding Options}
  712.  
  713. frame .pad.audio
  714. checkbutton .pad.audio.cb -text {Pad Audio Tracks} -variable {apad}
  715. message .pad.audio.amesg -text {This option will pad audio track data to be a multiple of 2352 bytes. The padding is done with all zeroes which means complete silence. See also PCM vs. WAV in help.
  716. }
  717. frame .pad.data
  718. checkbutton .pad.data.cb -text {Pad Data Track} -variable {dpad}
  719. message .pad.data.dmesg -text {This option appends 15 sectors of zeroes to each data track. This works around a bug in very old Linux kernels.}
  720. button .pad.ok -text Dismiss -command {destroy .pad}
  721.  
  722. pack .pad.audio -fill x
  723. pack .pad.audio.cb -side left -anchor n
  724. pack .pad.audio.amesg
  725. pack .pad.data -fill x
  726. pack .pad.data.cb -side left -anchor n
  727. pack .pad.data.dmesg
  728. pack .pad.ok
  729.  
  730. }
  731. proc peruse {} {
  732. # Just browse directories
  733.  
  734. global perused
  735.  
  736. set perused ""
  737.  
  738. catch {destroy .peruse}
  739. toplevel .peruse
  740. wm title .peruse {Peruse Folders}
  741.  
  742. frame .peruse.dir -border 0 -relief flat 
  743. frame .peruse.mod -border 0 -relief flat 
  744. frame .peruse.control -border 0 -relief flat
  745. menubutton .peruse.dir.up -menu .peruse.dir.up.m -relief raised -border 2
  746. button .peruse.dir.ok -text {<-- Accept} -command {
  747. }
  748. listbox .peruse.mod.lb -height 10 -width 20 -selectmode browse -yscrollcommand {.peruse.mod.sb set}
  749. scrollbar .peruse.mod.sb -orient v -command {.peruse.mod.lb yview}
  750. button .peruse.control.go -text {Delve} -command {
  751. }
  752. button .peruse.control.cancel -text {Cancel} -command {
  753. }
  754.  
  755. pack .peruse.dir -side top -fill x
  756. pack .peruse.mod -side top -fill x
  757. pack .peruse.control -side top -fill x
  758. pack .peruse.dir.up -side left
  759. pack .peruse.dir.ok -side right
  760. pack .peruse.mod.lb -side left -fill y -anchor w
  761. pack .peruse.mod.sb -side left -fill y -anchor w
  762. pack .peruse.control.go -side left -expand 1
  763. pack .peruse.control.cancel -side left -expand 1
  764.  
  765. peruse_populate [pwd]
  766. tkwait window .peruse
  767.  
  768. }
  769. proc peruse_populate dir {
  770.  
  771. set tmp [file tail $dir]
  772. if {$tmp == ""} {set tmp /}
  773. .peruse.dir.up configure -text $tmp
  774.  
  775. set m .peruse.dir.up.m
  776. catch {
  777. destroy $m
  778. }
  779. menu $m -tearoff 0
  780.  
  781. set up /
  782. foreach dcomp [file split $dir] {
  783.  set up [file join $up $dcomp]
  784.  $m add command -label $dcomp -command "peruse_populate \"$up\""
  785. }
  786.  
  787. .peruse.mod.lb delete 0 end
  788. set tmp [lsort [glob $dir/.* $dir/*]]
  789. foreach dcan $tmp {
  790.  if [file isdirectory $dcan] {
  791.   set tail [file tail $dcan]
  792.   if {$tail != "." && $tail != ".."} {
  793.    .peruse.mod.lb insert end $tail
  794.   }
  795.  }
  796. }
  797.  
  798. ## Bindings
  799.  
  800. .peruse.control.cancel config -command {
  801.  set perused ""
  802.  destroy .peruse
  803. }
  804. .peruse.dir.ok config -command [subst {
  805.  set perused "$dir"
  806.  destroy .peruse
  807. }]
  808.  
  809. set go [subst -nocommands {
  810.  if {[.peruse.mod.lb get active] != ""} {
  811.   peruse_populate [file join "$dir" [.peruse.mod.lb get active]]
  812.  } else bell
  813. }]
  814.  
  815. bind .peruse.mod.lb <Double-1> $go
  816. .peruse.control.go config -command $go
  817.  
  818. }
  819. proc boot_setup {} {
  820. global bootimg bootcat
  821.  
  822. catch {destroy .boot}
  823. toplevel .boot
  824. wm title .boot {Bootable CD Setup}
  825.  
  826.  
  827. frame .boot.img -border 0 -relief flat 
  828. frame .boot.cat -border 0 -relief flat 
  829. frame .boot.cmd -border 0 -relief flat 
  830. label .boot.img.l -text {Boot Image Path} 
  831. label .boot.cat.l -text {Boot Catalog Path} 
  832. entry .boot.img.e -width 20 -font 7x14 
  833. entry .boot.cat.e -width 20 -font 7x14 
  834. button .boot.cmd.ok -text {OK} -command {
  835.  set bootimg [.boot.img.e get]
  836.  set bootcat [.boot.cat.e get]
  837.  destroy .boot
  838. }
  839. button .boot.cmd.cancel -text {Cancel} -command {
  840.  destroy .boot
  841. }
  842. button .boot.cmd.revert -text {Revert} -command {
  843.  .boot.img.e delete 0 end
  844.  .boot.cat.e delete 0 end
  845.  .boot.img.e insert 0 $bootimg
  846.  .boot.cat.e insert 0 $bootcat
  847. }
  848.  
  849. # Populate Data Fields
  850. .boot.img.e insert 0 $bootimg
  851. .boot.cat.e insert 0 $bootcat
  852.  
  853. pack .boot.img -side top -fill x
  854. pack .boot.cat -side top -fill x
  855. pack .boot.cmd -side top -fill x
  856. pack .boot.img.l -side left
  857. pack .boot.cat.l -side left
  858. pack .boot.img.e -side right
  859. pack .boot.cat.e -side right
  860. pack .boot.cmd.ok -side left -expand 1
  861. pack .boot.cmd.cancel -side left -expand 1
  862. pack .boot.cmd.revert -side left -expand 1
  863.  
  864.  
  865.  
  866. # frame .m.img
  867. # label .m.img.l -text "Boot Image Path"
  868. # entry .m.img.e
  869. # frame .m.cat
  870. # label .m.cat.l -text "Boot Catalog Path"
  871. # entry .m.cat.e
  872. }
  873. proc get_mp3_burn_info {} {
  874. # Returns either the empty list, indicating a cancelation,
  875. # or the temp directory.
  876.  
  877. global perused
  878.  
  879. set warn {\
  880. You have chosen to burn an MPEG compressed file as an audio track. This will not be the same quality as the original from which it was made. However, the burn can proceed if given a space to uncompress the audio files.
  881.  
  882. Do you wish to proceed?}
  883.  
  884. set go [sure $warn]
  885. if {!$go} {
  886.  return {}
  887. }
  888.  
  889. set df [exec -keepnewline df]
  890.  
  891. catch {destroy .df}
  892. toplevel .df
  893. wm title .df {Free Disk Space}
  894.  
  895. text .df.t -width 80 -height 10 -setgrid 1 -yscrollcommand {.df.sb set}
  896. scrollbar .df.sb -orient v -command {.df.t yview}
  897.  
  898. .df.t insert end "Please browse to a directory with sufficient free space.\n\n"
  899. .df.t insert end $df
  900. .df.t config -state disabled
  901.  
  902. pack .df.sb -side right -fill y
  903. pack .df.t -side left
  904.  
  905. peruse
  906. destroy .df
  907. return $perused
  908. }
  909.  
  910. # This is CDR-Toaster
  911.  
  912. set speed 2
  913. set joliet 1
  914. set rock none
  915. set dummy 1
  916. set eject 1
  917. set ds mkisofs
  918. set apad 1
  919. set dpad 0
  920. set bootimg ""
  921. set bootcat ""
  922.  
  923. interface
  924.  
  925. .b.quit configure -command {destroy .}
  926. .b.burn configure -command {toast}
  927.  
  928.