HEADERS: print headers only when requested
This commit is contained in:
		
							parent
							
								
									f58bfdde9c
								
							
						
					
					
						commit
						e8362b55da
					
				
					 2 changed files with 17 additions and 9 deletions
				
			
		| 
						 | 
				
			
			@ -31,6 +31,7 @@ The `time-file` must have this format:
 | 
			
		|||
* **NONUMBER**: if equals to 1, do not write song number
 | 
			
		||||
* **SEPARATOR**: (default: ' - '), write song number, with this separator
 | 
			
		||||
  example with SEPARATOR='_': song names will be 01_song.opus 02_song.opus…
 | 
			
		||||
* **HEADERS**: if equals to 1, print environment parameters (verbosity, simulation, etc.)
 | 
			
		||||
* **VERBOSITY** [0-3] (default: 1)\
 | 
			
		||||
  verbosity 0: no output except errors from ffmpeg\
 | 
			
		||||
  verbosity 1: simple indications on the current track being extracted\
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -173,6 +173,7 @@ usage(){
 | 
			
		|||
	echo "envvar: FORMAT [mp3,ogg,opus,…], see the ffmpeg documentation"
 | 
			
		||||
	echo "envvar: SEPARATOR [separator] (default: ' - '), write song number, with this separator"
 | 
			
		||||
	echo "        example with SEPARATOR='_': song names will be 01_song.opus 02_song.opus…"
 | 
			
		||||
	echo "envvar: HEADERS, if equals to 1, print environment parameters (verbosity, simulation, etc.)"
 | 
			
		||||
	echo "envvar: VERBOSITY [0-3] (default: 1)"
 | 
			
		||||
	echo "        verbosity 0: no output except errors from ffmpeg"
 | 
			
		||||
	echo "        verbosity 1: simple indications on the current track being extracted"
 | 
			
		||||
| 
						 | 
				
			
			@ -187,38 +188,44 @@ fi
 | 
			
		|||
command=$1
 | 
			
		||||
shift
 | 
			
		||||
 | 
			
		||||
header(){
 | 
			
		||||
	if [ "$HEADERS" = "1" ]; then
 | 
			
		||||
		echo $*
 | 
			
		||||
	fi
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
if [ "$FORMAT" = "" ]; then
 | 
			
		||||
	echo "default FORMAT: opus"
 | 
			
		||||
	header "default FORMAT: opus"
 | 
			
		||||
	FORMAT="opus"
 | 
			
		||||
else
 | 
			
		||||
	echo "FORMAT: $FORMAT"
 | 
			
		||||
	header "FORMAT: $FORMAT"
 | 
			
		||||
fi
 | 
			
		||||
 | 
			
		||||
if [ "$VERBOSITY" = "" ]; then
 | 
			
		||||
	echo "default VERBOSITY: 1"
 | 
			
		||||
	header "default VERBOSITY: 1"
 | 
			
		||||
	VERBOSITY=1
 | 
			
		||||
else
 | 
			
		||||
	echo "VERBOSITY level: $VERBOSITY"
 | 
			
		||||
	header "VERBOSITY level: $VERBOSITY"
 | 
			
		||||
fi
 | 
			
		||||
 | 
			
		||||
if [ "$NONUMBER" = "" ]; then
 | 
			
		||||
	echo "default NONUMBER: disabled"
 | 
			
		||||
	header "default NONUMBER: disabled"
 | 
			
		||||
	NONUMBER=0
 | 
			
		||||
 | 
			
		||||
	# Assume that there should be a separator.
 | 
			
		||||
	if [ "$SEPARATOR" = "" ]; then
 | 
			
		||||
		echo "default SEPARATOR: ' - '"
 | 
			
		||||
		header "default SEPARATOR: ' - '"
 | 
			
		||||
		SEPARATOR=" - "
 | 
			
		||||
	else
 | 
			
		||||
		echo "SEPARATOR: '$SEPARATOR'"
 | 
			
		||||
		header "SEPARATOR: '$SEPARATOR'"
 | 
			
		||||
	fi
 | 
			
		||||
else
 | 
			
		||||
	echo "NONUMBER: won't prefix tracks"
 | 
			
		||||
	header "NONUMBER: won't prefix tracks"
 | 
			
		||||
	SEPARATOR=""
 | 
			
		||||
fi
 | 
			
		||||
 | 
			
		||||
if [ "$SIMULATION" != "" ]; then
 | 
			
		||||
	echo "SIMULATION envvar is set: this is a simulation."
 | 
			
		||||
	header "SIMULATION envvar is set: this is a simulation."
 | 
			
		||||
fi
 | 
			
		||||
 | 
			
		||||
</dev/null xxd -p >/dev/null 2>/dev/null
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		
		Reference in a new issue