scripts

misc scripts and tools
git clone git://git.2f30.org/scripts.git
Log | Files | Refs

commit 6273a3f10a401b0caec406ff6b938d7e4e6b4efb
parent d00254b0e3cd940cd4d185b7435000e9cbadbbb3
Author: sin <sin@2f30.org>
Date:   Fri Dec 20 15:38:59 +0000

Fix indentation

Diffstat:
4chanfetch | 64++++++++++++++++++++++++++++++++--------------------------------
1 file changed, 32 insertions(+), 32 deletions(-)
diff --git a/4chanfetch b/4chanfetch @@ -1,56 +1,56 @@ #!/bin/sh if [ $# -lt 1 ]; then - echo "Usage: $(basename $0) <4chan-thread-url...> " - exit 1 + echo "Usage: $(basename $0) <4chan-thread-url...> " + exit 1 fi pullthread() { - trap 'rm -f ${tmp} ${tmp2}; exit 0' 2 + trap 'rm -f ${tmp} ${tmp2}; exit 0' 2 - tmp=$(mktemp /tmp/4chan.XXXXXX) - tmp2=$(mktemp /tmp/4chanm.XXXXXX) - wget_cmd='wget -nv -nc' + tmp=$(mktemp /tmp/4chan.XXXXXX) + tmp2=$(mktemp /tmp/4chanm.XXXXXX) + wget_cmd='wget -nv -nc' - wget -O ${tmp} "$1" - if [ ! $? -eq 0 ]; then - rm ${tmp} ${tmp2} - return 1 - fi + wget -O ${tmp} "$1" + if [ ! $? -eq 0 ]; then + rm ${tmp} ${tmp2} + return 1 + fi - egrep '//i.4cdn.org/[a-z0-9]+/src/([0-9]*).(jpg|png|gif)' ${tmp} -o | uniq > ${tmp2} + egrep '//i.4cdn.org/[a-z0-9]+/src/([0-9]*).(jpg|png|gif)' ${tmp} -o | uniq > ${tmp2} - sed 's|//i|http://i|g' ${tmp2} > ${tmp} + sed 's|//i|http://i|g' ${tmp2} > ${tmp} - cat ${tmp} | xargs -P 5 -I _URL_ ${wget_cmd} _URL_ + cat ${tmp} | xargs -P 5 -I _URL_ ${wget_cmd} _URL_ - rm ${tmp} ${tmp2} + rm ${tmp} ${tmp2} - return 0 + return 0 } echo "4chan downloader" while :; do - done=1 +done=1 - for arg in "$@"; do - path=$(echo "$arg" | egrep -o '([0-9]*)$' | sed 's/\.html//g') - mkdir -p ${path} - cd ${path} +for arg in "$@"; do + path=$(echo "$arg" | egrep -o '([0-9]*)$' | sed 's/\.html//g') + mkdir -p ${path} + cd ${path} - pullthread "$arg" - if [ $? -eq 0 ]; then - done=0 - fi + pullthread "$arg" + if [ $? -eq 0 ]; then +done=0 +fi - cd - &>/dev/null - done +cd - &>/dev/null +done - if [ $done -eq 1 ]; then - exit 1 - fi +if [ $done -eq 1 ]; then + exit 1 +fi - echo "Waiting 30 seconds before next run" - sleep 30 +echo "Waiting 30 seconds before next run" +sleep 30 done