From 53bb1479dc0932744eea598dc3658ae0a3d1b8ae Mon Sep 17 00:00:00 2001 From: Xerbo Date: Sun, 24 Nov 2019 10:00:00 +0000 Subject: [PATCH] Address #26 Add -w to getopts so it actually does anything --- furaffinity-dl | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/furaffinity-dl b/furaffinity-dl index 3a4cd33..b8fa624 100755 --- a/furaffinity-dl +++ b/furaffinity-dl @@ -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