3 . "$_EXEC/cgilite/storage.sh"
4 . "$_EXEC/indexmeta.sh"
7 for tn in $(seq 1 $(POST_COUNT tag)); do
8 newtags="${newtags},$(POST tag $tn)"
10 newtags="${newtags},$(POST newtag |tr -d '\r' |tr '\n' ,)"
11 [ "$(POST op)" = del ] && deltags="$newtags"
13 for select in $(seq 1 $(POST_COUNT select)); do
14 file="$_DATA/$ITEM/$(POST select $select |PATH)"
15 meta="${file%/*}/.index/meta"
17 read -r length width height tags comment fn <<-EOF
21 if [ ! "$deltags" ]; then
22 extags="$(printf '%s' "$newtags" |tr , '\n' |grep -e "^-" |cut -d: -f1 )"
23 tags="$(UNSTRING "${tags#tags=}" |tr , '\n' |grep -vwFe "$extags")"
24 if printf %s "$extags" |grep -vq :; then
25 tags="$(printf %s\\n "$tags" |grep -vE '^-[^:]+$')"
27 tags="$(printf '%s\n' "${tags},${newtags}" \
28 | tr , '\n' |sort -u |tr '\n' , \
31 tags="$(UNSTRING "${tags#tags=}" |tr , '\n')"
32 detag="${deltags},"; while [ "$detag" ]; do
33 tags="$(printf '%s\n' "$tags" |grep -vxFe "${detag%%,*}")"
36 tags="$(printf '%s\n' "$tags" |sort -u |tr '\n' , |STRING)"
38 tags="${tags#,}"; tags="${tags%,}"
41 grep -avF " $fn" "$meta" >"${meta}.tmp"
43 printf '%i %i %i tags=%s comment=%s %s\n' \
44 "$length" "$width" "$height" "$tags" \
45 "${comment#comment=}" "$fn" \
47 mv "${meta}.tmp" "$meta"