-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcopyrighter.sh
executable file
·62 lines (54 loc) · 1.7 KB
/
copyrighter.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
#!/bin/sh
# Add copyright information to image files.
# Run on folder containing output from mstk.sh or applyflats.sh.
echo
echo -----------------------------------------------------
echo Copyrighter - The Multispectral Copyright Application
echo -----------------------------------------------------
echo " Hit CTRL + C to exit."
if [[ -z $fullcopyright ]]; then
# Get copyright information from user
while true; do
echo
read -p "Please enter the copyright holder's name: " copyright_name
read -p "Please enter the copyright year: " copyright_year
echo
echo "Select a copyright template:"
echo " 1) © $copyright_name, $copyright_year. All rights reserved."
echo " 2) © $copyright_name"
while true; do
read -p "Make a selection: " preset
case $preset in
[1] )
fullcopyright="© $copyright_name, $copyright_year. All rights reserved.";
break;;
[2] )
fullcopyright="© $copyright_name";
break;;
* ) echo "Please select from the list.";;
esac
done
echo "Your copyright will be saved as: $fullcopyright"
while true; do
read -p "Is this correct? (y/n) " yn
case $yn in
[YyNn] ) break;;
* ) echo "Please answer y or n.";;
esac
done
case $yn in
[Yy]* ) break;;
[Nn]* ) continue;;
esac
done
fi
# Build List
for file in $(find "$PWD" -type f \( -name "*.png" -or -name "*.jpg" -or -name "*.tif" \)); do
CURRENTCOPY=$(exiv2 -g Exif.Image.Copyright -Pt "$file")
if [[ $CURRENTCOPY != "$fullcopyright" ]]; then
printf "\r "
printf "\r$(date +"%F") :: $(date +"%T") :: Writing copyright metadata to $(basename "$file")..."
exiv2 -M"del Exif.Image.Copyright" -M"set Exif.Image.Copyright Ascii $fullcopyright" "$file"
fi
done
echo