My script is done. It is in 2 parts in the same file. I call it ed2kmanage.
ed2kmanage "<ed2k link>" manage the ed2k links.
ed2kmanage -m manage the the files that ed2k will download.
It need sed, cut, xdialog and perl. To install it, just put it in your path and go to about:config into firefox. Search for ed2k and change the string from "ed2k" to "ed2kmanage".
When clicking on an ed2klink, the script will get the link, ask for a directory to move the file after the donload and if you want to make a symlink in amule share directory. The link will be send to ed2k for download.
If the file is already in download or in incoming, nothinj will be done. If the file has already been downloaded, but have been already moved or erased, the script will ask if you want to download it again. If yes, the same actions that with a new file will be done.
Be aware that, in order to know the state of a file, the script manage 3 files and doesn't know nothing of what ed2k is doing. So, it will not work with old files or with files found in the search tab of amule. For those files, you have to open a console, copy the link from amule and run "ed2kmanage <ed2k link>" by hand.
I guess that those 3 files can be useful if you want to manage your files with a database.
When you want to move the downloaded files, just open a console and run: ed2kmanage -m
The downloaded files will be moved to their wanted locations and the symlinks will be created. You will get an output into the console for each moved file and its location.
That's all!
The script is join with this message.
It work for me. I tested it with all kinds of characters, europeans, chineses, double consecutive spaces,...
I get no problem with firefox.
But sometime in the consiƓle, I get a wrong result when running it from the console. The same ed2k link was just working from firefox. I think that this is a problem specific to my system, but I am not 100% sure of this. It is a comment about this in the script (download() function). If someone can look at it and tell me what to do, it will be very kind.