fix variable name

This commit is contained in:
bronze 2023-12-26 19:13:18 -05:00
parent b23b438e68
commit 10745f79e2
3 changed files with 10 additions and 9 deletions

View File

@ -2,7 +2,7 @@
USE_TOR=false
DELAY=1
RESUME=false
RECENT=false
function usage {
echo "./$(basename "$0") [-t] [-s] [-r]"
@ -36,7 +36,7 @@ while getopts ${optstring} arg; do
TAGS+=("$OPTARG")
;;
r)
RESUME=true
RECENT=true
;;
:)
echo "$0: Must supply an argument to -$OPTARG." >&2
@ -91,7 +91,7 @@ for TAG in "${TAGS[@]}"; do
FILE_MD5=$(echo "$JSON" | jq -r '.md5')
FILE_EXT=$(echo "$JSON" | jq -r '.file_ext')
FILE="$FILE_MD5.$FILE_EXT"
if $RESUME; then
if $RECENT; then
if [[ -f "$FILE" ]]; then
echo "$FILE exists."
exit

View File

@ -2,7 +2,7 @@
USE_TOR=false
DELAY=1
RESUME=false
RECENT=false
function usage {
echo "./$(basename "$0") [-t] [-s] [-r] -a tag -a tag2"
@ -12,6 +12,7 @@ function usage {
echo " -t downloads using tor (requires torsocks)"
echo " -s sets the delay after each request, defaults to 1"
echo " -a tag or artist name"
echo " -r will download until it hits a file that already exists"
}
# list of arguments expected in the input
@ -35,7 +36,7 @@ while getopts ${optstring} arg; do
TAGS+=("$OPTARG")
;;
r)
RESUME=true
RECENT=true
;;
:)
echo "$0: Must supply an argument to -$OPTARG." >&2
@ -81,7 +82,7 @@ for TAG in "${TAGS[@]}"; do
FILE_TAGS=$(echo "$i" | jq -r '."tags"' | sed 's/\ /,/g')
FILE=$(echo "$FILE_URL" | sed 's/\// /g' | awk '{print $NF}')
if $RESUME; then
if $RECENT; then
if [[ -f "$FILE" ]]; then
echo "$FILE exists."
exit

View File

@ -2,7 +2,7 @@
USE_TOR=false
DELAY=1
RESUME=false
RECENT=false
URL="konachan.com"
function usage {
@ -38,7 +38,7 @@ while getopts ${optstring} arg; do
TAGS+=("$OPTARG")
;;
r)
RESUME=true
RECENT=true
;;
c)
URL="${OPTARG}"
@ -95,7 +95,7 @@ for TAG in "${TAGS[@]}"; do
FILE_TAGS=$(echo "$JSON" | jq -r '.[] | ."tags"' | sed 's/\ /,/g')
FILE=$(echo "$JSON" | jq -r '.[] | ."file_url"' | sed 's/\// /g' | awk '{print $5}')
FILE_WITHSPACE=$(echo "$JSON" | jq -r '.[] | ."file_url"' | sed 's/\// /g' | awk '{print $5}' | sed 's/\%20/ /g')
if $RESUME; then
if $RECENT; then
if [[ -f "$FILE_WITHSPACE" ]]; then
echo "$FILE_WITHSPACE exists."
exit