scripts

various script and utils
git clone git://z3bra.org/scripts
Log | Files | Refs

commit 5abaaafcdbe7bf3e2aea979c0c68c7a1c10be65a
parent 5023e4301c25b02efc49ce9e53e1da33cc7450c4
Author: z3bra <willy@mailoo.org>
Date:   Wed Dec  3 13:30:30 +0100

now imgur can upload from stdin

Diffstat:
imgurup | 8+++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/imgurup b/imgurup @@ -12,20 +12,22 @@ for F in "$@"; do done LOG=$HOME/.imgurlog -CLIP="xsel -p -i" # from http://imgur.com/tools/imgurbash.sh APIKEY='b3625162d3418ac51a9ee805b1840452' +# use stdin if no file provided +test -z "$@" && FILES='-' || FILES="$@" + # upload all -for IMG in "$@"; do +for IMG in "$FILES"; do RESP=$(curl -F "image=@$IMG" -F "key=$APIKEY" \ http://imgur.com/api/upload.xml 2> /dev/null) URL=$(echo $RESP | sed 's|.*<original_image>\(.*\)</original_image>.*|\1|') DELETEURL=$(echo $RESP | sed 's|.*<delete_page>\(.*\)</delete_page>.*|\1|') - echo "$URL" | tee $LOG | $CLIP + echo "$URL" | tee $LOG echo "$DELETEURL" >> $LOG echo "$URL" done