[deploy_meta] Exit with code 1 when either checks have failed (i.e, when path is wrong or applied metada is different)
This commit is contained in:
parent
df25a5c2bd
commit
3e6cec87fd
1 changed files with 4 additions and 0 deletions
|
@ -16,6 +16,7 @@ deploy_meta() {
|
|||
local TARGET="${2}"
|
||||
local DB_FILE="${3}"
|
||||
local IMAGEID="${4}"
|
||||
local ERR=false
|
||||
|
||||
local trackidList=($(awk -v imageid=${IMAGEID} 'BEGIN{FS="\t"}{if($1=="true" && $2==imageid){print $3}}' ${DB_FILE}))
|
||||
for trackid in ${trackidList[@]}; do
|
||||
|
@ -29,6 +30,7 @@ deploy_meta() {
|
|||
|
||||
# If the PRESENT_META and FUTURE_META diverge, wipe the old metadata, and reapply
|
||||
if [[ "${PRESENT_META}" != "${FUTURE_META}" ]]; then
|
||||
local ERR=true
|
||||
_msg ECHO "${trackid} has differing metadata. Updating"
|
||||
[[ "${PRESENT_PATH}" == "null" ]] || metaflac --remove-all "${TARGET}/${PRESENT_PATH}"
|
||||
awk 'BEGIN {RS=";"}{print $0}' <<< ${FUTURE_META} | head -n -1 | metaflac --import-tags-from=- --import-picture-from="${GIT_DIR}/${IMAGEID}.jpg" "${TARGET}/${PRESENT_PATH}"
|
||||
|
@ -36,6 +38,7 @@ deploy_meta() {
|
|||
|
||||
# If the PRESENT_PATH and FUTURE_PATH diverge, move to new location
|
||||
if [[ "${PRESENT_PATH}" != "${FUTURE_PATH}" ]]; then
|
||||
local ERR=true
|
||||
_msg ECHO "${trackid} has differing paths. Moving"
|
||||
mkdir -p "$(dirname "${TARGET}/${FUTURE_PATH}")"
|
||||
mv "${TARGET}/${PRESENT_PATH}" "${TARGET}/${FUTURE_PATH}"
|
||||
|
@ -43,4 +46,5 @@ deploy_meta() {
|
|||
gawk -i inplace -v trackid=${trackid} -v value="${FUTURE_PATH}" 'BEGIN{FS="\t";OFS="\t"}{if($3==trackid){$4=value}{print $0}}' ${DB_FILE}
|
||||
fi
|
||||
done
|
||||
[[ "${ERR}" == "true" ]] && return 1 || return 0
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue