domenica 18 aprile 2010

Opening Sopcast links from within Firefox on Ubuntu Karmic 9.10

I'd like to open sop:// protocol links automatically in Firefox. The most popular solution I found is:

 1. In Firefox, in the Location bar, type about:config and press Enter.
 2. Right-click anywhere in the grid, choose New, then String.
 3. In the Enter the preference name prompt, type in network.protocol-handler.app.sop and press OK.
 4. In the Enter string value prompt, type sopcast-player and press OK.
 5. Try to open sop:// link on your favorite website and you will be presented with dialog box where you can search location of sopcast player. Navigate to ~/usr/bin and point to sopcast-player and click OK.
 6. OK out of dialog box and now all sop:// links should open sopcast player automatically.

This solution doesn't work for me. When I try to to open sop:// link, I'm not presented with "Open with..." dialog box. I receive an error message like:

Firefox doesn't know how to open this address, because the protocol (sop) isn't associated with any program.

In my case Firefox 3 does not actually launch sopcast-player using the network.protocol-handler.app configuration option.
If I go to Edit -> Preferences -> Applications, the sop protocol is not listed and I cannot add it there.
So I tought to retrieve all needed parameters from Windows and add the protocol manually via config file. mimeTypes.rdf stores information about which action is to be performed when downloading certain types of files, such as opening the file in a specific program or saving it to disk. mimeTypes.rdf is stored on our hard drive in ~/.mozilla/firefox/xxxxxxxx.default/
1.  Quit Firefox
2. we can back up the profile directory: if something goes wrong we can restore original files.
3. Let's open up mimeTypes.rdf. We have to find the section and modify it in this way (adding the line <RDF:li RDF:resource="urn:scheme:sop"/>):

<RDF:Seq RDF:about="urn:schemes:root">
    <RDF:li RDF:resource="urn:scheme:mailto"/>
    <RDF:li RDF:resource="urn:scheme:irc"/>
    <RDF:li RDF:resource="urn:scheme:ircs"/>
    <RDF:li RDF:resource="urn:scheme:webcal"/>
    <RDF:li RDF:resource="urn:scheme:dlc"/>
    <RDF:li RDF:resource="urn:scheme:sop"/>
</RDF:Seq>

4. Now we have to add these parameters below the line </RDF:Seq>:

<RDF:Description RDF:about="urn:scheme:sop"
                              NC:value="sop">
   <NC:handlerProp RDF:resource="urn:scheme:handler:sop"/>
</RDF:Description>
<RDF:Description RDF:about="urn:scheme:handler:sop"
                              NC:alwaysAsk="true" />


Done! Now if we open sop:// protocol links in Firefox, we will be presented with "Open with..." dialog box. Or, once Firefox is loaded, we can go to to Edit -> Preferences -> Applications and set the location of sopcast-player.

EDIT (09/12/2010):
It may be necessary to modify the boolean value of network.protocol-handler.expose-all on Ubuntu 10.04:

 1. In Firefox, in the Location bar, type about:config and press Enter.
 2. Set the value of network.protocol-handler.expose-all to false .
 3. Try to open sop:// link on your favorite website and you will be presented with dialog box where you can search location of sopcast player. Navigate to ~/usr/bin and point to sopcast-player and click OK.
 4. OK out of dialog box and now all sop:// links should open sopcast player automatically
 5. We can restore the value of network.protocol-handler.expose-all to true.

Best regards.