Difference between revisions of "Ed2k links handling"

From AMule Project FAQ
Jump to: navigation, search
Line 53: Line 53:
 
'''by ''thermoman (Marcel Meckel)'', ''ender'' and ''[[User:Jacobo221|Jacobo221]]''
 
'''by ''thermoman (Marcel Meckel)'', ''ender'' and ''[[User:Jacobo221|Jacobo221]]''
  
=== Opera configuration ===
+
=== Clean way ===
  
Edit ''/etc/opera6rc'' as root or ''~/.opera/opera6.ini'' as non-root:
+
In [http://www.opera.com Opera] go to ''Tools->Preferences->Paths and Programms->Add...''
  
<code>[User Prefs]<br>
+
In the "Protocol" field enter ''ed2k''
TrustedExternalURLProtocols=ed2k
+
  
[Trusted Applications]<br>
+
In the "Path" or "Open with another application" field enter ''/path/to/ed2k''
ed2k=/path/to/ed2k ed2k://%u</code>
+
 
+
Or an easier way:<br>
+
open ''Tools->Preferences->Paths and Programms->Add...''<br>
+
protocol = ed2k<br>
+
choose the path: ''/path/to/ed2k''
+
  
 
http://www.amule.org/dev-up/ed2k-op.jpg
 
http://www.amule.org/dev-up/ed2k-op.jpg
 +
 +
=== Dirty way ===
 +
 +
If he above instructions didn't work, you can try edit ''/etc/opera6rc'' as root or ''~/.opera/opera6.ini'' as non-root and setting:
 +
 +
''[User Prefs]''<br>
 +
''TrustedExternalURLProtocols=ed2k''<br>
 +
''[Trusted Applications]''<br>
 +
''ed2k=ed2k''
  
 
=== Opera 6 bug ===
 
=== Opera 6 bug ===
  
 
'''[http://www.opera.com Opera] 6''' doesn't pass complete URL to external programs; only URL without protocol. The way to walk around this follows.
 
'''[http://www.opera.com Opera] 6''' doesn't pass complete URL to external programs; only URL without protocol. The way to walk around this follows.
 
'''NOTE:''' [http://www.opera.com Opera] 6 users must also note that in ''[Trusted Applications]'' section, instead of ''ed2k=/path/to/ed2k %u'', they must use ''ed2k=/path/to/ed2k'' since the ''%u'' switch isn't supported.
 
  
 
==== [http://www.kernel.org Linux] or some other [http://www.unix.org Unix]-like flavour ====
 
==== [http://www.kernel.org Linux] or some other [http://www.unix.org Unix]-like flavour ====
Line 83: Line 83:
 
/path/to/ed2k "ed2k://$1"</code>
 
/path/to/ed2k "ed2k://$1"</code>
  
Change ''ed2k=/path/to/ed2k ed2k://%u'' with ''ed2k=/path/to/amule_submit.sh ed2k://%u''
+
Now in ''Tools->Preferences->Paths and Programms->Add...->Path'' or in the ''opera6rc'' file change ''ed2k=/path/to/ed2k'' with ''ed2k=/path/to/amule_submit.sh''
  
 
==== [http://www.microsoft.com/windows Windows] ====
 
==== [http://www.microsoft.com/windows Windows] ====
Line 105: Line 105:
  
 
*Now another right click, select '''New''' and '''String'''; insert ''network.protocol-handler.app.ed2k'' as '''Preference Name''' and ''/path/to/ed2k'' (or path to where the file is installed on you system) as '''Value'''.
 
*Now another right click, select '''New''' and '''String'''; insert ''network.protocol-handler.app.ed2k'' as '''Preference Name''' and ''/path/to/ed2k'' (or path to where the file is installed on you system) as '''Value'''.
 +
 +
http://www.amule.org/dev-up/ed2k-ff9.jpg
  
 
== [http://www.mozilla.org/products/firefox Firefox] v0.8 ==
 
== [http://www.mozilla.org/products/firefox Firefox] v0.8 ==
Line 222: Line 224:
 
Because links somewhat malforms the urls, we need a small bash script handler:
 
Because links somewhat malforms the urls, we need a small bash script handler:
 
   ''cat > /usr/bin/ed2k4links.sh << "EOF"''
 
   ''cat > /usr/bin/ed2k4links.sh << "EOF"''
 +
 
   ''#!/bin/bash''
 
   ''#!/bin/bash''
 
   ''ed2k $(echo "ed2k://$1" | sed s/_/\|/g)''
 
   ''ed2k $(echo "ed2k://$1" | sed s/_/\|/g)''

Revision as of 02:36, 12 November 2004

The way to have aMule handle your ed2k links on your favorite WebBrowser will depend on which WebBrowser you use. So, here's a list of mini-HowTos for each of the most popular WebBrowsers. Have in mind that everywhere on this document, /path/to/ed2k should be replaced with /usr/local/bin/ed2k, /usr/bin/ed2k, C:\Program Files\aMule\ed2k.exe or whatever, depending on your own system's configuration.

As a general idea, in most Linux systems, self-compiled aMules will install the ed2k utility in /usr/local/bin/ed2k, while package-installed aMules will install it in /usr/bin/ed2k. As an exception, it is known that SuSE packages install it in /usr/local/bin/ed2k.

Internet Explorer

by Jacobo221

Go to "Start" -> "Run" and run "regedit" (without quotes). Now, in regedit, get to HKEY_LOCAL_MACHINE\SOFTWARE\Classes\ed2k\shell\open
It could happen that ed2k didn't exist. In such case, create it by selecting "New" -> "Key" and entering ed2k as value. Then do the same with shell and open.
Once inside the open key, if command exists, just double click on it, but if it doesn't, go to "New" -> "Value" and enter the path to the ed2k application as an ASCII string value, followed by "%1" (with quotes), so you should end with some value like C:\Program Files\aMule2\ed2k "%1".

Konqueror

by gfdsa

/usr/kde/3.1/share/services you can find it by file names ended with .protocol kinda `find /usr -name "*.protocol"` or `find /opt -name "*.protocol"` or even put / to path if you want.

If the search was successful, create a file named like ed2k.protocol in the mentioned directory:

[Protocol]
exec=/path/to/ed2k "%u"
protocol=ed2k
input=none
output=none
helper=true
listing=false
reading=false
writing=false
makedir=false
deleting=false

Now just restart Konqueror.

NOTE: You might get a security warning. don't worry. it is just warning you that the link is being sent to an external application.

NOTE2: If after clicking OK on the security warning the link is still not being sent to aMule, just right click on the ed2k links and tell Konqueror to open it in a new window.

Galeon

In the GNOME Control Center go to "Complex" -> "File Types and Programs" -> "Internet Services" -> "Add Service...".

In the protocol filed enter ed2k

In the Program field enter ed2k %s

Unselect "Run in terminal" if it is selected.

Click OK and you're done!

Opera

by thermoman (Marcel Meckel), ender and Jacobo221

Clean way

In Opera go to Tools->Preferences->Paths and Programms->Add...

In the "Protocol" field enter ed2k

In the "Path" or "Open with another application" field enter /path/to/ed2k

http://www.amule.org/dev-up/ed2k-op.jpg

Dirty way

If he above instructions didn't work, you can try edit /etc/opera6rc as root or ~/.opera/opera6.ini as non-root and setting:

[User Prefs]
TrustedExternalURLProtocols=ed2k
[Trusted Applications]
ed2k=ed2k

Opera 6 bug

Opera 6 doesn't pass complete URL to external programs; only URL without protocol. The way to walk around this follows.

Linux or some other Unix-like flavour

Create amule_submit.sh with this content:

#!/bin/sh
/path/to/ed2k "ed2k://$1"

Now in Tools->Preferences->Paths and Programms->Add...->Path or in the opera6rc file change ed2k=/path/to/ed2k with ed2k=/path/to/amule_submit.sh

Windows

Create amule_submit.bat with this content:

X:\path\to\ed2k.exe "ed2k://%1"

Change ed2k=/path/to/ed2k ed2k://%u with ed2k=X:\path\to\amule_submit.bat ed2k://%u

Mozilla 1.7 (or later) & Firefox 0.9

by GhePeU

Mozex doesn't work anymore with Mozilla 1.7 and Firefox 0.9. There is an alternate method that seems to be working with both of them:

  • Remove MozEx if installed or at least remove the ed2k input from it (only if MozEx is installed)
  • Insert about:config in the address bar
  • Right click on the list, select New, then Boolean; insert network.protocol-handler.external.ed2k as Preference Name and true as Value
  • Now another right click, select New and String; insert network.protocol-handler.app.ed2k as Preference Name and /path/to/ed2k (or path to where the file is installed on you system) as Value.

http://www.amule.org/dev-up/ed2k-ff9.jpg

Firefox v0.8

Go to MozEx's WebPage and install the mozex-1.07.xpi file.

Restart FireFox, go to Edit -> Preferences -> Extensions -> mozex -> Options -> ED2K and set it to /path/to/ed2k %r

Click OK and you're done.

http://www.amule.org/dev-up/ed2k-firefox.png

http://www.amule.org/dev-up/ed2k-mozex.png

Mozilla 1.3 to 1.6 & Firebird v0.6

by DeltaHF

Go to MozEx's WebPage and install the mozex-1.07.xpi file.

Restart Mozilla/FireBird, go to Edit -> Preferences -> mozex -> ED2K and set it to /path/to/ed2k %r

Click OK and you're done.


http://www.amule.org/dev-up/ed2k-moz.png

Mozilla 1.2.1 or earlier

by rpokorny [R. Pokorny]

1) Go to Protozilla's WebPage
Choose the version fitting your Mozilla-version and click on Install. It will auto-install Protozilla.
Now close Mozilla completely.

Notes for Linux and other Unix-like systems users
- You must have write permission to the Mozilla installation directory. If you've installed Mozilla in /usr, you'll have to be root probably.
- The downloadable precompiled version of Protozilla apparently does not work with Debian's Mozilla packages. It does work together with the precompiled version of 1.2.1 available at Mozilla's WebPage for example (or you can build both Mozilla and Protozilla yourself).

2) This step is only necessary if you had to start Mozilla/FireBird/FireFox as root in step 1.

As root do: cp -r /root/.mozilla/PROFILENAME/RANDOM.slt/protozilla/ /home/USERNAME/.mozilla/PROFILENAME2/RANDOM.slt/

This will have copied protozilla-configuration from root's home directory to user's home directory.

cd /home/USERNAME/.mozilla/PROFILENAME/RANDOM.slt/ chown -R YOURUSER.YOURGROUP protozilla

This will have changed file-ownership parameters in user's files.

Note:
USERNAME: Name of your normal, non-root user.
PROFILENAME: Name of the profile you'll want to use.
RANDOM: Random alphanumeric string, autogenerated by mozilla.
YOURUSER, YOURGROUP: User and group of your normal user.

3) Setup a protocol-handler for ed2k links:
cd ~/.mozilla/PROFILENAME/RANDOM.slt/protozilla/protocol

create a file called ed2k.cmd with the following content:

ed2k ed2k:$URI_DATA

(The file doesn't need to be executable).

Now restart Mozilla.

Links

(Probably this will work for the usual links and/or elinks, too)

add to url.c behind the lines about telnet and tn3270:

 --snip
 {"ed2k", 0, NULL, ed2k_func, 0, 0, 0},
 --snap

add to links.h behind the definitions of /* mailto.c */:

 --snip
 void ed2k_func(struct session *, unsigned char *);
 --snap

add to mailto.c at the end:

 --snip
 void ed2k_func(struct session *ses, unsigned char *url)
 {
 tn_func(ses, url, options_get("network_program_ed2k"), TEXT(T_ED2K), TEXT(T_BAD_ED2K_URL));
 }
 --snap

add to options_register.c behind telnet and tn3270:

 --snip
 register_option_char("network_program_ed2k", TEXT(T_ED2K_PROG),NULL,2);
 --snap

add to intl/*.lng behind

 "T_TN3270_PROG": T_ED2K_PROG, "ed2k program", (or whatever that is in your language), behind
 "T_TN3270": T_ED2K, "ed2k", and behind 
 "T_BAD_TN3270_URL": T_BAD_ED2K_URL (I guess you've got the picture)

If you want to automatize this stuff, execute the following commands:

 cd intl
 for l in *.lng; do
   cp $l $l.bak
   cat $l.bak | sed -e "/T_TN3270_PROG*/aT_ED2K_PROG\, \"ed2k program\"\," \
    -e "/T_TN3270,\ */aT_ED2K\, \"ed2k\"\," \
    -e "/T_BAD_TN3270_URL*/aT_BAD_ED2K_URL\, \"Bad ed2k url\"\," > $l
 done
 

Anyway, run afterwards before recompiling links-hacked:

 ./synclang
 cd ..

Now you can compile with

 ./configure (add your favourite options here) &&
 make &&
 make install

Because links somewhat malforms the urls, we need a small bash script handler:

 cat > /usr/bin/ed2k4links.sh << "EOF"
 #!/bin/bash
 ed2k $(echo "ed2k://$1" | sed s/_/\|/g)
 EOF
 chmod a+x /usr/bin/ed2k4links.sh

Do not forget to setup links (Options->Network Options->Mail and Telnet Programs) to call our ed2k4links.sh for ed2k links:

 ed2k4links.sh %

Attention: The Percent Mark is important! Now links should work with ed2k links.