[gen_image] Now accepts the TARGET_DIR parameter

This commit is contained in:
ayakael 2018-05-18 16:03:42 -07:00
parent 762c49da89
commit d77ee127c8
No known key found for this signature in database
GPG key ID: 575626A4AE5F4026

View file

@ -6,13 +6,14 @@
# gen_image - Generates image from list of lossless audio files # gen_image - Generates image from list of lossless audio files
# #
# USAGE # USAGE
# gen_image <file_1> [<file_1>] [<...>] # gen_image </path/to/output/dir> <file_1> [<file_1>] [<...>]
# #
# DEPENDENCIES src/med_convert # DEPENDENCIES src/med_convert
# #
# } # }
gen_image() { gen_image() {
local TARGET_DIR="${1}"; shift
local fileList=("${@}") local fileList=("${@}")
if [[ ${#fileList[@]} -eq 1 ]]; then if [[ ${#fileList[@]} -eq 1 ]]; then
cat ${fileList[@]} > joined.flac cat ${fileList[@]} > joined.flac
@ -24,7 +25,7 @@ gen_image() {
echo ${fileList[@]} echo ${fileList[@]}
fileList=($(printf '%s\n' ${fileList[@]} | sed 's|flac|wav|')) fileList=($(printf '%s\n' ${fileList[@]} | sed 's|flac|wav|'))
echo ${fileList[@]} echo ${fileList[@]}
shntool join -O always ${fileList[@]} -o flac shntool join -O always ${fileList[@]} -d "${TARGET_DIR}" -o flac
[[ $? -ne 0 ]] && return 1 [[ $? -ne 0 ]] && return 1
return 2 return 2
fi fi