3 ############## Gompload 0.1.1
4 # Author: Scott Garrett <Wintervenom@gmail.com>
5 # Description: A graphical ompload wrapper to upload files to Omploader.
6 # Requires: ompload html2text [(firefox | opera | konqueror | midori | seamonkey)]
7 # Syntax: gompload [FILE1 FILE2 DIR1 DIR2 ...]
11 status
="/tmp/gompload_status.html"
12 outfile
="/tmp/gompload_tmp.html"
14 function update_status
{
15 echo "<html><head><title>Gompload: Uploading Files</title><meta http-equiv='refresh' content='1'></head><body><h1>Gompload: Uploading Files</h1><h3>Uploading file $filenum of $numfiles.</h3><hr /><strong>Current file: </strong> $@<hr /><small><em>Gompload 0.1.1 by Scott Garrett</em></small></body></html>" > $status
17 html2text
-style pretty
$status
22 url
="$(ompload "$@
" 2>&1 | awk '/Omploaded/ {print $NF}')"
24 suffix
=$
(echo "$@" |
awk -F .
'{print $NF}')
25 echo "<li><a target='_blank' href=\"${url}.${suffix}\">$@<div style='font-style: italic'>==> ${url}.${suffix}</div></a></li>" >> $outfile
27 echo "<li style='color:red'><strong>[UPLOAD FAILED]</strong> <em>$@</em></li>" >> $outfile
31 if [[ $# != 0 ]]; then
34 update_status
"<em>Preparing to upload...</em>"
35 if [[ $DISPLAY && ! $gomp_dontopen ]]; then
36 if which firefox
&> /dev
/null
; then
37 $
(firefox
$status) &> /dev
/null
38 elif which opera
&> /dev
/null
; then
39 $
(opera
$status) &> /dev
/null
40 elif which konqueror
&> /dev
/null
; then
41 $
(konqueror
$status) &> /dev
/null
42 elif which midori
&> /dev
/null
; then
43 $
(midori
$status) &> /dev
/null
44 elif which seamonkey
&> /dev
/null
; then
45 $
(seamonkey
$status) &> /dev
/null
48 echo "<html><head><title>Gompload: Upload Complete</title></head><body><h1>Gompload: Upload Complete</h1><h3>Here are the results for your uploaded files.</h3><hr /><ol>" > $outfile
51 update_status
"<strong>[COUNTING]</strong> <em>$1</em>"
52 files
=$
(find "$1" -type f
)
53 let "numfiles+= $(echo "$files" | wc -l)"
55 update_status
"<strong>[READING]</strong> <em>$1</em>"
57 while read -d $
'\0' file; do
59 done < <( find "$1" -type f
-print0)
60 for (( x
=0; x
<${#files_a[*]}; x
++ )); do
62 update_status
"${files_a[x]}<br /><strong>Directory:</strong> $1"
63 upload
"${files_a[x]}"
71 echo "<li style='color:red'><strong>[NOT FOUND]</strong> <em>$1</em></li>" >> $outfile
76 echo "</ol><hr /><small><em>Gompload 0.1.1 by Scott Garrett</em></small></body></html>" >> $outfile
77 mv -f $outfile $status
79 html2text
-style pretty
$status
82 if which zenity
&> /dev
/null
; then
83 if file=$
(zenity
--file-selection); then
88 xmessage
-center "Gompload 0.1.1 by Scott Garrett
90 Drag and drop the file(s) and/or folder(s) you wish to upload onto
91 the Gompload icon. Gompload can also be ran from a console:
93 gompload kungfoo.png mycrap/ lolcats.jpg this.txt that/ (and so on)
95 Note that directories will be recursively uploaded.
96 If you don't want Gompload to launch your web browser, use:
98 gomp_dontopen=1 gompload"
100 echo "Gompload 0.1.1 by Scott Garrett"
102 echo "Syntax: gompload kungfoo.png mycrap/ lolcats.jpg this.txt that/ (and so on)"
103 echo "Note that directories will be recursively uploaded."