shellcheck
This commit is contained in:
@@ -46,24 +46,23 @@ map_size="450x450"
|
|||||||
prefix=${map_size%%x*} # find x position in map_size string
|
prefix=${map_size%%x*} # find x position in map_size string
|
||||||
x=${#prefix}
|
x=${#prefix}
|
||||||
gm_width=${map_size:0:$x}
|
gm_width=${map_size:0:$x}
|
||||||
echo $gm_width
|
|
||||||
|
|
||||||
long_path=`pwd`"/"`basename "$0"` # /Users/bruno/Documents/Scripts/kymsu2/keywords2insta.sh
|
#long_path=$(pwd)"/"$(basename "$0") # /Users/bruno/Documents/Scripts/kymsu2/keywords2insta.sh
|
||||||
# long: /Users/bruno/Documents/GitHub/GooFuzz/keywords2insta.sh
|
# long: /Users/bruno/Documents/GitHub/GooFuzz/keywords2insta.sh
|
||||||
#long_path=$(realpath "$0") # vide
|
|
||||||
|
|
||||||
dir=$(dirname "$0") # /Users/bruno/Documents/Scripts/keywords2insta
|
dir=$(dirname "$0") # /Users/bruno/Documents/Scripts/keywords2insta
|
||||||
|
|
||||||
dotenv () {
|
dotenv () {
|
||||||
set -a
|
set -a
|
||||||
[ -f .env ] && . .env || echo -e "${red}\nNo .env file found ! Googlemaps reverse geocode not working.${reset}"
|
# shellcheck disable=SC1091
|
||||||
|
[ -f "$HOME/.env" ] && . "$HOME/.env" || echo -e "${red}\nNo .env file found ! Googlemaps reverse geocode not working.${reset}"
|
||||||
set +a
|
set +a
|
||||||
}
|
}
|
||||||
|
|
||||||
dotenv
|
dotenv
|
||||||
|
|
||||||
trim () {
|
trim () {
|
||||||
read -rd '' $1 <<<"${!1}"
|
read -rd '' "$1" <<<"${!1}"
|
||||||
}
|
}
|
||||||
|
|
||||||
alpha_name=
|
alpha_name=
|
||||||
@@ -73,7 +72,7 @@ alpha () {
|
|||||||
#declare -A ilce=( ['ILCE-7M3']="Alpha 7 III" ['ILCE-7M4']="α7 IV" ['ILCE-7MRM5']="α7R V" ['ILCE-7SM3']="Alpha 7S III" ['ILCE-7RM4']="α7R IV" ['ILCE-7RM3']="α7R III" ['ILCE-7C']="Alpha 7C" )
|
#declare -A ilce=( ['ILCE-7M3']="Alpha 7 III" ['ILCE-7M4']="α7 IV" ['ILCE-7MRM5']="α7R V" ['ILCE-7SM3']="Alpha 7S III" ['ILCE-7RM4']="α7R IV" ['ILCE-7RM3']="α7R III" ['ILCE-7C']="Alpha 7C" )
|
||||||
declare -A ilce
|
declare -A ilce
|
||||||
|
|
||||||
if [ -f $dir/sony.csv ]; then
|
if [ -f "$dir"/sony.csv ]; then
|
||||||
|
|
||||||
#echo "Loading Sony APNs..."
|
#echo "Loading Sony APNs..."
|
||||||
|
|
||||||
@@ -82,7 +81,7 @@ alpha () {
|
|||||||
key="${array[0]}"
|
key="${array[0]}"
|
||||||
value="${array[1]}"
|
value="${array[1]}"
|
||||||
ilce["$key"]="$value"
|
ilce["$key"]="$value"
|
||||||
done < $dir/sony.csv
|
done < "$dir"/sony.csv
|
||||||
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@@ -251,7 +250,7 @@ en=()
|
|||||||
array2=()
|
array2=()
|
||||||
declare -A dico
|
declare -A dico
|
||||||
|
|
||||||
if [ -f $dir/keywords.csv ]; then
|
if [ -f "$dir"/keywords.csv ]; then
|
||||||
|
|
||||||
echo "Loading keyword dictionary..."
|
echo "Loading keyword dictionary..."
|
||||||
|
|
||||||
@@ -259,7 +258,7 @@ if [ -f $dir/keywords.csv ]; then
|
|||||||
do
|
do
|
||||||
fr+=("${array2[0]}")
|
fr+=("${array2[0]}")
|
||||||
en+=("${array2[1]}")
|
en+=("${array2[1]}")
|
||||||
done < $dir/keywords.csv
|
done < "$dir"/keywords.csv
|
||||||
|
|
||||||
j=0
|
j=0
|
||||||
for i in "${fr[@]}"
|
for i in "${fr[@]}"
|
||||||
@@ -331,16 +330,18 @@ fi
|
|||||||
|
|
||||||
# Display thumb image
|
# Display thumb image
|
||||||
|
|
||||||
if [ "$(echo $__CFBundleIdentifier | grep iterm2)" ]; then
|
if [ "$(echo "$__CFBundleIdentifier" | grep iterm2)" ]; then
|
||||||
tmp_path=/tmp/k2i
|
tmp_path=/tmp/k2i
|
||||||
[ -d $tmp_path ] && rm -rf $tmp_path
|
[ -d $tmp_path ] && rm -rf $tmp_path
|
||||||
mkdir $tmp_path
|
mkdir $tmp_path
|
||||||
|
|
||||||
tempfoo=`basename "$file"`
|
#tempfoo=`basename "$file"`
|
||||||
magick "$file" -quality 50 -resize 600x600\> $tmp_path/thumb_$tempfoo
|
tempfoo=$(basename "$file")
|
||||||
|
magick "$file" -quality 50 -resize 600x600\> $tmp_path/thumb_"$tempfoo"
|
||||||
if [ -f "$tmp_path/thumb_$tempfoo" ]; then
|
if [ -f "$tmp_path/thumb_$tempfoo" ]; then
|
||||||
[ $width -gt $height ] && w_thumb=600 || w_thumb=$(echo "600/3*2" | bc)
|
[ "$width" -gt "$height" ] && w_thumb=600 || w_thumb=$(echo "600/3*2" | bc)
|
||||||
printf "\n\t\033]1337;File=;width=$w_thumb px;inline=1:`cat $tmp_path/thumb_$tempfoo | base64`\a\n"
|
#printf "\n\t\033]1337;File=;width=$w_thumb px;inline=1:`cat $tmp_path/thumb_$tempfoo | base64`\a\n"
|
||||||
|
printf "\n\t\033]1337;File=;width=$w_thumb px;inline=1:$(cat $tmp_path/thumb_$tempfoo | base64)\a\n"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@@ -429,16 +430,16 @@ if [[ -n $iso ]] && [[ -n $speed ]] && [[ -n $aperture ]]; then
|
|||||||
l="$lens"
|
l="$lens"
|
||||||
fi
|
fi
|
||||||
# width > height && w=2400 || w=1600
|
# width > height && w=2400 || w=1600
|
||||||
if [ $width -gt $height ]; then
|
if [ "$width" -gt "$height" ]; then
|
||||||
wi=2400
|
wi=2400
|
||||||
he=1600
|
he=1600
|
||||||
[ $width -ne $wi ] && printf " %-11s %-35b \n" "Width:" "${red}${width}${reset}" || printf " %-11s %-35s \n" "Width:" "${width}"
|
[ "$width" -ne "$wi" ] && printf " %-11s %-35b \n" "Width:" "${red}${width}${reset}" || printf " %-11s %-35s \n" "Width:" "${width}"
|
||||||
[ $height -ne $he ] && printf " %-11s %-35b \n" "Height:" "${red}${height}${reset}" || printf " %-11s %-35s \n" "Height:" "${height}"
|
[ "$height" -ne "$he" ] && printf " %-11s %-35b \n" "Height:" "${red}${height}${reset}" || printf " %-11s %-35s \n" "Height:" "${height}"
|
||||||
elif [ $height -gt $width ]; then
|
elif [ "$height" -gt "$width" ]; then
|
||||||
wi=1600
|
wi=1600
|
||||||
he=2400
|
he=2400
|
||||||
[ $width -ne $wi ] && printf " %-11s %-35b \n" "Width:" "${red}${width}${reset}" || printf " %-11s %-35s \n" "Width:" "${width}"
|
[ "$width" -ne "$wi" ] && printf " %-11s %-35b \n" "Width:" "${red}${width}${reset}" || printf " %-11s %-35s \n" "Width:" "${width}"
|
||||||
[ $height -ne $he ] && printf " %-11s %-3b \n" "Height:" "${red}${height}${reset}" || printf " %-11s %-35s \n" "Height:" "${height}"
|
[ "$height" -ne "$he" ] && printf " %-11s %-3b \n" "Height:" "${red}${height}${reset}" || printf " %-11s %-35s \n" "Height:" "${height}"
|
||||||
fi
|
fi
|
||||||
#printf " %-11s %-35s \n" "Width:" "${width}"
|
#printf " %-11s %-35s \n" "Width:" "${width}"
|
||||||
#printf " %-11s %-35s \n" "Height:" "${height}"
|
#printf " %-11s %-35s \n" "Height:" "${height}"
|
||||||
@@ -480,13 +481,15 @@ if [[ -n $iso ]] && [[ -n $speed ]] && [[ -n $aperture ]]; then
|
|||||||
gm_path=/tmp/k2i/gm.png
|
gm_path=/tmp/k2i/gm.png
|
||||||
curl -s "$url" --output $gm_path
|
curl -s "$url" --output $gm_path
|
||||||
if [ -f "$gm_path" ]; then
|
if [ -f "$gm_path" ]; then
|
||||||
printf "\n\t\033]1337;File=;width=$((gm_width * 2)) px;inline=1:`cat $gm_path | base64`\a\n"
|
#printf "\n\t\033]1337;File=;width=$((gm_width * 2)) px;inline=1:`cat $gm_path | base64`\a\n"
|
||||||
|
printf "\n\t\033]1337;File=;width=$((gm_width * 2)) px;inline=1:$(cat $gm_path | base64)\a\n"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
printf " %-11s %-35s \n" "Software:" "${software}"
|
||||||
printf " %-11s %-35s \n" "Comment:" "${comment}"
|
printf " %-11s %-35s \n" "Comment:" "${comment}"
|
||||||
printf " %-11s %-35s \n" "Artist:" "${artist}"
|
printf " %-11s %-35s \n" "Artist:" "${artist}"
|
||||||
printf " %-11s %-35s \n" "Copyright:" "${copyright}"
|
printf " %-11s %-35s \n" "Copyright:" "${copyright}"
|
||||||
@@ -502,7 +505,7 @@ if [ $opt_gps = true ]; then
|
|||||||
echo -e "${red}GPS data available !${reset}"
|
echo -e "${red}GPS data available !${reset}"
|
||||||
|
|
||||||
d=$(echo -e "Do you want to ${bold}erase GPS data${reset} ? (k)eep or (e)rase ")
|
d=$(echo -e "Do you want to ${bold}erase GPS data${reset} ? (k)eep or (e)rase ")
|
||||||
read -p "$d" choice
|
read -r -p "$d" choice
|
||||||
|
|
||||||
if [ "$choice" == "e" ] || [ "$choice" == "E" ]; then
|
if [ "$choice" == "e" ] || [ "$choice" == "E" ]; then
|
||||||
echo "Erasing GPS data..."
|
echo "Erasing GPS data..."
|
||||||
@@ -519,7 +522,7 @@ fi
|
|||||||
# copyright
|
# copyright
|
||||||
if [ $opt_copyright = false ]; then
|
if [ $opt_copyright = false ]; then
|
||||||
b=$(echo -e "Do you want to ${bold}erase Artist and Copyright data${reset} ? (k)eep or (e)rase ")
|
b=$(echo -e "Do you want to ${bold}erase Artist and Copyright data${reset} ? (k)eep or (e)rase ")
|
||||||
read -p "$b" choice
|
read -r -p "$b" choice
|
||||||
|
|
||||||
if [ "$choice" == "e" ] || [ "$choice" == "E" ]; then
|
if [ "$choice" == "e" ] || [ "$choice" == "E" ]; then
|
||||||
echo "Erasing Artist and Copyright data..."
|
echo "Erasing Artist and Copyright data..."
|
||||||
@@ -540,7 +543,7 @@ if [ -z "$k" ]; then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
IFS="," read -a key <<< "$k"
|
IFS="," read -r -a key <<< "$k"
|
||||||
|
|
||||||
|
|
||||||
for i in "${key[@]}"
|
for i in "${key[@]}"
|
||||||
@@ -877,7 +880,7 @@ if [ "$insta" = true ]; then
|
|||||||
echo -e "\n${bold}The Instagram's tags are available in your clipboard !${reset}"
|
echo -e "\n${bold}The Instagram's tags are available in your clipboard !${reset}"
|
||||||
echo "$keywords_insta"
|
echo "$keywords_insta"
|
||||||
|
|
||||||
[ "$flickr" = true ] || [ "$ccpx" = true ] && echo -e "\nPress <Enter> to get the Flickr's or the 500px's tags..." && read -p ""
|
[ "$flickr" = true ] || [ "$ccpx" = true ] && echo -e "\nPress <Enter> to get the Flickr's or the 500px's tags..." && read -r -p ""
|
||||||
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@@ -891,7 +894,7 @@ if [ "$flickr" = true ]; then
|
|||||||
[ "$insta" = true ] && echo -e "\n${bold}Here the Flickr's tags too !${reset}" || echo -e "\n${bold}The Flickr's tags are available in your clipboard !${reset}"
|
[ "$insta" = true ] && echo -e "\n${bold}Here the Flickr's tags too !${reset}" || echo -e "\n${bold}The Flickr's tags are available in your clipboard !${reset}"
|
||||||
echo "$keywords_flickr"
|
echo "$keywords_flickr"
|
||||||
|
|
||||||
"$ccpx" = true ] && echo -e "\nPress <Enter> to get the 500px's tags..." && read -p ""
|
[ "$ccpx" = true ] && echo -e "\nPress <Enter> to get the 500px's tags..." && read -r -p ""
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "$ccpx" = true ]; then
|
if [ "$ccpx" = true ]; then
|
||||||
|
|||||||
Reference in New Issue
Block a user