Want to get back to using exiv2 executable, but... ยป addkeys.sh.txt
| 1 |
#!/bin/bash |
|---|---|
| 2 |
tuna=0; catfood=0 |
| 3 |
function dav () {
|
| 4 |
echo -e "What text file will I be using?" |
| 5 |
read -er item |
| 6 |
f=$item |
| 7 |
while IFS="^" read -r f k |
| 8 |
do |
| 9 |
echo -e "File is \e[31m$f\e[0m" |
| 10 |
if [[ ! -f "$f" ]]; then |
| 11 |
echo "I don't see $f in this directory." |
| 12 |
echo "Moving to next list item." |
| 13 |
continue |
| 14 |
fi |
| 15 |
((catfood++)) |
| 16 |
dothedeed |
| 17 |
done<"$f" |
| 18 |
} |
| 19 |
function twokey () {
|
| 20 |
taxt=$(echo "$k" | cut -d, -f2) |
| 21 |
keycount=$(echo "$k" | tr ',' ' ' | wc -w) |
| 22 |
for keys in $(echo "$k" | tr ',' ' ' | wc -w) |
| 23 |
do |
| 24 |
echo "${keys}"
|
| 25 |
/usr/bin/exiv2 --keep -M"add Iptc.Application2.Keywords $taxt" -M"add Xmp.dc.subject $taxt" "$f" |
| 26 |
((taxt++)) |
| 27 |
done |
| 28 |
/usr/bin/exiv2 -g Iptc.Application2.Keywords -Pv "$f" |
| 29 |
} |
| 30 |
function dothedeed () {
|
| 31 |
echo -e "Adding Keywords to \e[5;42m$f\e[0m." |
| 32 |
echo -e "$f\t$k" |
| 33 |
keycount=$(echo "$k" | tr ',' ' ' | wc -w) |
| 34 |
echo "$f: There are $keycount keywords." |
| 35 |
echo "Here's the Keyword string." |
| 36 |
echo -e "$k" |
| 37 |
exiftool -sep "," -fast5 -overwrite_original_in_place -q -P -Keywords+="$k" -Subject+="$k" "$f" |
| 38 |
twokey |
| 39 |
((tuna++)) |
| 40 |
} |
| 41 |
|
| 42 |
echo "Uses Exiftool." |
| 43 |
echo |
| 44 |
|
| 45 |
dav |
| 46 |
echo "$tuna out of $catfood files were annotated with Keywords this time." |
| 47 |
|
| 48 |
#putk |
| 49 |
#echo "Here's the Keyword string." |
| 50 |
#echo -e "$k" |
| 51 |
|