#!/bin/sh # starts bittorrent in a detached screen session from your browser # optionally on another host. if it worked (or thinks it did) you # will only see the something.torrent file download whereever your # browser puts it, if not, youll get an xmessage telling you what # (might have) went wrong. all the variables are in front, either # change them or make a conf file with them. # this ones cleaned up, it was 4 lines. # limitations: # only tested from firefox # populates ~. if anyone cares, ill add a DL directory option # todo: # download directory # http://forums.macosxhints.com/archive/index.php/t-42616.html # osascript -e 'tell app "Finder" to display dialog "Hey!"' # disclaimer: brahm cohen, the maker of bittorrent doesnt even know # this exists, let alone has anything to do with it. in fact hed # probably laugh at it, and you if you bug him about it. (and me # for writing it) complain to pixel (the mail server is gimp.org) # see http://pixelfairy.org/ for other silly screen and ssh scripts. # furthur disclaimer, as you can see, the comments are longer than the # code. sucks to code these days... # licence: public domain. DESTHOST=localhost # use yourname@example.com if remote. BTCOMMAND=btdownloadcurses SSHCMD="ssh -a" SCREENCMD="screen" TORRENT=`basename $1` if [ ! $TMP ];then TMP=/tmp fi ERRLOG=$TMP/errlog-$TORRENT-$$ PERMLOG=~/.btdetached.errors DIALOG=xmessage if [ -f ~/.btdetachedrc ];then . ~/.btdetachedrc fi display_error() { $DIALOG `cat $ERRLOG` cat $ERRLOG >> $PERMLOG } if [ $DESTHOST = "localhost" ]; then cd ~ cp $TMP/$TORRENT . if ! $SCREENCMD -S $TORRENT -dm $BTCOMMAND $TORRENT 2> $ERRLOG;then display_error fi else scp $TMP/$TORRENT $DESTHOST:~ if ! $SSHCMD $DESTHOST \ "$SCREENCMD -S $TORRENT -dm $BTCOMMAND $TORRENT" 2> $ERRLOG;then display_error fi fi rm -f $ERRLOG