"Fossies" - the Fresh Open Source Software Archive

Member "burncdda-1.8.3/burncdda" (17 May 2011, 17774 Bytes) of package /linux/privat/old/burncdda-1.8.3.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) Bash source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file.

    1 #!/usr/bin/env bash
    2 #------------------------------------------------------------------------------
    3 # burnCDDA is a shell script for burning Audio-CDs with
    4 # cdrdao and cdrecord.
    5 #
    6 # (C) 2001 by Thorsten Muehlfelder <thenktor@gmx.de>
    7 #
    8 # This program is free software; you can redistribute it and/or 
    9 # modify it under the terms of the GNU General Public License (version 2)
   10 # as published by the Free Software Foundation;
   11 # 
   12 # This program is distributed in the hope that it will be useful, 
   13 # but WITHOUT ANY WARRANTY; without even the implied warranty of 
   14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 
   15 # GNU General Public License for more details. 
   16 # 
   17 # You should have received a copy of the GNU General Public License 
   18 # along with this program; if not, write to the Free Software 
   19 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 
   20 #------------------------------------------------------------------------------
   21 
   22 # catch SIGINT and SIGTERM, remove TEMPFILE
   23 trap 'forcedkill' 1 2 3 15
   24 
   25 # some variables
   26 VERSION="1.8.3"
   27 CONFNEEDED="180"
   28 BACKTITLE="burnCDDA $VERSION"
   29 ERROR="An error ocurred:"
   30 STARTDIR=`pwd`
   31 PLAYLIST=""
   32 LINE=""
   33 WAVNAME=""
   34 TYP="mp3"
   35 NORMSET="0"
   36 EXTENDED=""
   37 FILEMANAGER=""
   38 LL="0"
   39 M3U="m3u"
   40 IFSBAK="$IFS"
   41 FILES=""
   42 KEY=""
   43 TEMPVAR=""
   44 CHECKLISTOPTS=""
   45 RADIOLISTOPTS=""
   46 CONFCHANGED="0"
   47 CDEXTRA="0"
   48 CDEXTRAOFFSET=""
   49 
   50 # use no colours as fallback
   51 RED="\033[0m"
   52 GREEN="\033[0m"
   53 YELLOW="\033[0m"
   54 BLUE="\033[0m"
   55 NOCOLOR="\033[0m"
   56 
   57 # sets integer variables
   58 declare -i MENULEVEL=0
   59 declare -i N=0
   60 declare -i LN=1
   61 declare -i MAXN=0
   62 declare -i MAXLN=1
   63 declare -i LNSELECTED=1
   64 declare -i MAXLNSELECTED=1
   65 declare -i FILESIZE=0
   66 declare -i FILETIME=0
   67 declare -i CDTIME=0
   68 declare -i MINUTES=0
   69 declare -i SECONDS=0
   70 declare -i CDEXTRATSIZE=0
   71 declare -i CDEXTRAMB=0
   72 declare -i CORRUPTED=0
   73 declare -i DECERROR=0
   74 declare -i NOTREADABLE=0
   75 declare -i UNKNOWNERROR=0
   76 declare -i COLS=`tput cols`
   77 declare -i ROWS=`tput lines`
   78 
   79 # read config file function (used in setup, too)
   80 function readconfig()
   81 {
   82 if [ -r /etc/burncdda.conf ]; then
   83     source /etc/burncdda.conf
   84 else
   85     echo ""
   86     echo "$ERROR"
   87     echo "Check your installation! You don't have a config file."
   88     exit 1
   89 fi
   90 if [ -r ~/.burncdda ]; then
   91     source ~/.burncdda
   92 fi
   93 }
   94 # read config file
   95 readconfig
   96 
   97 # check config file version
   98 if [ $CONFVERSION != "$CONFNEEDED" ]; then
   99     # first check if we can use DIALOG for our error message
  100     DIALOG=`which $DIALOG`
  101     if [ "$DIALOG" = "" ]; then
  102         echo "ERROR: burncdda.conf seems to be outdated and required tool 'dialog' not found!"
  103         echo "Please use the config file that comes with this burncdda version!"
  104         exit 1
  105     fi
  106     # if we have DIALOG we can provide a nice error message
  107     $DIALOG --backtitle "$BACKTITLE" --title "$ERROR" \
  108            --yesno "Wrong burncdda.conf version found. Please use the config file that comes with this burncdda version! Otherwise burncdda will not work correctly. Do you want to restore the default settings of this release?" 8 60
  109         if [ $? = "0" ]; then
  110             clear
  111             echo "cp /usr/share/burncdda/burncdda.conf.default /etc/burncdda.conf"
  112             echo "Please enter your root password..."
  113             su -c "cp /usr/share/burncdda/burncdda.conf.default /etc/burncdda.conf"
  114         if [ $? = "1" ]; then
  115             echo -e "\nError: Failed to save '/etc/burncdda.conf'!\n"
  116             exit 1
  117         else
  118             echo -e "\nSaved\n"
  119         fi
  120         echo -e "Press any key"
  121         read -n1
  122         readconfig
  123         else
  124             exit 1
  125         fi
  126 fi
  127 
  128 # set colors for console output, config file has to be loaded before!
  129 # this function is used in setup, too!
  130 function consolecolors()
  131 {
  132 if [ "$COLORS" = "BRIGHT" ]; then
  133     RED="\033[1;31m"
  134     GREEN="\033[1;32m"
  135     YELLOW="\033[1;33m"
  136     BLUE="\033[0;36m"
  137     NOCOLOR="\033[0m"
  138 elif [ "$COLORS" = "DARK" ]; then
  139     RED="\033[0;31m"
  140     GREEN="\033[0;32m"
  141     YELLOW="\033[0;33m"
  142     BLUE="\033[1;34m"
  143     NOCOLOR="\033[0m"
  144 else
  145     RED="\033[0m"
  146     GREEN="\033[0m"
  147     YELLOW="\033[0m"
  148     BLUE="\033[0m"
  149     NOCOLOR="\033[0m"
  150 fi
  151 }
  152 # now set colors
  153 consolecolors
  154 
  155 #
  156 # now all basic settings should be ready, all variables should be set
  157 #
  158 
  159 # create the temp files
  160 TEMPFILE=`$MKTEMP /tmp/burncdda.temp.XXXXXX`
  161 TEXTFILE=`$MKTEMP /tmp/burncdda.text.XXXXXX`
  162 DIRFILE=`$MKTEMP /tmp/burncdda.dir.XXXXXX`
  163 
  164 # read common functions
  165 if [ -r "/usr/share/burncdda/common.func" ]; then
  166     source "/usr/share/burncdda/common.func"
  167 else
  168     echo "Fatal error!"
  169     echo "File not found: /usr/share/burncdda/common.func"
  170     test -e "$TEMPFILE" && rm -f "$TEMPFILE"
  171     test -e "$TEXTFILE" && rm -f "$TEXTFILE"
  172     test -e "$DIRFILE" && rm -f "$DIRFILE"
  173     exit 1
  174 fi
  175 
  176 # create imagedir if necessary
  177 createimgdir # common.func
  178 
  179 # check required tools
  180 checkreqtools # common.func
  181 
  182 # read other functions
  183 testsource /usr/share/burncdda/decodenorm.func
  184 testsource /usr/share/burncdda/checkm3u.func
  185 
  186 # check the command line options
  187 commandlineopts "$1" "$2" # common.func
  188 
  189 # check the size of the terminal
  190 if [ ${COLS} -lt 80 -o ${ROWS} -lt 24 ]; then
  191    echo -e "${RED}ERROR:${NOCOLOR} Your terminal is too small!"
  192    echo "Minimum size is 80x24 but you have only ${COLS}x${ROWS} :-("
  193    exit1 # common.func
  194 fi
  195 
  196 #
  197 # main menu -------------------------------------------------------------------------------------------------
  198 #
  199 clear
  200 while [ $MENULEVEL -ge 0 ]; do
  201     MENULEVEL=1
  202     CDTIME=0
  203     cd "$STARTDIR"
  204     echo $DIALOG
  205     $DIALOG --backtitle "$BACKTITLE" --title "Main Menu" --menu "What do you want to do?" 14 60 7 \
  206         1 "Copy CD" \
  207         2 "Burn playlist/directory" \
  208         3 "Check files in playlist/directory" \
  209         4 "Burn WAV/image files" \
  210         5 "Delete WAV/image files" \
  211         6 "Setup" \
  212         7 "Exit" 2> $TEMPFILE
  213 
  214     # if cancel exit menu
  215     if [ $? = "1" ]; then
  216         MENULEVEL=-1
  217         continue
  218     fi
  219     CHOICE=`$CAT $TEMPFILE`
  220     # menu end
  221 
  222     case $CHOICE in
  223 
  224         1)
  225         # Copy CD
  226         while [ $MENULEVEL -ge 1 ]; do
  227             $DIALOG --backtitle "$BACKTITLE" --title "Copy Audio-CD" \
  228                 --inputbox "Enter CD-image filename (without .bin):" 8 60 2> $TEMPFILE
  229             if [ $? = "1" ]; then
  230                 MENULEVEL=0
  231                 continue
  232             fi
  233             CDNAME=`$CAT $TEMPFILE`
  234             if [ "$CDNAME" = "" ]; then
  235                 $DIALOG --backtitle "$BACKTITLE" --title "$ERROR" \
  236                     --msgbox "You have to enter a CD-image filename!" 6 60
  237                 continue
  238             fi
  239             cd "$IMGDIR"
  240             if [ -e "$CDNAME.toc" ]; then
  241                 $DIALOG --backtitle "$BACKTITLE" --title "$ERROR" \
  242                     --msgbox "'$CDNAME.toc' already exists. Choose another name!" 6 60
  243                 continue
  244             fi
  245             mkdir "$CDNAME"
  246             cd "$CDNAME"
  247             $DIALOG --backtitle "$BACKTITLE" --title "Copy Audio-CD" \
  248                 --msgbox "\nInsert Audio-CD and press OK to read" 7 40
  249             clear
  250             $NICE -n $NICELEVEL $CDRDAO read-cd --device $DEVICE --driver $DRVRDAO --paranoia-mode $PARANOIAMODE --datafile "$CDNAME.bin" "$CDNAME.toc"
  251             imageinfofile # common.func
  252 
  253             echo -e "\n${BLUE}Insert CD-R and press any key${NOCOLOR} (type c to cancel)"
  254             read -n1 KEY
  255             if [ "$KEY" = "c" -o "$KEY" = "C" ]; then
  256                 MENULEVEL=0
  257                 continue
  258             fi
  259             echo ""
  260             $CDRDAO write --device $DEVICE --driver $DRVWDAO --speed $WRITESPEED "$CDNAME.toc"
  261             echo -e "\n${BLUE}Press any key${NOCOLOR}"
  262             read -n1
  263             MENULEVEL=0
  264         done
  265         ;;
  266 
  267         2)
  268         # Burn playlist or directory
  269         while [ $MENULEVEL -ge 1 ]; do
  270             # finds all *.m3u files in current dir, case insensitive
  271             FILES=`$FIND * -iname "*.m3u" -maxdepth 0 -type f -printf %f"\255"playlist"\255"off"\255"`
  272             FILES=`echo -e "${FILES}Burn files in current directory\0255directory\0255off\0255"`
  273             IFS="$(echo -e "\0255")"
  274             # select playlists and writes the selectet filenames to $TEMPFILE
  275             $DIALOG --backtitle "$BACKTITLE" --title "Burn playlist/directory to Audio-CD" --separate-output \
  276                 --checklist "Select playlist(s) with spacebar"  16 60 8 $FILES 2> $TEMPFILE
  277             if [ $? = "1" ]; then
  278                 IFS="$IFSBAK"
  279                 MENULEVEL=0
  280                 continue
  281             fi
  282             IFS="$IFSBAK"
  283             MAXLNSELECTED=`$GAWK 'END {print NR}' "$TEMPFILE"`
  284             if [ "$MAXLNSELECTED" = "0" ]; then
  285                 $DIALOG --backtitle "$BACKTITLE" --title "$ERROR" \
  286                     --msgbox "Nothing to burn. Please select something with spacebar first." 7 60
  287                 continue
  288             fi
  289             LNSELECTED=1
  290             while [ $LNSELECTED -le $MAXLNSELECTED ]; do
  291                 LINE=`$HEAD -$LNSELECTED "$TEMPFILE" | $TAIL -1`
  292                 LINE=`echo "$LINE" | $SED s/$'\r'//`
  293                 # check if directory is selected
  294                 if [ "$LINE" = "Burn files in current directory" ]; then
  295                     # search files, sort them, remove ./ from the beginning, remove m3u... from list
  296                     $FIND . -maxdepth 1 -type f | $SORT | $SED 's#^\./##' | $GREP -E -i -v "(\.m3u$|\.txt$|\.jpg$|\.png$|\.gif$|\.bmp$|\.zip$|\.rar$\.url$)" > $DIRFILE
  297                     PLAYLIST="$DIRFILE"
  298                     WAVNAME=`basename "$STARTDIR"`
  299                 else
  300                     PLAYLIST=$LINE
  301                     # WAVNAME = PLAYLIST without .m3u
  302                     WAVNAME=`echo "$PLAYLIST" | $SED s/'\.'[Mm]3[Uu]$//`
  303                 fi
  304                 if [ ! -r "$PLAYLIST" ]; then
  305                     $DIALOG --backtitle "$BACKTITLE" --title "$ERROR" \
  306                         --msgbox "'$PLAYLIST' does not exist or is not readable" 6 60
  307                     LNSELECTED=$LNSELECTED+1
  308                     continue
  309                 fi
  310                 if [ -e "$IMGDIR/$WAVNAME" ]; then
  311                     $DIALOG --backtitle "$BACKTITLE" --title "$ERROR" \
  312                         --msgbox "Playlist $LNSELECTED of $MAXLNSELECTED:\n'$WAVNAME' already exists. Please delete the existing WAVs!" 7 60
  313                     LNSELECTED=$LNSELECTED+1
  314                     continue
  315                 fi
  316                 filecount # common.func
  317                 # checks playlist 0 tracks
  318                 if [ $MAXN -eq 0 ]; then
  319                     $DIALOG --backtitle "$BACKTITLE" --title "$ERROR" \
  320                         --msgbox "Playlist $LNSELECTED of $MAXLNSELECTED:\n'$PLAYLIST' is empty" 7 60
  321                     MENULEVEL=0
  322                     LNSELECTED=$LNSELECTED+1
  323                     continue
  324                 # checks playlist for more than 99 tracks
  325                 elif [ $MAXN -gt 99 ]; then
  326                     $DIALOG --backtitle "$BACKTITLE" --title "$ERROR" \
  327                         --msgbox "Playlist $LNSELECTED of $MAXLNSELECTED:\n'$PLAYLIST'\nThere are $MAXN but you cannot burn more than 99 tracks." 8 60
  328                     MENULEVEL=0
  329                     LNSELECTED=$LNSELECTED+1
  330                     continue
  331                 fi
  332 
  333                 # burning options
  334                 CHECKLISTOPTS=`echo -e "Normalize CD tracks?\0255option\0255off\0255Create CD-Extra?\0255option\0255off"`
  335                 IFS="$(echo -e "\0255")"
  336                 # select options and writes the selectet options to $TEXTFILE
  337                 $DIALOG --backtitle "$BACKTITLE" --title "Burn playlist/directory to Audio-CD" --separate-output \
  338                     --checklist "${WAVNAME}: Change options with spacebar"  12 60 2 $CHECKLISTOPTS 2> $TEXTFILE
  339                 if [ $? = "1" ]; then
  340                     IFS="$IFSBAK"
  341                     MENULEVEL=0
  342                     LNSELECTED=$LNSELECTED+1
  343                     continue
  344                 fi
  345                 IFS="$IFSBAK"
  346                 # quick and dirty method to set options according to $TEXTFILE
  347                 NORMSET="0"
  348                 $GREP "Normalize CD tracks" $TEXTFILE > /dev/null && NORMSET="1"
  349                 CDEXTRA="0"
  350                 $GREP "Create CD-Extra" $TEXTFILE > /dev/null && CDEXTRA="1"
  351 
  352                 # decode and normalize
  353                 clear
  354                 decodenorm # decodenorm.func
  355                 echo -e "\nBurn CD $LNSELECTED of $MAXLNSELECTED: '$WAVNAME'"
  356                 echo -e "${BLUE}Insert CD-R and press any key${NOCOLOR} (type c to cancel)"
  357                 read -n1 KEY
  358                 if [ "$KEY" = "c" -o "$KEY" = "C" ]; then
  359                     LNSELECTED=$LNSELECTED+1
  360                     continue
  361                 fi
  362 
  363                 # burn
  364                 burncdrecord # common.func
  365                 echo -e "\nCD $LNSELECTED of $MAXLNSELECTED: '$WAVNAME' finished"
  366                 echo -e "${BLUE}Press any key${NOCOLOR}"
  367                 read -n1
  368                 LNSELECTED=$LNSELECTED+1
  369             done
  370             MENULEVEL=0
  371         done
  372         ;;
  373 
  374         3)
  375         # Check files in playlist or directory
  376         while [ $MENULEVEL -ge 1 ]; do
  377             # finds all *.m3u files in current dir, case insensitive
  378             FILES=`$FIND * -iname "*.m3u" -maxdepth 0 -type f -printf %f"\255"playlist"\255"off"\255"`
  379             FILES=`echo -e "${FILES}Check files in current directory\0255directory\0255off\0255"`
  380             IFS="$(echo -e "\0255")"
  381             # select playlists and writes the selectet filenames to $TEMPFILE
  382             $DIALOG --backtitle "$BACKTITLE" --title "Check files in playlist/directory" --separate-output \
  383                 --checklist "Select playlist(s) with spacebar"  16 60 8 $FILES 2> $TEMPFILE
  384             if [ $? = "1" ]; then
  385                 IFS="$IFSBAK"
  386                 MENULEVEL=0
  387                 continue
  388             fi
  389             IFS="$IFSBAK"
  390             MAXLNSELECTED=`$GAWK 'END {print NR}' "$TEMPFILE"`
  391             if [ "$MAXLNSELECTED" = "0" ]; then
  392                 $DIALOG --backtitle "$BACKTITLE" --title "$ERROR" \
  393                     --msgbox "Nothing to check. Please select something with spacebar first." 7 60
  394                 continue
  395             fi
  396             LNSELECTED=1
  397             while [ $LNSELECTED -le $MAXLNSELECTED ]; do
  398                 LINE=`$HEAD -$LNSELECTED "$TEMPFILE" | $TAIL -1`
  399                 LINE=`echo "$LINE" | $SED s/$'\r'//`
  400                 # check if directory is selected
  401                 if [ "$LINE" = "Check files in current directory" ]; then
  402                     # search files, sort them, remove ./ from the beginning, remove m3u... from list
  403                     $FIND . -maxdepth 1 -type f | $SORT | $SED 's#^\./##' | $GREP -E -i -v "(\.m3u$|\.txt$|\.jpg$|\.png$|\.gif$|\.bmp$|\.zip$|\.rar$\.url$)" > $DIRFILE
  404                     PLAYLIST="$DIRFILE"
  405                 else
  406                     PLAYLIST=$LINE
  407                 fi
  408                 if [ ! -r "$PLAYLIST" ]; then
  409                     $DIALOG --backtitle "$BACKTITLE" --title "$ERROR" \
  410                         --msgbox "'$PLAYLIST' does not exist or is not readable" 6 60
  411                     LNSELECTED=$LNSELECTED+1
  412                     continue
  413                 fi
  414                 filecount # common.func
  415                 # checks playlist 0 tracks
  416                 if [ $MAXN -eq 0 ]; then
  417                     $DIALOG --backtitle "$BACKTITLE" --title "$ERROR" \
  418                         --msgbox "Playlist $LNSELECTED of $MAXLNSELECTED:\n'$PLAYLIST' is empty" 7 60
  419                     MENULEVEL=0
  420                     LNSELECTED=$LNSELECTED+1
  421                     continue
  422                 fi
  423                 clear
  424                 checkm3u # checkm3u.func
  425                 echo -e "${BLUE}Press any key${NOCOLOR}"
  426                 read -n1
  427                 LNSELECTED=$LNSELECTED+1
  428             done
  429             MENULEVEL=0
  430         done
  431         ;;
  432 
  433         4)
  434         # Burn WAV/image files
  435         FILES=""
  436         while [ $MENULEVEL -ge 1 ]; do
  437             FILES=`$FIND "$IMGDIR" -mindepth 1 -maxdepth 1 -printf %f"\255"image"\255"off"\255"`
  438             if [ "$FILES" = "" ]; then
  439                 $DIALOG --backtitle "$BACKTITLE" --title "Delete WAV/image files" \
  440                     --msgbox "There are no files in your image directory." 7 60
  441                 MENULEVEL=0
  442                 continue
  443             fi
  444             IFS="$(echo -e "\0255")"
  445             $DIALOG --backtitle "$BACKTITLE" --title "Burn WAV/image files" --separate-output \
  446                 --checklist "Select file(s) with spacebar"  16 60 8 $FILES 2> $TEMPFILE
  447             if [ $? = "1" ]; then
  448                 IFS="$IFSBAK"
  449                 MENULEVEL=0
  450                 continue
  451             fi
  452             IFS="$IFSBAK"
  453             MAXLNSELECTED=`$GAWK 'END {print NR}' "$TEMPFILE"`
  454             if [ "$MAXLNSELECTED" = "0" ]; then
  455                 $DIALOG --backtitle "$BACKTITLE" --title "$ERROR" \
  456                     --msgbox "Nothing to burn. Please select something with spacebar first." 7 60
  457                 continue
  458             fi
  459             clear
  460             LNSELECTED=1
  461             while [ $LNSELECTED -le $MAXLNSELECTED ]; do
  462                 LINE=`$HEAD -$LNSELECTED "$TEMPFILE" | $TAIL -1`
  463                 LINE=`echo "$LINE" | $SED s/$'\r'//`
  464                 if [ "$LINE" = "" ]; then
  465                     echo "Cannot burn $IMGDIR"
  466                     LNSELECTED=$LNSELECTED+1
  467                     continue
  468                 fi
  469                 CDNAME=$LINE
  470                 WAVNAME=$LINE
  471                 # if IMAGEINFO file exists burn the image
  472                 if [ -r "$IMGDIR/$CDNAME/IMAGEINFO" ]; then
  473                     cd "$IMGDIR/$CDNAME"
  474                     $CAT IMAGEINFO > $TEXTFILE
  475                     echo -e "\nInsert CD-R and press OK to burn disc $LNSELECTED of $MAXLNSELECTED" >> $TEXTFILE
  476                     $DIALOG --backtitle "$BACKTITLE" --title "Burn image to Audio-CD" --exit-label "OK" \
  477                         --textbox $TEXTFILE 16 60
  478                     clear
  479                     $CDRDAO write --device $DEVICE --driver $DRVWDAO --speed $WRITESPEED "$CDNAME".toc
  480                     echo -e "\n${BLUE}Press any key${NOCOLOR}"
  481                     read -n1
  482                     LNSELECTED=$LNSELECTED+1
  483                     continue
  484                 # if WAVINFO exists burn the WAVs
  485                 elif [ -r "$IMGDIR/$WAVNAME/WAVINFO" ]; then
  486                     $CAT "$IMGDIR/$WAVNAME/WAVINFO" > $TEXTFILE
  487                     echo -e "\nTRACKLIST:\n" >> $TEXTFILE
  488                     $FIND "$IMGDIR/$WAVNAME/$WAVNAME".*.wav -printf "%f\n" >> $TEXTFILE
  489                     echo -e "\nInsert CD-R and press OK to burn disc $LNSELECTED of $MAXLNSELECTED" >> $TEXTFILE
  490                     $DIALOG --backtitle "$BACKTITLE" --title "Burn WAVs to Audio-CD" --exit-label "OK" \
  491                         --textbox $TEXTFILE 16 60
  492                     # quick and dirty method to set CDEXTRA according to WAVINFO
  493                     CDEXTRA="0"
  494                     $GREP "CD-Extra: yes" "$IMGDIR/$WAVNAME/WAVINFO" > /dev/null && CDEXTRA="1"
  495                     clear
  496 
  497                     # burn
  498                     burncdrecord # common.func
  499                     echo -e "\nCD $LNSELECTED of $MAXLNSELECTED: '$WAVNAME' finished"
  500                     echo -e "\n${BLUE}Press any key${NOCOLOR}"
  501                     read -n1
  502                     LNSELECTED=$LNSELECTED+1
  503                     continue
  504                 fi
  505                 # if no toc and no track.01.wav exists -> error
  506                 $DIALOG --backtitle "$BACKTITLE" --title "$ERROR" \
  507                     --msgbox "'WAVINFO' and 'IMAGEINFO' could not be found -> Check image!" 8 60
  508                 LNSELECTED=$LNSELECTED+1
  509             done
  510             MENULEVEL=0
  511         done
  512         ;;
  513 
  514 
  515         5)
  516         # Delete WAV/image files
  517         FILES=""
  518         while [ $MENULEVEL -ge 1 ]; do
  519             FILES=`$FIND "$IMGDIR" -mindepth 1 -maxdepth 1 -printf %f"\255"image"\255"off"\255"`
  520             if [ "$FILES" = "" ]; then
  521                 $DIALOG --backtitle "$BACKTITLE" --title "Delete WAV/image files" \
  522                     --msgbox "There are no files in your image directory." 7 60
  523                 MENULEVEL=0
  524                 continue
  525             fi
  526             IFS="$(echo -e "\0255")"
  527             $DIALOG --backtitle "$BACKTITLE" --title "Delete WAV/image files" --separate-output \
  528                 --checklist "Select file(s) with spacebar"  16 60 8 $FILES 2> $TEMPFILE
  529             if [ $? = "1" ]; then
  530                 IFS="$IFSBAK"
  531                 MENULEVEL=0
  532                 continue
  533             fi
  534             IFS="$IFSBAK"
  535             MAXLNSELECTED=`$GAWK 'END {print NR}' "$TEMPFILE"`
  536             if [ "$MAXLNSELECTED" = "0" ]; then
  537                 $DIALOG --backtitle "$BACKTITLE" --title "$ERROR" \
  538                     --msgbox "Nothing to delete. Please select something with spacebar first." 7 60
  539                 continue
  540             fi
  541             clear
  542             LNSELECTED=1
  543             while [ $LNSELECTED -le $MAXLNSELECTED ]; do
  544                 LINE=`$HEAD -$LNSELECTED "$TEMPFILE" | $TAIL -1`
  545                 LINE=`echo "$LINE" | $SED s/$'\r'//`
  546                 if [ "$LINE" = "" ]; then
  547                     echo "Cannot delete $IMGDIR"
  548                     LNSELECTED=$LNSELECTED+1
  549                     continue
  550                 fi
  551                 echo "WAV/image files: '$LINE'"
  552                 echo "Removing files..."
  553                 rm -r "$IMGDIR/$LINE"
  554                 echo -e "Done\n"
  555                 LNSELECTED=$LNSELECTED+1
  556             done
  557             echo -e "\n${BLUE}Press any key${NOCOLOR}"
  558             read -n1
  559             MENULEVEL=0
  560         done
  561         ;;
  562 
  563         6)
  564         testsource /usr/share/burncdda/setup.func
  565         bc_setup_menu # setup.func
  566         ;;
  567 
  568         7)
  569         # Exit
  570         MENULEVEL=-1
  571         ;;
  572     esac
  573 done
  574 clear
  575 exit0 # common.func
  576