From d661309987ebd3b6dfb647021e05caf41d82104e Mon Sep 17 00:00:00 2001 From: Gautier Pelloux-Prayer Date: Tue, 19 Jan 2016 16:08:57 +0100 Subject: [PATCH] imgur_upload.sh: do not use underscore, it's broken --- Tools/imgur_upload.sh | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/Tools/imgur_upload.sh b/Tools/imgur_upload.sh index debd736f0..d937c97ce 100755 --- a/Tools/imgur_upload.sh +++ b/Tools/imgur_upload.sh @@ -1,10 +1,5 @@ #!/bin/bash -# Install underscore-cli for hacking -if ! which underscore &> /dev/null; then - npm install -g underscore-cli &>/dev/null -fi - cd $KIF_SCREENSHOTS if [ ! -z "$(find . -name "*.png")" ]; then @@ -23,11 +18,11 @@ if [ ! -z "$(find . -name "*.png")" ]; then result="$(curl https://api.imgur.com/3/upload.json -H "Authorization: Client-ID $api_key" -F "image=@\"$filepath\"" )" # result='{"rsp":{"stat":"ok","image":{"image_hash":"dKZ0YK9","delete_hash":"r0MsZp11K9vawLf","original_image":"http:\/\/i.imgur.com\/dKZ0YK9.png","large_thumbnail":"http:\/\/i.imgur.com\/dKZ0YK9l.jpg","small_thumbnail":"http:\/\/i.imgur.com\/dKZ0YK9s.jpg","imgur_page":"http:\/\/imgur.com\/dKZ0YK9","delete_page":"http:\/\/imgur.com\/delete\/r0MsZp11K9vawLf"}}}' - succeeded="$(echo $result | underscore extract success)" - if [ "$succeeded" != "true" ]; then + if ! grep -q '"success":true' $result; then echo "There was a problem uploading \"$filepath\": $result" else - download_cmds="${download_cmds}\nwget $(echo "$result" | underscore extract 'data.link')" + url=$(echo "$result" | tr ':' '\n' | grep '"link":' | cut -d: -f2) + download_cmds="${download_cmds}\nwget $url" fi done echo "All uploads complete!"