#!/usr/bin/env bash # # ------------------------------------------------------------------ # made by sputnick in da FreAkY lApPy lAb (c) 2009 # gilles.quenot gmail com # # This program is free software; you can redistribute it and/or # modify it under the terms of version 2 of the GNU General Public # License published by the Free Software Foundation. # (see http://www.gnu.org/licenses/gpl.html). # # The curl part is inspired from imageshack_upload.sh by enki : # enki crocobox org # # ------------------------------------------------------------------ # ,,_ # o" )@ # '''' # ------------------------------------------------------------------ # # Requiert xclip et imagemagick # Ce script permet par defaut et sans options de faire une capture d'ecran # puis de l'uploader automatiquement sur http://imageshack.us. # Il peux aussi servir a simplement uploader une image si cet argument # est fourni sur la ligne de commande. version=20100102 LANG=C CURL=$(type -p curl) IMPORTEXE=$(type -p import) die() { retval=$! echo >&2 "$1" exit $retval } if [[ -f $1 ]]; then file $1 | grep -q image || die "$1 ne semble pas etre une image" IMG=$1 else IMG="/tmp/snapshot$(date +%s).png" "$IMPORTEXE" "$IMG" || die "import a echoue pour le snapshot" fi BODY=$( $CURL -A "Mozilla/5.0" -H Expect: -F fileupload="@${IMG}" -F xml=yes http://www.imageshack.us/index.php | grep -E "(.*)" | sed 's|\(.*\)|\1|' ) echo echo "${BODY}" | tee >(xclip) notify-send "${BODY} est dans le buffer..." &>/dev/null # vim:ts=4:sw=4