You are not logged in.

#1 2007-11-27 10:40:13

gunnihinn
Member
From: Torreón, Mexico
Registered: 2007-10-28
Posts: 81

Making Firefox save torrent files in a specific dir

I've just begun using rTorrent and I like it a lot, especially the feature where you can set up a directory for it to watch and have it start/stop downloads in torrents in that directory.

I am however having a bit of a problem getting Firefox to behave nicely with this. The "watch" dir isn't the same as the default download dir, and there is no option in Firefox to save *.torrent files in a specific dir.

I tried working around this by writing a small bash script that takes one argument and saves it in the "watch" dir, like so:

#!/bin/bash
wget -P "path_to_watch_dir" $1

and making Firefox execute it upon encountering *.torrent files, but then Firefox decides to download all *.torrent files to /tmp. The script works fine, both then run with the intended .torrent file as an argument and when the command is simply run in the shell, so I figure this is a problem with how Firefox passes arguments to scripts/programs.

Any thoughts on how to solve this problem? Should I maybe just take the easy way out and make the "watch" dir the same as the default download dir?

Offline

#2 2007-11-27 11:49:59

buttons
Member
From: NJ, USA
Registered: 2007-08-04
Posts: 620

Re: Making Firefox save torrent files in a specific dir


Cthulhu For President!

Offline

#3 2007-11-27 12:20:57

gunnihinn
Member
From: Torreón, Mexico
Registered: 2007-10-28
Posts: 81

Re: Making Firefox save torrent files in a specific dir

Thanks, but this doesn't quite work, see here:
http://dlstatusbar.proboards43.com/inde … 1174478065

Apparently there's a problem with torrent sites using redirected links, so this whole idea might be a bit more complicated than I originally thought.

Offline

#4 2007-11-28 22:14:58

jellywerker
Member
From: Sunny Seattle
Registered: 2005-04-04
Posts: 286

Re: Making Firefox save torrent files in a specific dir

Just move firefox out of the equation and make a script that watches your download dir for files that end in ".torrent" and have it move them to your watched dir.

Offline

#5 2007-11-28 22:48:58

test1000
Member
Registered: 2005-04-03
Posts: 834

Re: Making Firefox save torrent files in a specific dir

This is the most elegant way i know of to solve these problems: http://bbs.archlinux.org/viewtopic.php?id=37406


KISS = "It can scarcely be denied that the supreme goal of all theory is to make the irreducible basic elements as simple and as few as possible without having to surrender the adequate representation of a single datum of experience." - Albert Einstein

Offline

#6 2007-11-29 13:58:13

gunnihinn
Member
From: Torreón, Mexico
Registered: 2007-10-28
Posts: 81

Re: Making Firefox save torrent files in a specific dir

Thanks jellywerker and test1000, incrond and a simple bash script have taken care of things. big_smile

It didn't even cross my mind to do this without firefox. Some nerd I am. roll

Offline

#7 2007-11-29 23:48:40

phrakture
Arch Overlord
From: behind you
Registered: 2003-10-29
Posts: 7,879
Website

Re: Making Firefox save torrent files in a specific dir

I actually just save a little bookmark in the gnome dialog thinger (whatever it's called) to my torrents dir, then make it save to disk every time. Easy enough for me, but the script idea is a good one.

PS you can use the MimeEdit firefox extension to force the action to a script if you like

Offline

#8 2007-11-30 10:56:02

jond
Member
From: Norway
Registered: 2006-06-21
Posts: 13

Re: Making Firefox save torrent files in a specific dir


Just say yes

Offline

#9 2007-11-30 12:16:48

solstice
Member
Registered: 2006-10-27
Posts: 235
Website

Re: Making Firefox save torrent files in a specific dir

here is the script i use:
it just copy the first argument passed to the script by the browser to your watchdir.
whatch out my filesystem encoding is utf8

#!/bin/sh
#
# this script copies the torrent file passed as arguments to the directory
# watch_dir where rtorrent watches for new torrents
#
# to be used by your browser i.e. point your browser to rtorrent.sh and not 
# toward rtorrent !

# ~ does not seem to work today. WHY ?
if [ -z "$HOME" ] ;then
    HOME="/home/`whoami`"
fi

# exec >>$HOME/rtorrentsh.log 2>&1

if [ -z "$1" ] ;then
    exit 1
fi

src="$1"
if [ ! -f "$src" ] ;then
# opera passes the filename in latin1 encoding but my filesystem is in utf8
    src=`echo $1|iconv -f latin1 -t utf8`

    if [ ! -f "$src" ] ; then
        echo "rtorrent.sh: $1 file not found" >&2
        exit 1
    fi
fi

# your watch directory defined in .rtorrent.rc
watch_dir="$HOME/.rtorrent/watch"

cp "$src" "$watch_dir"

unset watch_dir torrent src

Offline

Board footer

Powered by FluxBB