18 lines
419 B
Text
18 lines
419 B
Text
|
#!/bin/zsh
|
||
|
dir=$1
|
||
|
url='http://danbooru.donmai.us/data/'
|
||
|
|
||
|
curl=(curl -sS -m 900 --connect-timeout 8 --retry 3 --retry-delay 1)
|
||
|
|
||
|
mkdir -p $dir
|
||
|
while read -r; do
|
||
|
if [[ ${REPLY[1]} = "#" ]]; then
|
||
|
md5e=${REPLY:1}
|
||
|
${curl[@]} $url$md5e > $dir/$md5e || rm -f $dir/$md5e
|
||
|
else
|
||
|
md5e=${REPLY##*/}
|
||
|
[ -s $dir/$md5e ] && continue
|
||
|
[ $REPLY -ef $dir/$md5e ] || cp $REPLY $dir
|
||
|
fi
|
||
|
done
|