|| errlog "missing workdir could not cleanup" \
|| return $?
- find $workdir -name '*.flac' -exec rm {} \;
+ find "$workdir" -name '*.flac' -exec rm {} \;
}
cleanup_cover()
|| errlog "missing workdir could not cleanup" \
|| return $?
- find $workdir -name 'cover.txt' -exec rm {} \;
+ find "$workdir" -name 'cover.txt' -exec rm {} \;
[ "$cover" == "false" ] \
|| return 0
- find $WORKDIR -name 'cover.jpg' -exec rm {} \;
+ find "$workdir" -name 'cover.jpg' -exec rm {} \;
}
make_symlinks_to_work()
local workdir="$2"
local musicpath="$3"
- for album in $(cat $albumlist); do
+ while IFS= read -r album; do
[ -d "$musicpath/$album" ] \
|| errlog "directory $musicpath/$album does not exists" \
|| return $?
cp --recursive \
--symbolic-link \
- $musicpath/$album \
- $workdir \
+ "$musicpath/$album" \
+ "$workdir" \
|| errlog "could not copy symlinks from $musicpath/$album" \
|| return $?
rsync --recursive \
--owner \
--exclude="*.flac" \
--include="cover.jpg" \
- $musicpath/$album \
- $workdir \
+ "$musicpath/$album" \
+ "$workdir" \
|| errlog "could not copy etc like cover" \
|| return $?
- done
+ done < "$albumlist"
}
load_config()
|| errlog "file $HOME/.albentohandy.conf does not exists" \
|| return $?
- source $HOME/.albentohandy.conf
+ # shellcheck disable=SC1091
+ source "$HOME/.albentohandy.conf"
}
check_programms()
[ -f "$LIBS/$lib" ] \
|| errlog "file $LIBS/$lib does not exists" \
|| return $?
+ # shellcheck disable=SC1090
source "$LIBS/$lib" || return $?
mkdir -p "$workdir"
cover=false
- while getopts "3cfg:hi:m:orw:" optname; do
+ while getopts "3cfho" optname; do
case "$optname" in
"3") format="mp3" ;;
"c") cover=true ;;
"f") format="flac" ;;
"h") Usage && return 0 ;;
"o") format="opus" ;;
+ "*") echo "unkwnon parameter" ;;
esac
done
convert_process "$format" || return $$
}
-main $*
+main "$@"