[db_set] Added if statement for "all" condition to apply selection to all tracks

This commit is contained in:
ayakael 2018-05-15 23:22:28 -07:00
parent 1c9dc28a03
commit dc2f09d4e3
No known key found for this signature in database
GPG key ID: 575626A4AE5F4026

View file

@ -21,6 +21,11 @@ db_set() {
local SELECTED="${3}"; shift 3 local SELECTED="${3}"; shift 3
local CONDITION="${@}" local CONDITION="${@}"
if [[ "${CONDITION}" == "all" ]]; then
gawk -i inplace -v selected=${SELECTED} 'BEGIN{FS="\t";}{$1=selected}{print $0}' "${DB_FILE}"
return 0
fi
# Defines what imageids are imported into database, as we're only going to act on those # Defines what imageids are imported into database, as we're only going to act on those
local FIELD="$(echo ${CONDITION} | cut -d'=' -f1 | tr '[:lower:]' '[:upper:]' )" local FIELD="$(echo ${CONDITION} | cut -d'=' -f1 | tr '[:lower:]' '[:upper:]' )"
local VALUE="$(echo ${CONDITION} | cut -d'=' -f2 | tr '[:lower:]' '[:upper:]' )" local VALUE="$(echo ${CONDITION} | cut -d'=' -f2 | tr '[:lower:]' '[:upper:]' )"