summaryrefslogtreecommitdiffstats
path: root/xup.sh
blob: 3c467c086c3b934e9c5e44c7c40263ba0c6c2c4b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#!/bin/bash
#----------------------------------------------------
# Version:      0.1.5
# Author:       Florian "Bluewind" Pritz <f-p@gmx.at>
#
# Copyright (C) 2008-2009 Florian Pritz
#
# Licensed under GNU General Public License v3
#   (see COPYING for full license text)
#
#----------------------------------------------------
# Upload file to XUP, copy URL to clipboard and  
# save to historyfile 
#----------------------------------------------------

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"