From e4732d88cd53d0f91cb0bde53ced0bddf5c32ee2 Mon Sep 17 00:00:00 2001 From: Connor Olding Date: Fri, 1 Nov 2013 20:08:34 -0700 Subject: [PATCH] whatever --- boorufind | 2 +- boorugrab | 29 ++++++++++++++++++++++++++--- 2 files changed, 27 insertions(+), 4 deletions(-) mode change 100644 => 100755 boorufind mode change 100644 => 100755 boorugrab diff --git a/boorufind b/boorufind old mode 100644 new mode 100755 index bac9476..778d94b --- a/boorufind +++ b/boorufind @@ -24,7 +24,7 @@ push() { page=1 while; do once=0 - ${curl[@]} -G -d page=search -d limit=100 -d page=$page $de tags=$q $url \ + ${curl[@]} -G -d limit=100 -d page=$page $de tags=$q $url \ | xml2 2>/dev/null \ | while IFS== read -r tree val; do [ $tree = /posts/post ] && push && continue diff --git a/boorugrab b/boorugrab old mode 100644 new mode 100755 index 15119c4..07343e1 --- a/boorugrab +++ b/boorugrab @@ -4,14 +4,37 @@ url='http://danbooru.donmai.us/data/' curl=(curl -sS -m 900 --connect-timeout 8 --retry 3 --retry-delay 1) +cleanup() { + [ -e $dir/$md5e ] && { + rm -f $dir/$md5e + echo "\e[F\e[K$md5e - canceled" + } + exit 1 +} +trap cleanup INT + mkdir -p $dir while read -r; do if [[ ${REPLY[1]} = "#" ]]; then md5e=${REPLY:1} - ${curl[@]} $url$md5e > $dir/$md5e || rm -f $dir/$md5e + echo "$md5e - downloading..." + ${curl[@]} $url$md5e > $dir/$md5e || { + rm -f $dir/$md5e + echo "\e[F\e[K$md5e - failed" + } + echo "\e[F\e[K$md5e - downloaded!" else md5e=${REPLY##*/} - [ -s $dir/$md5e ] && continue - [ $REPLY -ef $dir/$md5e ] || cp $REPLY $dir + [ $REPLY -ef $dir/$md5e ] && { + echo "$md5e - skipping (ef)" + continue + } + [ -s $dir/$md5e ] && { + echo "$md5e - skipping (s)" + continue + } + echo "$md5e - copying..." + cp $REPLY $dir + echo "\e[F\e[K$md5e - copied!" fi done