[cmd_update][db_update][parser][help/deploy] Added --include option to export newly added images
This commit is contained in:
parent
e20e51be41
commit
0e9c733b50
4 changed files with 13 additions and 3 deletions
|
@ -5,3 +5,5 @@ Deploys tracks to target folder, with applies metadata and cover image
|
|||
Options
|
||||
--from <old commit hash>
|
||||
Defines what what commit should dam deploy from. Defaults to when last succesfull deploy occured.
|
||||
--include
|
||||
Includes new images in next export
|
||||
|
|
|
@ -13,6 +13,7 @@
|
|||
# }
|
||||
|
||||
cmd_update() {
|
||||
[[ "${1}" == "--include" ]] && { local INCLUDE=true; shift; }
|
||||
local GIT_DIR="${1}"
|
||||
local TARGET="${2}"
|
||||
local OLD_COMMIT="${3}"
|
||||
|
@ -36,7 +37,7 @@ cmd_update() {
|
|||
local COUNT=1
|
||||
for imageid in ${imageidList[@]}; do
|
||||
echo "[ ${COUNT} / ${#imageidList[@]} ] Processing ${imageid}"
|
||||
db_update "${GIT_DIR}" "${TARGET}" "${DB_FILE}" ${imageid} >${STDERR} 2>&1
|
||||
db_update $([[ ${INCLUDE} ]] && echo "--include") "${GIT_DIR}" "${TARGET}" "${DB_FILE}" ${imageid} >${STDERR} 2>&1
|
||||
local EXIT=$?
|
||||
[[ ${EXIT} -eq 0 ]] && { _ansi up 2; echo -en '\033[K'; echo "[ ${COUNT} / ${#imageidList[@]} ] Added ${imageid}"; }
|
||||
[[ ${EXIT} -eq 1 ]] && { _ansi up 2; echo -en '\033[K'; echo "[ ${COUNT} / ${#imageidList[@]} ] Removed ${imageid}"; }
|
||||
|
|
|
@ -11,6 +11,7 @@
|
|||
# }
|
||||
|
||||
db_update() {
|
||||
[[ "${1}" == "--include" ]] && { local INCLUDE=true; shift; }
|
||||
local GIT_DIR="${1}"
|
||||
local TARGET="${2}"
|
||||
local DB_FILE="${3}"
|
||||
|
@ -24,7 +25,8 @@ db_update() {
|
|||
fi
|
||||
for trackid in ${trackidList[@]}; do
|
||||
if [[ -z $(awk -v imageid="${IMAGEID}" -v trackid="${trackid}" 'BEGIN{FS="\t"}{if($2==imageid && $3==trackid){print $0}}' ${DB_FILE}) ]]; then
|
||||
echo -e "false\t${IMAGEID}\t${trackid}\tnull" >> ${DB_FILE}
|
||||
[[ ${INCLUDE} ]] && echo -en "true" >> ${DB_FILE} || echo -en "false" >> ${DB_FILE}
|
||||
echo -e "\t${IMAGEID}\t${trackid}\tnull" >> ${DB_FILE}
|
||||
fi
|
||||
done
|
||||
return 0
|
||||
|
|
|
@ -129,6 +129,11 @@ case "${1}" in
|
|||
shift
|
||||
;;
|
||||
|
||||
--include)
|
||||
INCLUDE=true
|
||||
shift
|
||||
;;
|
||||
|
||||
*)
|
||||
TARGET="${1}"
|
||||
shift
|
||||
|
@ -136,7 +141,7 @@ case "${1}" in
|
|||
esac
|
||||
done
|
||||
|
||||
cmd_update "${_GIT_DIR}" "${TARGET}" "${OLD_COMMIT}"
|
||||
cmd_update $([[ ${INCLUDE} ]] && echo "--include") "${_GIT_DIR}" "${TARGET}" "${OLD_COMMIT}"
|
||||
EXIT=$?
|
||||
[[ ${EXIT} -eq 0 ]] && echo "Update completed successfully"
|
||||
[[ ${EXIT} -eq 1 ]] && echo "Update completed with errors"
|
||||
|
|
Loading…
Reference in a new issue