Added _msg functions to deploy_imageid and update_db
This commit is contained in:
parent
35f92513dd
commit
1ded1a99e0
3 changed files with 10 additions and 4 deletions
|
@ -21,9 +21,11 @@ deploy_imageid() {
|
|||
|
||||
local trackidList=($(awk -v imageid=${IMAGEID} 'BEGIN{FS="\t"}{if($2==imageid){print $3}}' ${DB_FILE}))
|
||||
for trackid in ${trackidList[@]}; do
|
||||
_msg ECHO "Processing ${trackid} of ${IMAGEID}"
|
||||
_msg EXEC "Processing ${trackid} of ${IMAGEID}"
|
||||
deploy_trackid ${GIT_DIR} ${TARGET} ${DB_FILE} ${IMAGEID} ${trackid}
|
||||
[[ $? -ne 0 ]] && { _msg WARN; local ERR=true; } || _msg OK
|
||||
done
|
||||
[[ ${ERR} ]] && return 1 || return 0
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -40,7 +40,7 @@ deploy_trackid() {
|
|||
|
||||
# If the PRESENT_META and FUTURE_META diverge, wipe the old metadata, and reapply
|
||||
if [[ "${PRESENT_META}" != "${FUTURE_META}" ]]; then
|
||||
_msg ECHO "${TRACKID} has different metadata. Updating"
|
||||
_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}"
|
||||
fi
|
||||
|
@ -50,6 +50,7 @@ deploy_trackid() {
|
|||
_msg ECHO "${TRACKID} has differing paths. Moving"
|
||||
mkdir -p "$(dirname "${TARGET}/${FUTURE_PATH}")"
|
||||
mv "${TARGET}/${PRESENT_PATH}" "${TARGET}/${FUTURE_PATH}"
|
||||
rmdir -p --ignore-fail-on-non-empty "$(dirname "${TARGET}/${PRESENT_PATH}")"
|
||||
awk -v rowno=${ROW_NO} -v value="${FUTURE_PATH}" 'BEGIN{FS="\t";OFS="\t"}{if(NR==rowno){$4=value}{print $0}}' ${DB_FILE} > ${DB_FILE}.tmp; mv ${DB_FILE}.tmp ${DB_FILE}
|
||||
fi
|
||||
|
||||
|
@ -63,5 +64,4 @@ deploy_trackid() {
|
|||
rm "${GIT_DIR}/${IMAGEID}-${TRACKID}.flac"
|
||||
fi
|
||||
fi
|
||||
return 0
|
||||
}
|
||||
|
|
|
@ -20,7 +20,11 @@ update_db() {
|
|||
for imageid in ${imageidList[@]}; do
|
||||
trackidList=($(awk 'BEGIN{FS="\" : \"";RS="\",\n * \""}{if($1=="TRACKID"){print $2}}' ${GIT_DIR}/${imageid}.tags))
|
||||
for trackid in ${trackidList[@]}; do
|
||||
[[ -z $(awk -v imageid="${imageid}" -v trackid="${trackid}" 'BEGIN{FS="\t"}{if($2==imageid && $3==trackid){print $0}}' ${DB_FILE}) ]] && echo -e "true\t${imageid}\t${trackid}\tnull" >> ${DB_FILE}
|
||||
if [[ -z $(awk -v imageid="${imageid}" -v trackid="${trackid}" 'BEGIN{FS="\t"}{if($2==imageid && $3==trackid){print $0}}' ${DB_FILE}) ]]; then
|
||||
_msg ECHO "Adding ${trackid} of ${imageid} to database file"
|
||||
echo -e "true\t${imageid}\t${trackid}\tnull" >> ${DB_FILE}
|
||||
fi
|
||||
done
|
||||
done
|
||||
return 0
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue