Clean code
This commit is contained in:
@@ -5,7 +5,7 @@ greenbold="\033[1;32m"
|
|||||||
green="\033[0;32m"
|
green="\033[0;32m"
|
||||||
yellow="\033[0;33m"
|
yellow="\033[0;33m"
|
||||||
bold="\033[1m"
|
bold="\033[1m"
|
||||||
bold_under="\033[1;4m"
|
#bold_under="\033[1;4m"
|
||||||
underline="\033[4m"
|
underline="\033[4m"
|
||||||
reset="\033[0m"
|
reset="\033[0m"
|
||||||
|
|
||||||
@@ -16,7 +16,8 @@ reset="\033[0m"
|
|||||||
wild=("wildlife" "wildlifephoto" "wildlifephotographer")
|
wild=("wildlife" "wildlifephoto" "wildlifephotographer")
|
||||||
nat=("naturelovers" "natureshot" "naturephotography")
|
nat=("naturelovers" "natureshot" "naturephotography")
|
||||||
reg=("Bourgogne" "Burgundy" "Bourgogne Franche-Comté" "Côte d'or")
|
reg=("Bourgogne" "Burgundy" "Bourgogne Franche-Comté" "Côte d'or")
|
||||||
others=("tag" "keu")
|
#others=("lanscape" "animal")
|
||||||
|
others=()
|
||||||
|
|
||||||
# tags -t mammifere foret animal
|
# tags -t mammifere foret animal
|
||||||
|
|
||||||
@@ -38,6 +39,7 @@ showHelp() {
|
|||||||
echo -e "${green}keyword2insta [-Options...] -f <file>${reset}"
|
echo -e "${green}keyword2insta [-Options...] -f <file>${reset}"
|
||||||
echo -e "If no option is chosen, all tags are added (default). "
|
echo -e "If no option is chosen, all tags are added (default). "
|
||||||
echo -e "Keywords taken from exifs are automatically added."
|
echo -e "Keywords taken from exifs are automatically added."
|
||||||
|
echo -e "You can add keywords permanently by adding them to the ${underline}others array${reset} at the start of the script. (See others=())"
|
||||||
echo -e "The images files are not modified."
|
echo -e "The images files are not modified."
|
||||||
echo
|
echo
|
||||||
echo -e "${yellow}OPTIONS:${reset}"
|
echo -e "${yellow}OPTIONS:${reset}"
|
||||||
@@ -86,9 +88,6 @@ do
|
|||||||
wildlife) opt_wildlife=true;;
|
wildlife) opt_wildlife=true;;
|
||||||
nature) opt_nature=true;;
|
nature) opt_nature=true;;
|
||||||
region) opt_region=true;;
|
region) opt_region=true;;
|
||||||
# "$@" --lens -t mammifère foret animal --file /Users/bruno/Pictures/Export/2022/Juillet/2022-07-01_Chevrette_3462.jpg
|
|
||||||
# "${OPTARG}" file
|
|
||||||
# "${OPTIND}" 7
|
|
||||||
file)
|
file)
|
||||||
file="${!OPTIND}"; OPTIND=$(( $OPTIND + 1 ))
|
file="${!OPTIND}"; OPTIND=$(( $OPTIND + 1 ))
|
||||||
;;
|
;;
|
||||||
@@ -143,10 +142,6 @@ fi
|
|||||||
t=$(echo "${tags[@]}" | sed -r 's/[^ ]+/,&/g')
|
t=$(echo "${tags[@]}" | sed -r 's/[^ ]+/,&/g')
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#trans fr:en -b "renard"
|
|
||||||
#fox
|
|
||||||
|
|
||||||
if ! command -v exiftool &> /dev/null; then
|
if ! command -v exiftool &> /dev/null; then
|
||||||
echo -e "${bold}exiftool${reset} could not be found !\n"
|
echo -e "${bold}exiftool${reset} could not be found !\n"
|
||||||
echo -e "You should install ${bold}exiftool${reset}:\n"
|
echo -e "You should install ${bold}exiftool${reset}:\n"
|
||||||
@@ -309,8 +304,6 @@ echo
|
|||||||
echo "Region flickr: $region_flickr"
|
echo "Region flickr: $region_flickr"
|
||||||
echo "Region insta: $region_insta"
|
echo "Region insta: $region_insta"
|
||||||
echo
|
echo
|
||||||
END_COMMENT
|
|
||||||
|
|
||||||
|
|
||||||
echo "tags: ${tags[@]}"
|
echo "tags: ${tags[@]}"
|
||||||
echo "others: ${others[@]}"
|
echo "others: ${others[@]}"
|
||||||
@@ -322,6 +315,7 @@ echo "model: $opt_model"
|
|||||||
echo "lens: $opt_lens"
|
echo "lens: $opt_lens"
|
||||||
echo "all: $opt_all"
|
echo "all: $opt_all"
|
||||||
echo
|
echo
|
||||||
|
END_COMMENT
|
||||||
|
|
||||||
if [ $opt_all = false ]; then
|
if [ $opt_all = false ]; then
|
||||||
|
|
||||||
@@ -358,7 +352,7 @@ keywords_insta=$(echo "$keyword_insta$model_insta$lens_insta$wildlife_insta$natu
|
|||||||
if [ $opt_others = true ]; then
|
if [ $opt_others = true ]; then
|
||||||
|
|
||||||
# insert tags added with option -t to others's tag array
|
# insert tags added with option -t to others's tag array
|
||||||
others+=(`echo $t | tr ',' ' '`)
|
others+=($(echo "$t" | tr ',' ' '))
|
||||||
|
|
||||||
for i in "${others[@]}"
|
for i in "${others[@]}"
|
||||||
do
|
do
|
||||||
|
|||||||
Reference in New Issue
Block a user