"Fossies" - the Fresh Open Source Software Archive

Member "burncdda-1.8.3/setup.func" (17 May 2011, 8946 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.

A hint: This file contains one or more very long lines, so maybe it is better readable using the pure text view mode that shows the contents as wrapped lines within the browser window.


    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 # Edit path function
   23 bc_setup_expert_path()
   24 {
   25 MENULEVEL=3
   26 while [ $MENULEVEL -ge 3 ]; do
   27     $DIALOG --backtitle "$BACKTITLE" --title "Setup - Expert - Pathes" \
   28         --menu "THIS DOES NOT WORK YET" 20 60 13 \
   29     "S Save settings to" "/etc/burncdda.conf" \
   30     "------------------" "------------------" \
   31     "1 cdrecord" "$CDRECORD" \
   32     "2 cdrdao" "$CDRDAO" \
   33     "----------" "----------" \
   34     "3 mplayer" "$MPLAYER" \
   35     "4 normalize" "$NORMALIZE" \
   36     "5 mp3_check" "$MP3_CHECK" \
   37     "6 ogginfo" "$OGGINFO" \
   38     "7 flac (for filecheck)" "$FLACCHK" \
   39     "8 mpg321" "$MPG321" \
   40     "9 oggdec" "$OGGDEC" \
   41     "10 flac (for decoding)" "$FLACDEC" \
   42     "11 mppdec" "$MPPDEC" \
   43     "12 sox" "$SOX" \
   44     "----------" "----------" \
   45     "13 gawk" "$GAWK" \
   46     "14 dialog" "$DIALOG" \
   47     "15 find" "$FIND" \
   48     "16 grep" "$GREP" \
   49     "17 head" "$HEAD" \
   50     "18 mktemp" "$MKTEMP" \
   51     "19 nice" "$NICE" \
   52     "20 sed" "$SED" \
   53     "21 sort" "$SORT" \
   54     "22 tail" "$TAIL" \
   55     "23 tr" "$TR" \
   56     "24 wc" "$WC" \
   57     "25 Back" "Setup menu" 2> $TEMPFILE
   58 
   59     # if cancel exit menu
   60     if [ $? = "1" ]; then
   61         MENULEVEL=1
   62         continue
   63     fi
   64 
   65     CHOICE=`$CAT $TEMPFILE`
   66 
   67     case $CHOICE in
   68         *)
   69         MENULEVEL=2
   70         continue
   71         ;;
   72     esac
   73 done
   74 }
   75 
   76 # Expert menu function
   77 bc_setup_expert()
   78 {
   79 MENULEVEL=2
   80 while [ $MENULEVEL -ge 2 ]; do
   81     $DIALOG --backtitle "$BACKTITLE" --title "Setup - Expert" --menu "THIS DOES NOT WORK YET" 18 60 11 \
   82     "S Save settings to" "/etc/burncdda.conf" \
   83     "----------------------" "------------------" \
   84     "1 Nice level" "$NICELEVEL" \
   85     "2 Normalize amplitude" "$NORMAMP" \
   86     "3 cdrecord driver opts" "$DRIVEROPTS" \
   87     "4 cdrecord other opts" "$OTHERREC" \
   88     "5 cdrdao read driver" "$DRVRDAO" \
   89     "6 cdrdao write driver" "$DRVWDAO" \
   90     "7 cdrdao paranioa mode" "$PARANOIAMODE" \
   91     "----------------------" "------------------" \
   92     "P Edit program pathes" "path sub menu" 2> $TEMPFILE
   93 
   94     # if cancel exit menu
   95     if [ $? = "1" ]; then
   96         MENULEVEL=1
   97         continue
   98     fi
   99 
  100     CHOICE=`$CAT $TEMPFILE`
  101 
  102     case $CHOICE in
  103         "P Edit program pathes")
  104         bc_setup_expert_path
  105         ;;
  106 
  107         *)
  108         MENULEVEL=1
  109         continue
  110         ;;
  111     esac
  112 done
  113 }
  114 
  115 # save settings to /etc/burncdda.conf
  116 function savesettings()
  117 {
  118 clear
  119 echo "Saving /etc/burncdda.conf"
  120 echo "Please enter your root password..."
  121 $SU -c "$SED -i \
  122     -e "s°^COLORS=.*°COLORS=\"$COLORS\"°" \
  123     -e "s°^WRITESPEED=.*°WRITESPEED=\"$WRITESPEED\"°" \
  124     -e "s°^DEVICE=.*°DEVICE=\"$DEVICE\"°" \
  125     -e "s°^NORMAMP=.*°NORMAMP=\"$NORMAMP\"°" \
  126     -e "s°^CDRECORD=.*°CDRECORD=\"$CDRECORD\"°" \
  127     /etc/burncdda.conf"
  128 if [ $? != "0" ]; then
  129     echo -e "\n${RED}Error:${NOCOLOR} Failed to save '/etc/burncdda.conf'!\n"
  130 else
  131     CONFCHANGED="0"
  132     readconfig
  133     consolecolors
  134     echo -e "\n${GREEN}Saved${NOCOLOR}\n"
  135 fi
  136 echo -e "${BLUE}Press any key${NOCOLOR}"
  137 read -n1
  138 }
  139 
  140 
  141 #
  142 # Setup menu function
  143 #
  144 bc_setup_menu()
  145 {
  146 CONFCHANGED="0"
  147 while [ $MENULEVEL -ge 1 ]; do
  148     $DIALOG --backtitle "$BACKTITLE" --title "Setup" --menu "What do you want to edit?" 16 60 9 \
  149     "S Save settings to" "/etc/burncdda.conf" \
  150     "----------------------" "----------------------" \
  151     "1 Console colors" "$COLORS" \
  152     "2 CD writing speed" "$WRITESPEED" \
  153     "3 CD writer device" "$DEVICE" \
  154     "4 Normalize amplitude" "$NORMAMP" \
  155     "5 cdrecord executable" "$CDRECORD" \
  156     "----------------------" "----------------------" \
  157     "V View" "/etc/burncdda.conf" 2> $TEMPFILE
  158 
  159     # if cancel exit menu
  160     if [ $? = "1" ]; then
  161         MENULEVEL=0
  162         # if config has changed ask if it should be saved
  163         if [ "$CONFCHANGED" = "1" ]; then
  164             $DIALOG --backtitle "$BACKTITLE" --title "Setup" \
  165                 --yesno "Do you want to save your settings?" 6 60
  166             # yes: save settings
  167             if [ $? = "0" ]; then
  168                 savesettings
  169             # no: reload config to restore old settings
  170             else
  171                 readconfig
  172             fi
  173         fi
  174         continue
  175     fi
  176 
  177     CHOICE=`$CAT $TEMPFILE`
  178 
  179     case $CHOICE in
  180         "S Save settings to")
  181         savesettings
  182         ;;
  183 
  184         "1 Console colors")
  185         RADIOLISTOPTS=""
  186         for TEMPVAR in BRIGHT DARK NO; do
  187             if [ "$TEMPVAR" = "$COLORS" ]; then
  188                 RADIOLISTOPTS="$RADIOLISTOPTS $TEMPVAR colors on"
  189             else
  190                 RADIOLISTOPTS="$RADIOLISTOPTS $TEMPVAR colors off"
  191             fi
  192         done
  193         $DIALOG --backtitle "$BACKTITLE" --title "Setup -> Console colors" \
  194             --radiolist "Some output is colored. Choose if these colors should be 'BRIGHT' (if you have a dark terminal background), 'DARK' (if you have a bright terminal background) or if 'NO' colors should be used. Default: 'BRIGHT'" 14 60 3 $RADIOLISTOPTS 2> $TEMPFILE
  195         if [ $? = "1" ]; then
  196             continue
  197         fi
  198         # get new value and test if it has changed
  199         TEMPVAR=`$CAT $TEMPFILE`
  200         if [ "$TEMPVAR" != "$COLORS" ]; then
  201             COLORS="$TEMPVAR"
  202             CONFCHANGED="1"
  203         fi
  204         ;;
  205 
  206         "2 CD writing speed")
  207         # write speed -1 should be showed as Max, the x is added in the next step
  208         if [ "$WRITESPEED" = "-1" ]; then
  209             WRITESPEED="Ma"
  210         fi
  211         RADIOLISTOPTS=""
  212         for TEMPVAR in 2 4 8 16 32 Ma; do
  213             if [ "$TEMPVAR" = "$WRITESPEED" ]; then
  214                 RADIOLISTOPTS="$RADIOLISTOPTS ${TEMPVAR}x speed on"
  215             else
  216                 RADIOLISTOPTS="$RADIOLISTOPTS ${TEMPVAR}x speed off"
  217             fi
  218         done
  219         $DIALOG --backtitle "$BACKTITLE" --title "Setup -> CD writing speed" \
  220             --radiolist "This defaults to '16x' at the moment because most drives (except very old ones) can write at this speed and it should provide a good writing quality. Even old car CD players should play the CDs. Otherwise you can use 'Max' (-1) and let cdrecord use its internal drive specific maximum speed defaults." 18 60 6 $RADIOLISTOPTS 2> $TEMPFILE
  221         if [ $? = "1" ]; then
  222             continue
  223         fi
  224         # # get new value and remove the x from 2x, 4x, ..., Max
  225         TEMPVAR=`$CAT $TEMPFILE | $SED -e 's°x$°°'`
  226         # if write speed is Ma(x) set it to -1 again
  227         if [ "$TEMPVAR" = "Ma" ]; then
  228             TEMPVAR="-1"
  229         fi
  230         # test if it has changed
  231         if [ "$TEMPVAR" != "$WRITESPEED" ]; then
  232             WRITESPEED="$TEMPVAR"
  233             CONFCHANGED="1"
  234         fi
  235         ;;
  236 
  237         "3 CD writer device")
  238         $DIALOG --backtitle "$BACKTITLE" --title "Setup -> CD writer device" \
  239             --inputbox "CD writer device. Examples: '/dev/cdrom', '/dev/sr0', '0,0,0' or 'ATAPI:0,0,0'. The right setting depends on your kernel version and configuration. On modern systems the default setting should work. Default: '/dev/cdrom'" 11 60 $DEVICE 2> $TEMPFILE
  240         if [ $? = "1" ]; then
  241             continue
  242         fi
  243         # get new value and test if it has changed
  244         TEMPVAR=`$CAT $TEMPFILE | $SED -e 's°^ *°°' -e 's° *$°°'`
  245         if [ "$TEMPVAR" != "$DEVICE" ]; then
  246             DEVICE="$TEMPVAR"
  247             CONFCHANGED="1"
  248         fi
  249         ;;
  250 
  251         "4 Normalize amplitude")
  252         RADIOLISTOPTS=""
  253         for TEMPVAR in -12dbfs -10dbfs -8dbfs; do
  254             if [ "$TEMPVAR" = "$NORMAMP" ]; then
  255                 RADIOLISTOPTS="$RADIOLISTOPTS $TEMPVAR amplitude on"
  256             else
  257                 RADIOLISTOPTS="$RADIOLISTOPTS $TEMPVAR amplitude off"
  258             fi
  259         done
  260         $DIALOG --backtitle "$BACKTITLE" --title "Setup -> Normalize amplitude" \
  261             --radiolist "Quick help: '-12dbfs': very low volume, recommended for classical music; '-10dbfs': burnCDDA default, medium output volume, recommended for pop/rock; '-8dbfs': high output volume, will surely result in clipping. You can search the web for 'volume race' to get more information about output volumes and why you should not set it too high. Default: '-10dbfs'" 15 60 4 $RADIOLISTOPTS 2> $TEMPFILE
  262         if [ $? = "1" ]; then
  263             continue
  264         fi
  265         # get new value and test if it has changed
  266         TEMPVAR=`$CAT $TEMPFILE`
  267         if [ "$TEMPVAR" != "$NORMAMP" ]; then
  268             NORMAMP="$TEMPVAR"
  269             CONFCHANGED="1"
  270         fi
  271         ;;
  272 
  273         "5 cdrecord executable")
  274         $DIALOG --backtitle "$BACKTITLE" --title "Setup -> cdrecord executable" \
  275             --inputbox "If you want to use cdrkit instead of cdrtools try 'wodim' (untested). It is also possible to specify the full path, e.g. '/opt/cdrtools/bin/cdrecord'" 11 60 $CDRECORD 2> $TEMPFILE
  276         if [ $? = "1" ]; then
  277             continue
  278         fi
  279         # get new value and test if it has changed
  280         TEMPVAR=`$CAT $TEMPFILE | $SED -e 's°^ *°°' -e 's° *$°°'`
  281         if [ "$TEMPVAR" != "$CDRECORD" ]; then
  282             CDRECORD="$TEMPVAR"
  283             CONFCHANGED="1"
  284         fi
  285         ;;
  286 
  287         "V View")
  288         $DIALOG --backtitle "$BACKTITLE" --title "Setup -> View /etc/burncdda.conf" \
  289             --textbox /etc/burncdda.conf 20 75
  290         ;;
  291 
  292         *)
  293         continue
  294         ;;
  295     esac
  296 done
  297 }
  298