PDA

View Full Version : HOWTO: Have firefox open torrents with utorrent


bruenig
June 20th, 2007, 12:07 AM
This tutorial assumes that you have wine installed and utorrent installed and know how to launch utorrent with wine. If you don't know how to do that do some searches there are HOWTOs for that.

With that taken care of here is how you open torrents with utorrent with firefox custom action:

The way firefox feeds stuff to helper applications is by downloading the file to /tmp and then executing "program /tmp/file"

So what you need to do to take advantage of this is:

1. Open up utorrent and navigate to Options>Preferences>Others
2. Make sure Automatically load torrents in directory is checked
3. For directory put z:\tmp
4. This is optional but I would go ahead and select delete .torrent instead of renaming, when loading.

With that configured, write a little script that launches utorrent. I named mine utorrent and put it in /usr/local/bin/utorrent.
Do:
gksudo gedit /usr/local/bin/utorrent
and put
#!/bin/bash
wine "path/to/utorrent.exe"
Replace "path/to/utorrent.exe" to the real one.

Then to make it executable do:
sudo chmod +x /usr/local/bin/utorrent

After you have done that, all you need to do is click on a torrent in firefox, when it asks you what to do with it, select open with application drop down menu and pick other and navigate it to /usr/local/bin/utorrent and click on that, then if you want it to do it automatically, click that box.

And there you go, should work.

stealthbox
June 28th, 2007, 11:02 PM
very good guide, it helped me alot , thank you

rhuarch
July 2nd, 2007, 01:31 AM
Thanks for the great guide. I have only noticed one major problem. This method works fine as long as utorrent is currently closed. If you try to open a new torrent file from Firefox with utorrent already open, it kicks back an unknown error. Anyone else run into this or am I doing something wrong?

bruenig
July 2nd, 2007, 06:37 AM
Oh it works for me when I do it even if it is open. You could add a quick test to see if it is running and then if it isn't not to execute the wine "/path/to/utorrent.exe"

#!/bin/bash
if [[ ! "$(ps -A | grep utorrent.exe)" ]]; then
wine "/path/to/utorrent.exe"
fi

If it isn't running, it will be launched, if it is, it won't be. But because utorrent monitors /tmp, even though you don't launch it or anything, it will still pick up on the new torrent and add it in theory at least.

kozmic
July 2nd, 2007, 01:24 PM
I solved my problem this way:

Instead letting uTorrent check folder for new torrent files, I made a script which makes uTorrent behave in the same way as in Windows.

First, if .torrent files are opened automatically with Firefox, remove this default action here: Edit -> Preferences -> Content -> Manage -> Select the torrent extension, and hit "Remove action".

Create a bash-script which will be the uTorrent launcher you want to open .torrent files with:
sudo vim /usr/local/bin/utorrent.sh
Inside utorrent.sh:
#!/bin/bash
wine "/media/sda1/Program Files/uTorrent/utorrent.exe" $*
Remember to change your path to your uTorrent executable in the above step.
Now make it executable:
chmod +x /usr/local/bin/utorrent.sh

Now when firefox wants to open a .torrent file, select the utorrent.sh file. uTorrent will now, if not started, start and open the torrentfile. If uTorrent is currently running, you will simply get the dialog from uTorrent on where to save the content of the torrent file.

Beatbreaker
July 7th, 2007, 11:20 PM
good guide, i followed the first post and it works for me. - it didn't work so well when utorrent wa already open

kozmics guide worked better for me - you forgot a sudo in your command though:

sudo chmod +x /usr/local/bin/utorrent.sh

bruenig
July 9th, 2007, 12:39 AM
good guide, i followed the first post and it works for me. - it didn't work so well when utorrent wa already open

kozmics guide worked better for me - you forgot a sudo in your command though:

sudo chmod +x /usr/local/bin/utorrent.sh

Did you try my post above his.

Beatbreaker
July 15th, 2007, 02:46 AM
Did you try my post above his.

i tried your way first but i couldnt get it to work when utorrent was already open

misfitpierce
July 15th, 2007, 02:47 AM
Ditch utorrent I heard it was sold to bittorrent which riaa owns or something of the sort. lol

Beatbreaker
July 15th, 2007, 02:49 AM
Ditch utorrent I heard it was sold to bittorrent which riaa owns or something of the sort. lol

I've actually heard the same thing too - i won't be changing over until i'm sure this is the case though

misfitpierce
July 15th, 2007, 02:54 AM
Well I read part of it somewhere... in any case transmission which can be found on getdeb is a great lightweight program for torrents.

bruenig
July 24th, 2007, 11:44 PM
You guys don't understand the brilliance of that move. The bittorrent corporation who has absolutely no control over anything in terms of what is shared and what isn't, signs a deal with them saying that they won't share any copyrighted material. The get free money from stupid RIAA who doesn't recognize the difference between a bittorrent client or network and the corporation.

ARTO^UK
July 25th, 2007, 04:33 PM
Thanks alot :)

aparigraha
July 26th, 2007, 03:57 PM
Hey.
I've got uTorrent up and running fine through Wine. I've used Opera as a browser for years, and only FF on and off. Connecting Opera with uTorrent was really easy:

Tools->Preferences->Advanced->Downloads->application/x-bittorrent->Edit

wine /home/path/to/utorrent.exe

No scripts!

The problem is that I haven't been able to get all torrents working with Firefox.
I've tried the script - utorrent.sh

#!/bin/bash
wine "/path/to/utorrent.exe" $*

I works on and off. Whenever I get torrents with non-english letters like theses íéÈÄåöäÄÖÅ... this script just doesn't handle it. I got an error-can-not-find-file-bla-bla in a small utorrent window.
Asian characters were the same.

So I ripped this guys script from this thread (http://ubuntuforums.org/showthread.php?p=1879660#post1879660) and now it works a lot better.

#!/bin/sh
LANG=en_US.utf-8
LC_MESSAGES=en_US.utf-8
TORRENT_FILE=`winepath "$1"`
wine "/path/to/utorrent.exe" "$TORRENT_FILE" &

Ofcourse... put in the correct /path/to/utorrent.exe

THX Flying_OE

spyros71
July 26th, 2007, 05:07 PM
Newbie question: why not use Ktorrent instead of u-torrent? In what way is utorrent better so that I should get in trouble installing wine then utorrent and then conecting that to FF? Can someone please explain?

bruenig
July 28th, 2007, 02:26 PM
kde libs slow down the computer.

raonyguimaraes
September 4th, 2009, 10:13 AM
This worked for me :

#!/bin/bash
/home/raony/cxoffice/bin/wine "/home/raony/.cxoffice/winxp/drive_c/Program Files/uTorrent/utorrent.exe" "$*"

*don't forget to use "$*" because sometimes the torrent has strange characters that needs to be escaped

Levo
September 21st, 2009, 03:21 PM
This will work much better and faster:


#!/bin/bash
torrent_file="${*##*/}"
wine "/home/YOUR_USER_NAME/.wine/drive_c/Program Files/uTorrent/utorrent.exe" "Z:/tmp/$torrent_file"


Assuming "Z:" is configured to be "/" and "/home/YOUR_USER_NAME/.wine/drive_c/Program Files/uTorrent/utorrent.exe" uTorrent's executable full path.

Place this script in "/usr/bin" and point firefox to this.