Ed2k links handling-es

From AMule Project FAQ
Jump to: navigation, search

English | Deutsch | Nederlands | Korean | Español

La forma de que sea aMule quien se encargue de los enlaces ed2k mostrados en su navegador favorito dependerá del propio navegador y del sistema operativo que tenga instalado en su ordenador. Aquí tiene una lista de mini-Comos para cada uno de los navegadores más populares en cada sistema operativo.

Tenga presente que en todo este documento, /ruta/hacia/ed2k se debe reemplazar por /usr/local/bin/ed2k, /usr/bin/ed2k, c:\Program Files\aMule\ed2k.exe o lo que sea, dependiendo configuración propia de su sistema.

Manejo local de enlaces ed2k

GNU/Linux

Como idea general, en muchos sistemas Linux, los aMule's autoinstalables instalan la utilidad ed2k en /usr/local/bin/ed2k, mientras que los aMules empaquetados para su distribución la instalan en /usr/bin/ed2k. Excepcionalmente se sabe que los paquetes para SuSE la instalan en /usr/local/bin/ed2k.

Si ha instalado Debian o Ubuntu debe instalar "amule-utils", y "amule-ed2k" para que esto funcione.

Firefox 2 y 3 (o posteriores)

El manejo de enlaces ED2k en Firefox se puede configurar de dos formas: sólo para el usuario que lo configure, o para todos los usuarios del ordenador.

Configuración para un solo usuario

  • Escriba about:config en la barra de direcciones
  • Pinche en la lista con el botón derecho, elija Nuevo, luego Lógico; escriba network.protocol-handler.external.ed2k como Nombre de Preferencia y true como Valor
  • Pinche de nuevo en la lista con el botón derecho, elija Nuevo, luego Cadena; escriba network.protocol-handler.app.ed2k como Nombre de Preferencia y /ruta/hacia/ed2k (la ruta completa hasta la ubicación en la que se haya instalado ed2k en su ordenador) como Valor.

Además, sólo si utiliza Firefox 3 o superiores, también debería:

  • Pinchar en la lista con el botón derecho, elegir Nuevo, luego Lógico; escribir network.protocol-handler.expose.ed2k como Nombre de Preferencia y false como Valor

Después de esto, pulse sobre un enlace ed2k, y Firefox debería preguntar qué aplicación quiere usar para abrir el enlace. Elija /ruta/hacia/ed2k y ya debería funcionar.

Ed2k-ff3.png

Configuración para todos los usuarios

  • Abra con privilegios de root el archivo /usr/share/firefox/greprefs/all.js (o /usr/local/share/firefox/greprefs/all.js) en un editor de texto.
  • Añada al final del archivo las siguientes líneas:
// ED2K link handling
pref("network.protocol-handler.external.ed2k", true);
pref("network.protocol-handler.app.ed2k", "/path/to/ed2k");

Sustituya la cadena de texto "/path/to/ed2k" por la ruta real del programa.

Además, sólo si utiliza Firefox 3 o superiores, también:

  • Añada una linea más al archivo all.js:
pref("network.protocol-handler.expose.ed2k", false);

Después de guardar los cambios, reinicie el navegador. Al pulsar sobre un enlace ed2k, Firefox debería preguntar qué aplicación quiere usar para abrir el enlace. Elija /usr/local/bin/ed2k y ya debería funcionar.

Opera

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

In the "Protocol" field enter ed2k

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

Ed2k-op.png

Konqueror

To have ed2k links work from Konqueror you have to add a protocol-file to the directory with the other protocol-files. You can find this directory by searching for file names ending with .protocol. To search run `find /usr -name "*.protocol"` or `find /opt -name "*.protocol"`. If you're not sure about the directory where KDE is installed you can even put / as search path.

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 link and tell Konqueror to open it in a new window/tab.

Galeon

Execute the following three commands to create the appropriate gconf keys:

  • gconftool-2 -t string -s /desktop/gnome/url-handlers/ed2k/command "/usr/bin/ed2k \"%s\""
  • gconftool-2 -t bool -s /desktop/gnome/url-handlers/ed2k/enabled true
  • gconftool-2 -t bool -s /desktop/gnome/url-handlers/ed2k/needs_terminal false

Replace "/usr/bin/ed2k" above with the path and name of the ed2k executable on your system.

Uninstalling this protocol handler is similarly simple:

  • gconftool-2 -u /desktop/gnome/url-handlers/ed2k --recursive-unset

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.

Windows

To make Windows aware of the ed2k link protocol we need to add some keys to the registry. Create a file called ed2k.reg and add this code:

REGEDIT4

[HKEY_CLASSES_ROOT\ed2k]
@="URL: ed2k Protocol"
"URL Protocol"=""

[HKEY_CLASSES_ROOT\ed2k\DefaultIcon]
@="C:\\Program Files\\aMule\\amulegui.exe"

[HKEY_CLASSES_ROOT\ed2k\shell]
@="open"

[HKEY_CLASSES_ROOT\ed2k\shell\open]

[HKEY_CLASSES_ROOT\ed2k\shell\open\command]
@="\"C:\\Program Files\\aMule\\ed2k \"%1\""

Save the file and run it (double click) to add these keys to the registry.

Internet Explorer

Internet Explorer will recognize ed2k links with just the changes in the registry.

Mac OS X

Adapted from Ken's post in the forum.

  1. Run aMule at least once
  2. Run Safari (even if you normally use Firefox or another browser)
  3. Browse to a page with an ed2k link that you want to download
  4. Drag the link to the location field at the top of the window
  5. The OS will present a dialog asking if you want to allow a program to run to handle the link. Allow it.

Now, the program that helps aMule handle ed2k links is known to the system.

Safari

If you use Safari, you will have to drag the link to the location field every time. For unclear reasons, Safari will not process ed2k (or other non-Apple protocol) links if you click on them.

Firefox

If you use Firefox, clicking on an ed2k link will work. The first time, for security purposes, Firefox will present a dialog asking if you want to allow the helper program to run. (Yes, even though the OS already asked you the same question.) After that, it will work just as you would expect.

Remote handling of ed2k links

You can also handle links remotely, which means that you click over an ed2k link in a browser somewhere in the world and it gets into your home's aMule queue. It works by using aMuleCMD instead of using the ed2k command.

Linux

Instead of using the ed2k command, use the following as the command to use:

/path/to/amulecmd -h $server -P $pw -c "Add %u"

Obviously, you'll have to replace $server and $pw with your server's IP (or DNS) and your External Connections password.

NOTE: In Firefox, it is not possible to start a command with parameters. An easy solution is a shell script with the command described above. You only have to replace %u with $1. This shell script must be executable (chmod +x ed2k.sh) and defined as external ed2k app in Firefox.

Windows

Make sure aMule is installed with the aMuleCMD option checked.

We need a batch script to handle the ed2k links from the browser, and we need to add some keys to the registry to make the browser recognize the ed2k links.

Create a file named ed2k_remote.bat containing the following code:

@echo off
set link=%1
for /f "useback tokens=*" %%a in ('%link%') do set link=%%~a
"c:\Program Files\aMule\amulecmd.exe" /h server /P pass /c "add %link%"

Don't forget to replace server and pass with your data and save the file in your aMule directory C:\Program Files\aMule.

Create a file named ed2k_remote.reg containing the following code:

REGEDIT4

[HKEY_CLASSES_ROOT\ed2k]
@="URL: ed2k Protocol"
"URL Protocol"=""

[HKEY_CLASSES_ROOT\ed2k\DefaultIcon]
@="C:\\Program Files\\aMule\\amulegui.exe"

[HKEY_CLASSES_ROOT\ed2k\shell]
@="open"

[HKEY_CLASSES_ROOT\ed2k\shell\open]

[HKEY_CLASSES_ROOT\ed2k\shell\open\command]
@="\"C:\\Program Files\\aMule\\ed2k_remote.bat\" \"%1\""

Save the file and run it (double click) to add these keys to the registry.

Internet Explorer

You should be OK with just the changes to the registry and the batch script in your aMule directory.

Firefox

The first time you click an ed2k link in Firefox you will get the following dialog:

Firefox ed2k link.PNG

Tick the Remember box and click OK.

Opera

Open the preferences window and click the Programs tab

Opera preferences programs.PNG

Click the Add... button

Make Opera aware of the ed2k link protocol with these settings:

Opera protocols ed2k.PNG