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
20 tags="$(UNSTRING "${tags#tags=}" |tr , '\n')"
22 if [ ! "$deltags" ]; then
23 tags="$(printf '%s\n' "${tags},${newtags}" \
24 | tr , '\n' |sort -u |tr '\n' , \
27 detag="${deltags},"; while [ "$detag" ]; do
28 tags="$(printf '%s\n' "$tags" |grep -vxFe "${detag%%,*}")"
31 tags="$(printf '%s\n' "$tags" |sort -u |tr '\n' , |STRING)"
33 tags="${tags#,}"; tags="${tags%,}"
36 grep -avF " $fn" "$meta" >"${meta}.tmp"
38 printf '%i %i %i tags=%s comment=%s %s\n' \
39 "$length" "$width" "$height" "$tags" \
40 "${comment#comment=}" "$fn" \
42 mv "${meta}.tmp" "$meta"