Changed naming of options to and simplified parameters

This commit is contained in:
Jeroen De Meerleer 2019-03-16 17:51:57 +01:00
parent 25aa38222b
commit f44bfd0ef9
2 changed files with 14 additions and 15 deletions

View File

@ -13,11 +13,10 @@ Syncronises music from one folder to another.
Options: Options:
-s, --source <source> The source folder of the music -s, --source <source> The source folder of the music
-d, --dest <destination> The destionation folder of the music -d, --dest <destination> The destination folder of the music
-t, --temp <folder> The temporary cache for converted files (default: /tmp/converted) -t, --temp <folder> The temporary cache for converted files (default: /tmp/converted)
-c, --convert Convert files before syncing -c, --convert <bitrate> Convert files to a given bitrate in kbps before syncing (default: 192)
-a, --convert-art <width> Convert album-art before syncing (default width: 200) -a, --resize-art <width> Resize album-art before syncing (default width: 200)
-b, --bitrate When converting use this bitrate
-v, --verbose <0-6> Set log level (default: 2) -v, --verbose <0-6> Set log level (default: 2)
-h, --help Display this help text -h, --help Display this help text

View File

@ -60,8 +60,8 @@ CheckDeps() {
GetOptions() { GetOptions() {
# https://stackoverflow.com/a/29754866 # https://stackoverflow.com/a/29754866
OPTIONS=s:d:t:ca::b:v::h OPTIONS=s:d:t:c::a::v::h
LONGOPTS=source:,dest:,temp:,convert,convert-art::,bitrate:,verbose::,help LONGOPTS=source:,dest:,temp:,convert::,resize-art::,verbose::,help
# -use ! and PIPESTATUS to get exit code with errexit set # -use ! and PIPESTATUS to get exit code with errexit set
# -temporarily store output to be able to check for errors # -temporarily store output to be able to check for errors
@ -107,9 +107,14 @@ GetOptions() {
;; ;;
-c|--convert) -c|--convert)
convert=true convert=true
bitrate=192
if [[ $2 != "" ]]; then
bitrate=${2}
shift
fi
shift shift
;; ;;
-a|--convert-art) -a|--resize-art)
convertart=true convertart=true
coverartsize=200 coverartsize=200
if [[ $2 != "" ]]; then if [[ $2 != "" ]]; then
@ -118,10 +123,6 @@ GetOptions() {
fi fi
shift shift
;; ;;
-b|--bitrate)
bitrate="$2"
shift 2
;;
--) --)
shift shift
break break
@ -156,11 +157,10 @@ Usage() {
echo "" echo ""
echo "Options:" echo "Options:"
echo " -s, --source <source> The source folder of the music" echo " -s, --source <source> The source folder of the music"
echo " -d, --dest <destination> The destionation folder of the music" echo " -d, --dest <destination> The destination folder of the music"
echo " -t, --temp <folder> The temporary cache for converted files (default: /tmp/converted)" echo " -t, --temp <folder> The temporary cache for converted files (default: /tmp/converted)"
echo " -c, --convert Convert files before syncing" echo " -c, --convert <bitrate> Convert files to a given bitrate in kbps before syncing (default: 192)"
echo " -a, --convert-art <width> Convert album-art before syncing (default width: 200)" echo " -a, --resize-art <width> Resize album-art before syncing (default width: 200)"
echo " -b, --bitrate When converting use this bitrate"
echo " -v, --verbose <0-6> Set log level (default: 2)" echo " -v, --verbose <0-6> Set log level (default: 2)"
echo " -h, --help Display this help text" echo " -h, --help Display this help text"
echo "" echo ""