Browser Integration

From MLDonkey
(Redirected from BrowserIntegration)
Jump to: navigation, search

How to add files to MLDonkey from various browsers.

TODO gather all browser extensions into nice table (as for Gui).

Contents

Mozilla Firefox

Extensions integrate FireFox with your MLDonkey server, allowing you to add torrents and other links (e.g., magnet, sigdat and ed2k) to the server's download queue with a single click :


A more complex method that works even for ancient versions of Firfox is a handler based hack.

Alternative to the above handler based hack is to use FlashGot extension and add a custom download manager, passing [URL] [REFERER] to a similar script (example for http URLs).

Gnome

Gnome compliant browsers (Galeon,Epiphany,...) GNOME 2.8 and older

Galeon Users and users of other Gnome compliant applications, just install [mlurlslave for GTK+ http://ircnet.de/home/cru/ed2k_urlslave/mlurlslave.html] or mlurlslave for GTK2
Alternately use instructions at mlurlslave but use /usr/bin/mldonkey_command instead of mlurlslave

However, if you happen to not have gnomecc --as is true for gnome2-- you still can set it up. Here goes: (we start at 4)

start gnome-control-center* go to complex (Komplex* in German) double-click on File Types and Programs (Dateitypen und Programme* in German) highlight Internet Services* click on Add Service...*

make sure Run in Terminal is unchecked* click OK*

You're done! Well I was... Now I can click on ed2k://-links and they are added to the queue.


If you have problems _please_ come by the IRC channel and look for me --housetier--, so we can sort it out. (Channel is #mldonkey on irc.freenode.net; see also the HomePage, under FAQs)

New GNOME 2 integration using gconf (GNOME 2.10 and newer)

Just install [mlurlslave for GTK+] or [mlurlslave for GTK2]

The filetypes and Programs capplet does not exist anymore in newer GNOME versions, so you'd have to add the handler directly to the gconf database. To do this you type:

(Oh yeah, I noticed that the telnet protocol changed somewhat, so you have to edit the mlurlslave file (/usr/local/bin/mlurlslave) and change the line elsif(/download started/){ to elsif(/Added link/){. If you don't do this, mlurlslave will give you an error message. The download is still started though. Test reaction with dllink in console when in doubt.)

Konqueror

Here is the code for konqueror_submit:

#!/usr/bin/perl

#Creates a link to submit to MLdonkey and submits using Konqueror

use URI::Escape;
$uri  = $ARGV[0];
# change these as needed
$username = "admin";
$password = "";
$server_addr = "localhost";
$server_port = "4080";

$link = sprintf("http://%s:%s@%s:%s/submit?q=dllink+%s",
        $username,$password,$server_addr,$server_port,uri_escape($uri));

exec ('konqueror',$link);

Edit and put in your path. Make sure you chmod +x konqueror_submit or it won't work.

This works for .torrent-files/links. To use it with the edk2 protocol, do:

Here is the protocol handler file that goes in .kde/shar/services/edk2.protocol

[Protocol]
exec=konqueror_submit '%u'
protocol=ed2k
input=none
output=none
helper=true
listing=false
reading=false
writing=false
makedir=false
deleting=false
Icon=remote
Description=Handles eDonkey2000 ed2k://-links

RedZeus, source Forums&fileviewtopic&t=2462

Opera

Unix

(~HowTo found on the web @ http://knowledge.martignier.net/MlDonkey in german - translated by fob)


in the section ~~User Prefs* add:

TrustedExternalURLProtocols=ed2k

Find section ~~Trusted Applications* (create it if it does not exist) and add:

ed2k=/usr/bin/ed2kopera
 or for Opera 7:
ed2k=/usr/bin/ed2kopera %u

create the file /usr/bin/ed2kopera* and insert the following text:

#!/bin/sh
echo dllink ed2k://$1 || nc -q 1 127.0.0.1 4000

(Change \"127.0.0.1\" and \"4000\" to fit the IP-Address and Portnumber that your mldonkey-core uses)

Unix v 8 Beta 2 (tested in Gentoo Linux-2.6.11-r4, Gnome 2.8.3)

Add protocol \"ed2k\"
Open with \"/home/userdir/ed2kopera\"
#!/bin/sh
echo dllink $1 || nc -q 1 127.0.0.1 4000

(Change \"127.0.0.1\" and \"4000\" to fit the IP-Address and Portnumber that your mldonkey-core uses)

Windows

In the root folder of the Opera installation (most probably C:\Program Files\Opera7) find the file 'opera6.ini'.

+Add in this file under ~~User Prefs

TrustedExternalURLProtocols=ed2k

Find the same file in the subfolder 'profile' (most probably C:\Program Files\Opera7\profile).

+Add in this file under ~~Trusted Protocols

ed2k<code>0,0,opera.EXE ~http://admin:@127.0.0.1:4080/submit?q</code>dllink+%1

And you are ready to click your favourite Ed2k links.

_(by White FrosT, only tested on Opera 7+)_


As a Side note with the particular version of opera I have (7.21) I had to use the following:

~[[~User Prefs]]
TrustedExternalURLProtocols=ed2k
...
~[[~Trusted Protocols]]
ed2k=0,0, /usr/bin/ed2kopera %u

and nc -q wasn't valid so i changed that in the script above to nc -i

_/cotyer_

elinks

elinks browser (http://elinks.or.cz/) can be customized with Lua scripts, so for this you need lua support enabled. Then, you have to modify your ~~/.elinks/hooks.lua file. In this file you can find the function called follow_url_hook. All web petitions go through this hook, which receives the URL the user has selected and it is either returned like that, or modified. We will modify it to detect ed2k and bittorrent links, and redirect them to our local mldonkey daemon.

First, somewhere add the following function used to reencode some bad characters found in URLs:

function url_encode(text)
    text = gsub(text, \" \", \"%%20\")
    text = gsub(text, \"%:\", \"%%3A\")
    text = gsub(text, \"%/\", \"%%2F\")
    text = gsub(text, \"%||\", \"%%7C\")
    text = gsub(text, \"%!\", \"%%21\")
    text = gsub(text, \"%�\", \"%%AA\")
    text = gsub(text, \"%&\", \"%%26\")
    return gsub(text, \"%#\", \"%%23\")
end

And now, before any processing is done in follow_url_hook, detect the urls. Example:

function follow_url_hook (url)

    -- Detecting ed2k links
    if strfind(url,'ed2k.*%||file%||') then
      text = url_encode(gsub(url, \"(.-)ed2k.'''file%||(~[[^]]''')%||(%d''')%||(%x''').*\", \"dllink ed2k://||file||%2%||%3%||%4%||\"))
      return \"~http://127.0.0.1:4080/submit?q=\"..text
    end

    -- Detecting ~BitTorrent links
    if strfind(url,'.*%.torrent$') then
      return \"~http://127.0.0.1:4080/submit?q=dllink%20\"..url_encode(url)
    end

    -- Return url without changes.
    return url
end

All browsers using Sancho (only BitTorrent)

Sancho (http://sancho-gui.sourceforge.net/) supports remote and local loading of a torrent direct from browser to mlnet. Assign browser to launch \"sancho -l %s\" for browser integration.

/usr/bin/sancho -l /home/username/somefile.torrent

Thats right this works even if the mlnet sancho is configured to access is on a remote machine.

All browsers using MLDonkey daemon running as user mldonkey (only BitTorrent)

Bash script to load local torrent

Another way to click on a bittorrent link and have it load in mldonkey is via a secondary script. Save this bash script as an executable in $HOME/bin. Assign your browser to launch the file when torrents are clicked on. Script and mldonkey must be on same system to work.

Note: The permissions and group may need to be fiddled with to get this script to work

Note: For mlnet on remote machine have torrent go to SMB shared directory and launch script on mlnet machine via auto ssh login and execution of script.

#!/bin/bash
#
# Script to be called by web browser to load torrents to mldonkey
#
# Created by ProteusMoteus
#
# This is setup for mldonkey running as daemon process as
# user mldonkey.  As configured by mldonkey-init.

MLCMD=\"/usr/bin/mldonkey_command\"
# Directory to move the .torrent to
CLOSET=\"/var/lib/mldonkey/torrents/downloads\"

if [[ [ ! -w \"$CLOSET\" | ! -s \"$1\" ]] ||] ||| ! $MLCMD; then
 [[ ! -s \"$1\" ]] && echo \"usage: mlbittorrent-script <torrent file>\"
 [[ ! -w \"$CLOSET\" ]] && echo ERR. Not writeable directory $CLOSET
else
 echo Given: $1
 CLOSET=\"$CLOSET/`basename \"$1\"`\"
 mv \"$1\" \"$CLOSET\"
 echo Moved to: $CLOSET
 ls -la \"$CLOSET\"
# Two lines below may need to be tweaked to get script to work
 chmod 660 \"$CLOSET\"
 chgrp mldonkey \"$CLOSET\"
 echo Changed permissions and group
 ls -l \"$CLOSET\"
 $MLCMD dllink \"$CLOSET\"
 echo Check downloads for file:
 echo \"$MLCMD vd || grep `basename \"$CLOSET\" .torrent`\"
 [[[ \"$CLOSET\" != *.torrent ]]] && echo WARNING. No torrent extension for $CLOSET
fi

#enable for troubleshooting
#echo Press [[ENTER]] to continue
#read

Internet Explorer

It seems to be possible to hack the registry to support ed2k links. See mlsubmit.reg

DonkeyInput registers itself as e2dk protocol handler and works under Windows. Tested with IE and FireFox.

Google Chrome

DonkeyBuddy

Chronkey

Android

GetEd2k - Android application to handle ed2k links

See also

Forum: how to download bittorrent with mldonkey?


LanguagesEnglish

Personal tools
Namespaces
Variants
Actions
Navigation
Toolbox