aMule Forum

Please login or register.

Login with username, password and session length
Advanced search  

News:

We're back! (IN POG FORM)

Author Topic: aMuleCmd patch  (Read 3314 times)

eq

  • Newbie
  • Karma: 0
  • Offline Offline
  • Posts: 2
aMuleCmd patch
« on: October 15, 2010, 02:22:03 PM »

Hi all!

I'm trying to do some automatic tasks using aMuleCmd, but I've ran into trouble.

I'm using the -c switch to run commands from a script, i.e aMuleCmd -c "search global cool stuff".
This works, but downloading a file doesn't.

I've read on the forum that you need to get the results before a download command and that there is no "session" information between two runs of the exe (fair enough).

The recommended  "fix" for this is to use a file with a list of commands and then redirect the input from that file, i.e:
results
download 1
exit

However, this doesn't seem to work on Windows (XP but it shouldn't matter), i.e:

aMuleCmd < Input.txt

The exe reads the "results" command and executes that correctly, but then it repeatable executes the same command for ever.
This is true even with a single command.

I've also tried:
type Input.txt | aMuleCmd

This is odd since other applications handles this correctly.

First it should be quite simple to add some logic to the download command so that if no results have been requested before the command, it then issues a results command first and then continue with the download, i.e:

static bool gotResults = false;

if (command == "results"){
  getResults();
  gotResults = true;
}
if (command == "download"){
  if (!gotResults){
    getResults();
    gotResults = true;
 }
 startDownload();
}


Secondly, it sure would be nice to have the redirection issue solves so that you could build a list of commands to execute.

To avoid platform issues with the above one could add an option (-cf, --command-file whatever) that reads a set of instruction from a text file and executes them in order.

The process I'm trying to automate doesn't justify the time it would take me to get the project compiling and adding these fixes myself, I was rather hoping that someone that does daily work on this would be kind enough to add any of these fixes.

Thanks in advance!

Cheers,
Eq








« Last Edit: October 15, 2010, 02:30:17 PM by eq »
Logged

Stu Redman

  • Administrator
  • Hero Member
  • *****
  • Karma: 214
  • Offline Offline
  • Posts: 3739
  • Engines screaming
Re: aMuleCmd patch
« Reply #1 on: October 15, 2010, 09:33:52 PM »

I've fixed the little bug in the command processing and attached a 2.2.6 Windows exe for you (that's what you're using?).
But why would you want to download the first search result from a batch? Downloading search results without review makes no sense to me.
Logged
The image of mother goddess, lying dormant in the eyes of the dead, the sheaf of the corn is broken, end the harvest, throw the dead on the pyre -- Iron Maiden, Isle of Avalon

eq

  • Newbie
  • Karma: 0
  • Offline Offline
  • Posts: 2
Re: aMuleCmd patch
« Reply #2 on: October 18, 2010, 12:33:21 PM »

Thank you very much!

Now it works as expected!

I agree that downloading the first match doesn't make much sense, but that's no really what I'm doing.
From another script (actually program), I do a search and fetch the results.
Then I do some additional logic to select the file I wish to download, if I found a file that makes sense to me I will download that file (this is what didn't work).
Now I just write "results\ndownload XXX\nexit\n" to the stdin stream and it works!

Cheers,
Eq
Logged