Adding links to MLDonkey from Opera

Posted on Sunday, November 11, 2007 in FLOSS, Software, Opera

Adding links to MLDonkey from Opera

I envied Firefox extension for MLDonkey which allows you to add elinks and torrents to MLDonkey from the browser with a single click, even if MLDonkey is running in other PC. It's a luxury I want to have in Opera, is quite easy.

It should be even easier using -remote openURL() Opera parameter, but I got problems doing it this way (it seems to ignore %U parameter), so I finally did it this way:

  1. Disable Opera BitTorrent client, in advanced configuration page uncheck Enable under BitTorrent section so Opera doesn't start BitTorrent downloads when clicking a .torrent file.

  2. MLDonkey web interface is needed (i.e. http_port != 0)

  3. Then, we make a script, let's call it mld-opera and store it everywhere, for example /usr/local/bin. The contents of the script are the following:

    #!/bin/sh
    opera -remote "openURL(http://192.168.0.1:4080/submit?q=dllink+$(echo -n "$*" | sed -e "s-/-%2F-g"),background-page)"

    Assuming that MLDonkey is being run in 192.168.0.1 IP address with web interface in port 4080, replace what you need.

    Note that sed is being used to replace / by %2F so MLDonkey web interface doesn't throw a 404 error with elinks.

  4. After that, in Opera go to Tools->Preferences->Advanced->Programs and add the following protocols:
    • Protocol: ed2k
      Open with other application: /usr/local/bin/mld-opera
    • Protocolo: magnet
      Open with other application: /usr/local/bin/mld-opera
    • Protocolo: sig2dat
      Open with other application: /usr/local/bin/mld-opera

    If you have saved the script in other location than /usr/local/bin/mld-opera you should replace it with your location.

  5. And in Tools->Preferences->Advanced->Downloads uncheck "Hide file types opened with Opera" to modify application/x-bittorrent MIME type (create it if doesn't exist) the following way:

    MIME type: application/x-bittorrent
    File extensions: torrent
    Open with other application: /usr/local/bin/mld-opera
    Pass web address directly to application: checked

    Again, if you have saved the script in other location than /usr/local/bin/mld-opera you should replace it with your location.

  6. If you have limited access to MLDonkey by user and password you can check "Remember password" when Opera asks for it for more convenience.