for tn in $(seq 1 $(POST_COUNT tag)); do
newtags="${newtags},$(POST tag $tn)"
done
-newtags="${newtags},$(POST newtag |tr -d '\r')"
+newtags="${newtags},$(POST newtag |tr -d '\r' |tr '\n' ,)"
+[ "$(POST op)" = del ] && deltags="$newtags"
for select in $(seq 1 $(POST_COUNT select)); do
file="$_DATA/$ITEM/$(POST select $select |PATH)"
read -r length width height tags comment fn <<-EOF
$(meta_info "$file")
EOF
-
- tags="$(UNSTRING "${tags#tags=}")"
- tags="$(printf '%s\n' "${tags}" "${newtags}" |tr , '\n' |sort -u |tr '\n' , |STRING)"
+ tags="$(UNSTRING "${tags#tags=}" |tr , '\n')"
+
+ if [ ! "$deltags" ]; then
+ tags="$(printf '%s\n' "${tags},${newtags}" \
+ | tr , '\n' |sort -u |tr '\n' , \
+ | STRING)"
+ else
+ detag="${deltags},"; while [ "$detag" ]; do
+ tags="$(printf '%s\n' "$tags" |grep -vxFe "${detag%%,*}")"
+ detag="${detag#*,}"
+ done
+ tags="$(printf '%s\n' "$tags" |sort -u |tr '\n' , |STRING)"
+ fi
tags="${tags#,}"; tags="${tags%,}"
if LOCK "$meta"; then