Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

Every time I download a torrent file (.torrent), Firefox thinks I should open it with a text editor. How can I get it to open with Transmission? In Edit -> Preferences -> Applications, there's no setting for torrent files, and no apparent way to add a new filetype.

share|improve this question
    
Are you refering to .magnet files? –  xangua Nov 30 '13 at 23:38
    
.torrent files. I'll edit the question to reflect this. –  Jon Nov 30 '13 at 23:49
    
With a torrent file downloaded, execute xdg-mime query filetype some.torrent –  Braiam Dec 1 '13 at 0:00
2  
when you open directly(I mean from the file manager it self), does it open from Transmission ? –  Janith Chinthana Dec 7 '13 at 4:49
1  
interesting news (6 December, 2013)... Ubuntu to include torrent search in Dash search –  rusty Dec 16 '13 at 8:01

5 Answers 5

up vote 17 down vote accepted
+50

Method (I): Using Firefox's Preferences menu: (preferred)

A. From Firefox's global menu, select Edit -> Preferences (or press Alt + E followed by N) to open Firefox Preferences.

(Snapshot taken in Ubuntu 12.04) 1

B. Select the Applications menu and search for BitTorrnet seed file or application/x-bittorrent or torrent. Change the Always ask or Use gedit (default) to transmission-gtk by selecting Use other... and click File System in the side bar, then browse to /usr/bin.

2

C. In /usr/bin search for transmission-gtk and double click to open.

3

D. That's it! Now the .torrent files will be opened with transmission.

4


Method (2): Editing the mimeTypes.rdf file:

Step 1:

Open the mimeTypes.rdf file with text editor of your choice:

gedit ~/.mozilla/firefox/ythemo16.default/mimeTypes.rdf &

(Save a backup of this file.) Search for the container:

<RDF:Seq RDF:about="urn:mimetypes:root">
 ...
 ...

</RDF:Seq>

and insert this:

<RDF:li RDF:resource="urn:mimetype:application/x-bittorrent"/>

so that, now the container looks something like this:

<RDF:Seq RDF:about="urn:mimetypes:root">
 ...
 ...

 <RDF:li RDF:resource="urn:mimetype:application/x-bittorrent"/>
</RDF:Seq>

(step 1 snapshot) mimeType-edit-snap1

Step 2:

Now, within the container:

<RDF:RDF ... ...>
 ...
 ...

 ...
 ...

</RDF:RDF>

insert these:

<RDF:Description RDF:about="urn:mimetype:handler:application/x-bittorrent"
               NC:alwaysAsk="false"
               NC:saveToDisk="false">
 <NC:possibleApplication RDF:resource="urn:handler:local:/usr/bin/transmission-gtk"/>
 <NC:externalApplication RDF:resource="urn:mimetype:externalApplication:application/x-bittorrent"/>
</RDF:Description>
<RDF:Description RDF:about="urn:mimetype:externalApplication:application/x-bittorrent"
               NC:prettyName="transmission-gtk"
               NC:path="/usr/bin/transmission-gtk" />
<RDF:Description RDF:about="urn:handler:local:/usr/bin/transmission-gtk"
               NC:prettyName="transmission-gtk"
               NC:path="/usr/bin/transmission-gtk" />

<RDF:Description RDF:about="urn:mimetype:application/x-bittorrent"
               NC:fileExtensions="torrent"
               NC:description="BitTorrent seed file"
               NC:value="application/x-bittorrent"
               NC:editable="true">
    <NC:handlerProp RDF:resource="urn:mimetype:handler:application/x-bittorrent"/>
</RDF:Description>

so that the container will look something like this:

<RDF:RDF ... ...>
 ...
 ...

 ...
 ...

 <RDF:Description RDF:about="urn:mimetype:handler:application/x-bittorrent"
               NC:alwaysAsk="false"
               NC:saveToDisk="false">
  <NC:possibleApplication RDF:resource="urn:handler:local:/usr/bin/transmission-gtk"/>
  <NC:externalApplication RDF:resource="urn:mimetype:externalApplication:application/x-bittorrent"/>
 </RDF:Description>
 <RDF:Description RDF:about="urn:mimetype:externalApplication:application/x-bittorrent"
               NC:prettyName="transmission-gtk"
               NC:path="/usr/bin/transmission-gtk" />
 <RDF:Description RDF:about="urn:handler:local:/usr/bin/transmission-gtk"
               NC:prettyName="transmission-gtk"
               NC:path="/usr/bin/transmission-gtk" />

 <RDF:Description RDF:about="urn:mimetype:application/x-bittorrent"
               NC:fileExtensions="torrent"
               NC:description="BitTorrent seed file"
               NC:value="application/x-bittorrent"
               NC:editable="true">
    <NC:handlerProp RDF:resource="urn:mimetype:handler:application/x-bittorrent"/>
 </RDF:Description>
</RDF:RDF>

(step 2 snapshot) mimeType-edit-snap2

Step 3:

Save and close the file. Then restart firefox.

share|improve this answer
2  
There is no type called "BitTorrent see file" in my list of content types, nor does there appear to be a way to add a new content type. –  Jon Dec 9 '13 at 3:59
    
@Jon, you might want to edit the mimeTypes.rdf file... updated my answer... –  rusty Dec 9 '13 at 5:54
    
I think you meant "Alt + E", not "Ctrl + E". –  Ufoguy Dec 13 '13 at 5:23
    
The first method didn't work because "BitTorrent seed file" didn't appear, but the second method worked. You can open you mimeTypes file with gedit ~/.mozilla/firefox/*.default/mimeTypes.rdf & and make sure to restart Firefox after editing. –  Zephyrus Sep 19 at 0:33

Another more user-friendly way to add a new file type to the Edit -> Preferences -> Applications window is by downloading a file that has the file format you want to add, selecting any option, and selecting the "Do this automatically for files like this from now on." checkbox. Source: firefox doc.

share|improve this answer

Open the Firefox preferences window. Go to the Applications tab and you should see magnet on the list. Click on Always ask and if Transmission does not appear as an option then click on Use other and navigate to /usr/bin on your file system. Look for transmission or transmission-gtk and click that.

Source: How to make Firefox open magnet-links in Transmission

If magnet didn't show up in the applications tab, then you should do this via about:config as explained below:

  • Type about:config into the address bar and press Enter.
  • Right-click -> New -> Boolean -> Name: network.protocol-handler.external.magnet -> Value -> true
  • Right-click -> New -> String -> Name: network.protocol-handler.app.magnet -> Value -> /usr/bin/transmission
  • Ensure network.protocol-handler.expose-all is set to true

Source: Magnet links in Firefox using Transmission

share|improve this answer
1  
I'm looking for a way to open .torrent files, not magnet files. –  Jon Dec 9 '13 at 3:57
    
sorry i was mistaken. but you can follow the steps, it would be same for both. –  Janith Chinthana Dec 9 '13 at 6:12

Next time you download a torrent file, and the window pops up to ask what to do, give the path for the file to open with: /usr/bin/transmission-gtk and select it. All done.

share|improve this answer

The answer depends on whether the server sends you the correct mime type (not just the file with the right extension). You can check whether the server is sending the correct mime type by installing the Live HTTP Headers addon for Firefox. (Start the addon just before you click on the download link for the torrent file, and watch the response header, it should contain: Content-Type: application/x-bittorrent.) If it does, then Firefox will be able to open the file with the default application currently setup on your computer. In Ubuntu you can download a torrent file, then right click and select 'Properties', there you will find a way to select the default application.

If, however, the server sends .torrent as an octet-stream or some other weird mime, then Firefox will NOT do the stupid thing and open it by extension (like some broken browsers do), since that can lead to very bad results. But every so often you are willing to take a risk, you can try https://addons.mozilla.org/en-US/firefox/addon/force-content-type/, but keep in mind that this extension is considered buggy and may actually make the matters worse.

If the server is doing it wrongly, and you are not willing to take risks, you can simply have Transmission monitor your download folder and automatically add torrent files you place there. It can even remove the files after it added them. You will find that in the settings of Transmission.

P.S. Should you need a way to keep other application as the default when double clicking, but transmission only from firefox, you can follow instructions at http://forums.mozillazine.org/viewtopic.php?f=9&t=1706945

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.