From 7c1ff29270f3f63cc6a1094834dfb5fd029ce065 Mon Sep 17 00:00:00 2001 From: Alex Date: Fri, 15 May 2020 22:19:01 +0200 Subject: [PATCH] Ratelimits... :-(, fixed extra download --- custom/functions.zsh | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/custom/functions.zsh b/custom/functions.zsh index 461b1f6..b48dc91 100644 --- a/custom/functions.zsh +++ b/custom/functions.zsh @@ -19,12 +19,12 @@ function getnhentai { local types=($(print $pageinfo | jq -r '.types[]')) local num_pages=$(print $pageinfo | jq '.pages') local urls=() - for i in {0..$num_pages}; do - local itoc=$(($i + 1)) - [[ ${types[$i]} == p ]] && local type=png || local type=jpg - urls+=("https://i.nhentai.net/galleries/$media_id/$itoc.$type") + for i in {1..$num_pages}; do + local ctoi=$(($i - 1)) + [[ ${types[$ctoi]} == p ]] && local type=png || local type=jpg + urls+=("https://i.nhentai.net/galleries/$media_id/$i.$type") done - curl -\#ZL --remote-name-all ${urls} + curl --retry 10 -\#L --remote-name-all ${urls} for i in *; do local sortname="$(printf "%.3i" "${i%%.*}").${i##*.}" [ $sortname = $i ] || mv $i $sortname