Fixes gdltool.sh for links with spaces

This commit is contained in:
2025-01-01 11:56:13 -03:00
parent 764c5d66ab
commit 9f53345e49

View File

@@ -36,7 +36,7 @@ while [ "$#" -gt 0 ]; do
esac esac
done done
commands_to_check=(gallery-dl gdl.sh feh xdotool stoml) commands_to_check=(gallery-dl gdl.sh feh xdotool)
commands_not_found=() commands_not_found=()
for command in ${commands_to_check[@]}; do for command in ${commands_to_check[@]}; do
@@ -141,7 +141,7 @@ input_selected_folders_and_fill_selected_folders_variable() {
mkdir --parents "$new_foldername" mkdir --parents "$new_foldername"
selected_folders=("$new_foldername") selected_folders+=("$new_foldername")
else else
for selected_option in ${selected_options[@]}; do for selected_option in ${selected_options[@]}; do
selected_folder=${existing_folders[$selected_option]} selected_folder=${existing_folders[$selected_option]}
@@ -447,7 +447,7 @@ image_download_steps() {
echo "" echo ""
echo "Download starting..." echo "Download starting..."
downloaded_images=($(gallery-dl --directory ${tmp_dir} $url_to_download)) downloaded_images=$(gallery-dl --directory ${tmp_dir} $url_to_download)
if [[ $? -ne 0 ]]; then if [[ $? -ne 0 ]]; then
unsucessful_downloads+="$url_to_download" unsucessful_downloads+="$url_to_download"
@@ -456,8 +456,9 @@ image_download_steps() {
echo "Download finished." echo "Download finished."
for downloaded_image_temp_path in "${downloaded_images[@]}"; do # for downloaded_image_temp_path in "${downloaded_images[@]}"; do
if [ $downloaded_image_temp_path == '#' ]; then while read -r downloaded_image_temp_path; do
if [ "$downloaded_image_temp_path" == '#' ]; then
continue continue
fi fi
@@ -466,17 +467,17 @@ image_download_steps() {
file_extension=$(get_extension_from_filename "$downloaded_image_temp_path") file_extension=$(get_extension_from_filename "$downloaded_image_temp_path")
final_temp_filepath_md5=($(md5sum $downloaded_image_temp_path)) final_temp_filepath_md5=($(md5sum "$downloaded_image_temp_path"))
final_filename="${final_temp_filepath_md5}.${file_extension}" final_filename="${final_temp_filepath_md5}.${file_extension}"
cp $downloaded_image_temp_path ./${final_filename} cp "$downloaded_image_temp_path" ./${final_filename}
echo "$final_filename,$url_to_download" >>$furry_commission_ideas_urls_filename echo "$final_filename,$url_to_download" >>$furry_commission_ideas_urls_filename
done done
done
rm $downloaded_image_temp_path rm "$downloaded_image_temp_path"
done < <(echo "$downloaded_images")
} }
fill_existing_folders_array fill_existing_folders_array