slitaz-tools diff boxes/burn-box @ rev 939

tazbox: fix subox icon when ~/.local/share/applications is absent; fix working with freegeoip; write full list of icons used; all other files: 2015 and insert blank lines.
author Aleksej Bobylev <al.bobylev@gmail.com>
date Fri Apr 17 07:35:02 2015 +0300 (2015-04-17)
parents c79e656b37a5
children 3be081525506
line diff
     1.1 --- a/boxes/burn-box	Sat Jan 04 14:32:42 2014 +0000
     1.2 +++ b/boxes/burn-box	Fri Apr 17 07:35:02 2015 +0300
     1.3 @@ -4,30 +4,38 @@
     1.4  # window uncluttered and use a wizard to create audio/video/data CD/DVD.
     1.5  # The main box lets users burn an ISO and audio files from a single directory.
     1.6  #
     1.7 -# Copyright (C) 2012-2014 SliTaz GNU/Linux - BSD License
     1.8 +# Copyright (C) 2012-2015 SliTaz GNU/Linux - BSD License
     1.9  #
    1.10  # Author: Christophe Lincoln <pankso@slitaz.org>
    1.11  #
    1.12 +
    1.13  . /lib/libtaz.sh
    1.14  export TEXTDOMAIN='slitaz-boxes' # i18n
    1.15  
    1.16 +
    1.17  # LibTaz parser and store options. Burn-box can be used with an ISO image
    1.18  # or an audio directory in option: burn-box --iso=/path/to/image.iso
    1.19 +
    1.20  [ "$iso" ] || iso=" "
    1.21  [ "$audio" ] || audio="$HOME"
    1.22  
    1.23 +
    1.24  # Internal variables
    1.25 +
    1.26  boxopts="--height=300 --width=620"
    1.27  icon=media-optical-dvd-rw
    1.28  options="-eject -multi"
    1.29  speed=$(fgrep "drive speed" /proc/sys/dev/cdrom/info | cut -f3)
    1.30  tmpdir=$(mktemp -d)
    1.31  
    1.32 +
    1.33  #
    1.34  # Functions
    1.35  #
    1.36  
    1.37 +
    1.38  # Help and usage
    1.39 +
    1.40  usage() {
    1.41  	newline; _ 'Burn-box a small front end to cdrkit powered by Yad/GTK.'
    1.42  	newline; boldify $(_ 'Usage:')
    1.43 @@ -52,14 +60,18 @@
    1.44  	newline
    1.45  }
    1.46  
    1.47 +
    1.48  # Ouput a command to a Yad/GTK box. Usage: cmd | out --title="Title" --tail
    1.49 +
    1.50  gtkout() {
    1.51  	yad --window-icon=$icon $boxopts \
    1.52  		--margins=4 --fontname=monospace \
    1.53  		--text-info "$@" --button="gtk-close:1"
    1.54  }
    1.55  
    1.56 +
    1.57  # Decode audio files with: decode [file]
    1.58 +
    1.59  decode_audio() {
    1.60  	_ 'Decoding files from: $audio'
    1.61  	for f in "$audio"/*.*
    1.62 @@ -78,7 +90,9 @@
    1.63  	done
    1.64  }
    1.65  
    1.66 +
    1.67  # Burn an ISO image.
    1.68 +
    1.69  burn_iso() {
    1.70  	if [ "${iso##*.}" != "iso" ]; then
    1.71  		_ 'Not an ISO image: "$iso"'; exit 1
    1.72 @@ -86,7 +100,9 @@
    1.73  	wodim -v speed=$speed $options "$iso"
    1.74  }
    1.75  
    1.76 +
    1.77  # Burn some audio tracks from a directory.
    1.78 +
    1.79  burn_audio() {
    1.80  	decode_audio
    1.81  	echo "TODO: check_size"
    1.82 @@ -95,7 +111,9 @@
    1.83  	rm -rf $tmpdir
    1.84  }
    1.85  
    1.86 +
    1.87  # Main GUI box function with pure Yad spec
    1.88 +
    1.89  burn_main() {
    1.90  	yad --title="$(_ 'Burn-box')" --window-icon=$icon $boxopts \
    1.91  		--image=$icon --image-on-top \
    1.92 @@ -111,7 +129,9 @@
    1.93  		--button="gtk-close:1"
    1.94  }
    1.95  
    1.96 +
    1.97  # Main function
    1.98 +
    1.99  burn() {
   1.100  	# Store box results
   1.101  	main=$(burn_main)
   1.102 @@ -138,6 +158,7 @@
   1.103  	fi
   1.104  }
   1.105  
   1.106 +
   1.107  #
   1.108  # Commands
   1.109  #