From 7172fbaf157358a6a5788460a2fdbd0bf454bae3 Mon Sep 17 00:00:00 2001 From: "EinvalSledge@gmail.com" Date: Thu, 19 Apr 2012 20:57:19 +0000 Subject: [PATCH] * Change the meaning of EXTRAVERBOSE; previously, it was a y/n option to make things more verbose. Add extra levels of verbosity (0, 1, 2 so far) and a new vvecho() function for callers to use. git-svn-id: http://abcde.googlecode.com/svn/trunk@319 a0fa61bc-5347-0410-a1a9-7f54aa4e1825 --- abcde | 29 ++++++++++++++++++++++++++--- abcde.1 | 10 ++++++---- abcde.conf | 4 ++-- changelog | 3 +++ 4 files changed, 37 insertions(+), 9 deletions(-) diff --git a/abcde b/abcde index 31e925a..3d69a30 100755 --- a/abcde +++ b/abcde @@ -2974,10 +2974,23 @@ do_cdspeed () # vecho [message] # -# vecho outputs a message if EXTRAVERBOSE is selected +# vecho outputs a message if EXTRAVERBOSE is 1 or more vecho () { -if [ x"$EXTRAVERBOSE" != "x" ]; then +if [ x"$EXTRAVERBOSE" != "x" ] && [ $EXTRAVERBOSE -gt 0 ] ; then + case $1 in + warning) shift ; log warning "$@" ;; + *) echo "$@" ;; + esac +fi +} + +# vvecho [message] +# +# vvecho outputs a message if EXTRAVERBOSE is 2 or more +vvecho () +{ +if [ x"$EXTRAVERBOSE" != "x" ] && [ $EXTRAVERBOSE -gt 1 ] ; then case $1 in warning) shift ; log warning "$@" ;; *) echo "$@" ;; @@ -3307,6 +3320,16 @@ if [ "$CDROM" = "" ] ; then fi fi +# We used to use EXTRAVERBOSE=y to turn on more debug output. Now +# that's changed to a number to allow for more control. If +# EXTRAVERBOSE=y, set it to 1 for backwards compatibility. +if [ "$EXTRAVERBOSE" = "y" ]; then + EXTRAVERBOSE=1 +fi +if [ "$EXTRAVERBOSE" = "n" ]; then + EXTRAVERBOSE=0 +fi + # Parse command line options #while getopts 1a:bc:C:d:Dehj:klLmMnNo:pPq:r:Rs:S:t:T:vVxw:W: opt ; do while getopts 1a:bBc:C:d:Defghj:klLmMnNo:pPq:r:s:S:t:T:UvVxX:w:W:z opt ; do @@ -3351,7 +3374,7 @@ while getopts 1a:bBc:C:d:Defghj:klLmMnNo:pPq:r:s:S:t:T:UvVxX:w:W:z opt ; do echo "abcde -h for extra help" exit ;; - V) EXTRAVERBOSE="y" ;; + V) EXTRAVERBOSE=$(($EXTRAVERBOSE + 1)) ;; x) EJECTCD="y" ;; X) CUE2DISCID="$OPTARG" ;; w) COMMENT="$OPTARG" ;; diff --git a/abcde.1 b/abcde.1 index ddab709..aade3bb 100644 --- a/abcde.1 +++ b/abcde.1 @@ -185,8 +185,9 @@ information, and we tag and add comments with Latin1 encoding. Show the version and exit .TP .B \-V -Be a bit more verbose. On slow networks the CDDB requests might give the -sensation nothing is happening. +Be more verbose. On slow networks the CDDB requests might give the +sensation nothing is happening. Add this more than once to make things +even more verbose. .TP .B \-x Eject the CD when all tracks have been read. See the EJECTCD configuration @@ -523,9 +524,10 @@ after all tracks have been read. It has no effect when CDROM is set to a flac file. .TP .B EXTRAVERBOSE -If set to "y", some operations which are usually now shown to the end user +If set to "1", some operations which are usually now shown to the end user are visible, such as CDDB queries. Useful for initial debug and if your -network/CDDB server is slow. +network/CDDB server is slow. Set to "2" or more for even more verbose +output. .SH EXAMPLES Possible ways one can call \fBabcde\fR: .TP diff --git a/abcde.conf b/abcde.conf index 94ab5c6..033146e 100644 --- a/abcde.conf +++ b/abcde.conf @@ -365,6 +365,6 @@ # distmp3host to be installed and running on all remote machines - see README) #REMOTEHOSTS=foo,bar,baz,quux,qiix -# Set to obtain some information about actions happening in the background +# Set to 1,2, etc. to obtain some information about actions happening in the background # Useful if you have a slow network or CDDB servers seem unresponsive. -#EXTRAVERBOSE=n +#EXTRAVERBOSE=0 diff --git a/changelog b/changelog index 2e0d1f6..69a06b4 100644 --- a/changelog +++ b/changelog @@ -20,6 +20,9 @@ abcde 2.5.1 UNRELEASED + Add suggested diskutil code to auto-detect the CD on OS X. (Closes issue 45). * Check that we have $CDDBTOOL before we start. (Closes issue 27). + * Change the meaning of EXTRAVERBOSE; previously, it was a y/n option + to make things more verbose. Add extra levels of verbosity (0, 1, 2 so + far) and a new vvecho() function for callers to use. [ Colin Tuckley ] * replace deprecated egrep with grep -E (Closes issue 24). -- 2.20.1