Improves gdl.sh and images-indexer.sh scripts

This commit is contained in:
Matheus Albino
2024-06-19 07:57:11 -03:00
parent 8e732e0061
commit f4464491bb
2 changed files with 11 additions and 5 deletions

View File

@@ -8,13 +8,11 @@ fi
media_url=$1 media_url=$1
gallery-dl $media_url gallery-dl $media_url
cmd_exit_code=$?
if [[ $cmd_exit_code -ne 0 ]]; then if [[ $? -ne 0 ]]; then
printf "\n" printf "\n"
echo "[ERROR] `basename $0`: Could not download url \"$media_url\"" echo "[ERROR] `basename $0`: Could not download url \"$media_url\""
echo "[ERROR] Exit status: $cmd_exit_code"
exit 1 exit 1
fi fi

View File

@@ -20,7 +20,7 @@ if [ ${#commands_not_found[@]} -ne 0 ]; then
fi fi
cur_dir=`pwd` cur_dir=`pwd`
furry_commission_ideas_path=/mnt/e/home/Documents/sync/nextcloud-pudimxyz-cloud/furry-commission-ideas furry_commission_ideas_path=/mnt/e/home/sync/nextcloud/furry-commission-ideas
furry_commission_ideas_urls_filename="urls.txt" furry_commission_ideas_urls_filename="urls.txt"
scripts_path=/home/cloud/repos/personal-devboot/scripts/shell scripts_path=/home/cloud/repos/personal-devboot/scripts/shell
@@ -47,6 +47,12 @@ done
# remove trailing slashes # remove trailing slashes
media_url=`sed 's:/*$::' <<< "$media_url"` media_url=`sed 's:/*$::' <<< "$media_url"`
url_regex='(https?)://[-[:alnum:]\+&@#/%?=~_|!:,.;]*[-[:alnum:]\+&@#/%=~_|]'
if [[ ! $media_url =~ $url_regex ]]; then
echo "The URL informed is not valid."
exit 1
fi
cd $furry_commission_ideas_path cd $furry_commission_ideas_path
existing_folders=($(find * -type d -not -path artists -not -path kinks -not -path ideas)) existing_folders=($(find * -type d -not -path artists -not -path kinks -not -path ideas))
@@ -130,7 +136,9 @@ if [ -f "$furry_commission_ideas_urls_filename" ] && grep -qE "$media_url" -i "$
exit 0 exit 0
fi fi
command_output=`$scripts_path/gdl.sh $media_url` if ! command_output=$($scripts_path/gdl.sh $media_url); then
exit 1
fi
media_filenames=() media_filenames=()