Add -w to getopts so it actually does anything
This commit is contained in:
Xerbo 2019-11-24 10:00:00 +00:00
parent 020f10502b
commit 53bb1479dc

View file

@ -56,7 +56,7 @@ metadata=true
rename=true
maxsavefiles="0"
overwrite=false
while getopts 'o:c:iphrn:' flag; do
while getopts 'o:c:iphrnw:' flag; do
case "${flag}" in
w) overwrite=true;;
o) outdir=${OPTARG};;
@ -139,7 +139,10 @@ https://github.com/Xerbo/furaffinity-dl/issues" >&2
title="${title%" by"*}" # Remove the " by Artist" bit
title="$(echo $title | tr -d "/")"
file_type="${image_url##*.}"
file_name="$(echo $image_url | cut -d "/" -f 7)"
file_name="$(echo "$image_url" | cut -d "/" -f 7)"
if [[ "$file_name" =~ ^[0-9]{0,12}$ ]]; then
file_name="$(echo "$image_url" | cut -d "/" -f 8)"
fi
# Choose the output path
if [ $rename = true ]; then