#!/bin/sh #----------------------------------------------------# # File: xup.sh # Version: 0.1.4 # Date: 2009-01-14 # Author: Florian "Bluewind" Pritz # Upload file to XUP, copy URL to clipboard and # save to historyfile #----------------------------------------------------# # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see . XUPHIST="${HOME}/.xup_history" FILE="$(basename "$1")" DIR="$(dirname "$1")" cd "$DIR" URLS=$(curl -# -F "F1=@$FILE" -L "http://www.xup.in/xtrans.php" -H "Expect: ") DL_URL=$(echo -n ${URLS} | egrep -o "\"http://www.xup.in/dl,.{8}/" | sed "s#\"##g") DEL_URL=$(echo -n ${URLS} | egrep -o "\"http://www.xup.in/kill,.{8},.{10}/\"" | sed "s#\"##g") echo $(date) >> "$XUPHIST" echo "$PWD/$FILE" >> "$XUPHIST" echo $DL_URL >> "$XUPHIST" echo -n $DL_URL | nohup >/dev/null 2>&1 xclip echo -n $DL_URL echo $DEL_URL >> "$XUPHIST" echo "" >> "$XUPHIST" sleep 2