05-08-2024

This commit is contained in:
2024-08-05 23:28:29 +02:00
parent b58bf60fe5
commit 38228e615c

View File

@@ -25,8 +25,8 @@ flickr=true # "Bécasseau variable" "Le Teich" Bird
ccpx=true # Bécasseau variable, Le Teich, Bird
gps=0
opt_gps=true # insert gps data (false: gps data will be deleted in file)
opt_copyright=true # insert copyright, artist, creator (false: data will be deleted in file)
opt_gps=false # insert gps data (false: gps data will be deleted in file)
opt_copyright=false # insert copyright, artist, creator (false: data will be deleted in file)
# Default: all tags
opt_others=false
@@ -35,7 +35,7 @@ opt_model=false
opt_region=false
opt_nature=false
opt_wildlife=false
opt_all=true # default
opt_all=false # default
# Google maps static
zoom=10
@@ -113,6 +113,8 @@ showHelp() {
echo -e " ${green}-n${reset}, ${green}--nature${reset} Add nature related keywords"
echo -e " ${green}-r${reset}, ${green}--region${reset} Add region related keywords"
echo -e " ${green}-c${reset}, ${green}--copyright${reset} Delete artist and copyright in file"
echo -e " ${green}-c${reset}, ${green}--gps${reset} Delete gps infos in file"
echo -e " ${green}-c${reset}, ${green}--all${reset} All options are true"
echo -e " ${green}-t${reset} <keywords> Add some additionnals keywords"
echo -e " ${green}-w${reset}, ${green}--wildlife${reset} Add wildlife related keywords"
echo -e " ${green}-h${reset}, ${green}--help${reset} Display this help"
@@ -144,6 +146,7 @@ showHelp() {
echo -e " v3.1: display thumb"
echo -e " v3.2: suppress copyright and artist infos"
echo -e " v3.3: add a static Google maps for geoloc"
echo -e " v3.4: by default, no keywords are displayed. Add option --all to display all keywords"
}
# https://stackoverflow.com/questions/402377/using-getopts-to-process-long-and-short-command-line-options
@@ -169,6 +172,8 @@ do
;;
model) opt_model=true;;
lens) opt_lens=true;;
gps) opt_gps=true;;
all) opt_all=true;;
copyright) opt_copyright=false;;
*)
if [ "$OPTERR" = 1 ] && [ "${optspec:0:1}" = ":" ]; then
@@ -180,7 +185,7 @@ do
w) opt_wildlife=true;;
n) opt_nature=true;;
r) opt_region=true;;
c) opt_copyright=false;;
c) opt_copyright=true;;
f) file="${OPTARG}";;
t) tags=("$OPTARG")
until [[ $(eval "echo \${$OPTIND}") =~ ^-.* ]] || [ -z $(eval "echo \${$OPTIND}") ]; do
@@ -190,6 +195,8 @@ do
;;
m) opt_model=true;;
l) opt_lens=true;;
g) opt_gps=true;;
a) opt_all=true;;
h)
showHelp
exit 0
@@ -204,8 +211,17 @@ do
done
#shift $((OPTIND-1))
if [ $opt_lens = true ] || [ $opt_model = true ] || [ $opt_region = true ] || [ $opt_nature = true ] || [ $opt_wildlife = true ]; then
opt_all=false
#if [ $opt_lens = true ] || [ $opt_model = true ] || [ $opt_region = true ] || [ $opt_nature = true ] || [ $opt_wildlife = true ]; then
# opt_all=false
#fi
if [ $opt_all = true ]; then
opt_others=true
opt_lens=true
opt_model=true
opt_region=true
opt_nature=true
opt_wildlife=true
fi
# others: array from script
@@ -226,7 +242,8 @@ echo "opt_region: " $opt_region # r
echo "opt_nature: " $opt_nature # n
echo "opt_wildlife: " $opt_wildlife # w
echo "opt_others: " $opt_others
echo "opt_copyright: " $opt_copyright # c
echo "opt_copyright: " $opt_copyright
echo "opt_gps: " $opt_gps # l# c
echo "----"
END_COMMENT
@@ -498,6 +515,20 @@ if [[ -n $iso ]] && [[ -n $speed ]] && [[ -n $aperture ]]; then
fi
: <<'END_COMMENT'
echo "----"
echo "others: " ${others[@]}
echo "tags: " ${tags[@]} # t
echo "opt_lens: " $opt_lens # l
echo "opt_model: " $opt_model # m
echo "opt_region: " $opt_region # r
echo "opt_nature: " $opt_nature # n
echo "opt_wildlife: " $opt_wildlife # w
echo "opt_others: " $opt_others
echo "opt_copyright: " $opt_copyright
echo "opt_gps: " $opt_gps # l# c
echo "----"
END_COMMENT
# gps
if [ $opt_gps = true ]; then
@@ -512,15 +543,11 @@ if [ $opt_gps = true ]; then
exiftool -gps:all= "$file"
fi
fi
else
# erase GPS data
echo "Erasing GPS data..."
exiftool -gps:all= "$file"
fi
# copyright
if [ $opt_copyright = false ]; then
if [ $opt_copyright = true ]; then
b=$(echo -e "Do you want to ${bold}erase Artist and Copyright data${reset} ? (k)eep or (e)rase ")
read -r -p "$b" choice
@@ -700,6 +727,7 @@ done
# 1 LensID puis 2 LendModel
lens_flickr="\"${l}\" "
lens_insta="$(echo "$l" | sed 's/ //g' | sed -r 's/[^ ]+/#&/g') "
lens_ccpx+="${l},"
@@ -739,38 +767,6 @@ do
done
: <<'END_COMMENT'
echo "Model flickr: $model_flickr"
echo "Model insta: $model_insta"
echo
echo "Keywords flickr: $keyword_flickr"
echo "Keywords insta: $keyword_insta"
echo
echo "Lens flick: $lens_flickr"
echo "Lens_insta: $lens_insta"
echo
echo "Wildlife flickr: $wildlife_flickr"
echo "Wildlife insta: $wildlife_insta"
echo
echo "Nature flickr: $nature_flickr"
echo "Nature insta: $nature_insta"
echo
echo "Region flickr: $region_flickr"
echo "Region insta: $region_insta"
echo
echo "tags: ${tags[@]}"
echo "others: ${others[@]}"
echo "file: $file"
echo "wildlife: $opt_wildlife"
echo "nature: $opt_nature"
echo "region: $opt_region"
echo "model: $opt_model"
echo "lens: $opt_lens"
echo "all: $opt_all"
echo
END_COMMENT
if [ $opt_all = false ]; then
if [ $opt_wildlife = false ]; then