2018-04-08 16:31:53 -04:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
# doc gen_image {
|
|
|
|
#
|
|
|
|
# DESCRIPTION
|
|
|
|
# gen_image - Generates image from list of lossless audio files
|
|
|
|
#
|
|
|
|
# USAGE
|
|
|
|
# gen_image <file_1> [<file_1>] [<...>]
|
|
|
|
#
|
|
|
|
# }
|
|
|
|
|
|
|
|
gen_image() {
|
|
|
|
local fileList=("${@}")
|
|
|
|
if [[ ${#fileList[@]} -eq 1 ]]; then
|
|
|
|
cat ${fileList[@]} > joined.flac
|
|
|
|
else
|
|
|
|
shntool join -O always ${fileList[@]} -o flac
|
|
|
|
if [[ $? -ne 0 ]]; then
|
|
|
|
med_convert wav ${fileList[@]}
|
2018-05-18 12:37:03 -07:00
|
|
|
[[ $? -ne 0 ]] && return 1
|
2018-04-08 16:31:53 -04:00
|
|
|
echo ${fileList[@]}
|
|
|
|
fileList=($(printf '%s\n' ${fileList[@]} | sed 's|flac|wav|'))
|
|
|
|
echo ${fileList[@]}
|
|
|
|
shntool join -O always ${fileList[@]} -o flac
|
2018-05-18 12:37:03 -07:00
|
|
|
[[ $? -ne 0 ]] && return 1
|
|
|
|
return 2
|
2018-04-08 16:31:53 -04:00
|
|
|
fi
|
|
|
|
fi
|
2018-05-18 12:37:03 -07:00
|
|
|
return 0
|
2018-04-08 16:31:53 -04:00
|
|
|
}
|
|
|
|
|