aMule and Mozilla Seamonkey/Firefox: the final battle

Hi openSuSE gurus, after several weeks I’ve finally managed to get aMule to listen external calls from Mozilla browsers.

To make it quick:
In Seamonkey or FF do about:config and add

Key: network.protocol-handler.external.ed2k
Tyoe: boolean
Value: true

Key: network.protocol-handler.expose.ed2k
Type: boolean
Value: false

Key: network.protocol-handler.app.ed2k
Type: string
Value: ~/aMuleLinks.sh

Where aMuleLinks.sh is a script with the following:


#!/bin/bash

amuleserver=127.0.0.1
password=somePass

amulecmd --host=$amuleserver --port=4712 --password=$password --command='Add '$1

And in amule.conf under ~/.aMule directory you must change:

[ExternalConnect]
AcceptExternalConnections=1
ECPassword=4c882dcb24bcb1bc225391a602feca7c 

Where ‘4c882dcb24bcb1bc225391a602feca7c’ is the result of using this command

echo -n somePass | md5sum | cut -d ' ' -f 1

The problem is that when aMule is not running I want to automatiaclly open it. I managed to get a script for doing that but it won’t work,


#!/bin/bash

amuleserver=127.0.0.1
password=fender

if  -z "$(pgrep amule)" ];
  then
    amule
    sleep 5
    amulecmd --host=$amuleserver --port=4712 --password=$password --command='Add '$1
  else
    amulecmd --host=$amuleserver --port=4712 --password=$password --command='Add '$1
fi

The idea is to open aMule and then send the command to amulecmd but amulecmd never gets the command. If aMule is already running everything works fine.

Any help will be much appreciated, TIA.

Pancho

Sorry for the double post but since I can’t edit my post due to the 10 minutes edit limit this will be short.


#!/bin/bash

amuleserver=127.0.0.1
password=fender

if  -z "$(pgrep amule)" ];
  then
    amule &
    sleep 5
    amulecmd --host=$amuleserver --port=4712 --password=$password --command='Add '$1
  else
    amulecmd --host=$amuleserver --port=4712 --password=$password --command='Add '$1
fi

The trailing ‘&’ is the key to solve the problem. amulecmd was waiting for aMule to finish to pass the command to aMule but when aMule was closed this couldn’t be donde. So with the trailing ‘&’ aMule and amulecmd run together.

Thanks and hope this helps someone,

Pancho

Hi, Pancho,

I use your script on openSuse and it works perfectly.

It also works on other distributions as well. I published it on a French forum and we just thank you.

MLO - Mandriva Linux Online : Sujet - Liens Ed2k et Firefox

Glad it helped :slight_smile:

Pancho