pawamoy / aria2p

Command-line tool and library to interact with an aria2c daemon process with JSON-RPC.
https://pawamoy.github.io/aria2p
ISC License
479 stars 93 forks source link

Documentation Clarification #121

Closed trestlesky closed 1 year ago

trestlesky commented 1 year ago

Apologies for being such a dolt on this, but I'm having a really hard time understanding the documentation for usage inside of python. I have a set a scripts that run daily to download files. What I would like to do is add a script that runs daily that accomplishes the following:

1) removes ONLY successful downloads, leaving any errored out ones so I can correct later. 2) after removing successful downloads, count or output the errored ones so I can trigger an alert (which I'm doing with PushBullet) or just review the output file later.

So far, it seems that the "purge" option also removes the errored ones, which I don't want to happen automatically. Also, the "tell" command looks like it's only for "stopped, active, and waiting" but not for "error". I'm guess that's stopped, but I just wanted to get some clarification. Any help I can get to accomplish the above goals would be great, sorry again for my incompetence.

pawamoy commented 1 year ago

No apologies needed! I never got to actually write any documentation for this package, so I understand the difficulty 😅

We do provide the code reference though, and I believe that's enough for most users since I don't get so many complaints/requests/questions.

So, about your goal. I believe you can simply use the aria2p.API.get_downloads() method to get all the downloads, and then iterate on them to either purge or count/report them. For this, checkout the fields of the aria2p.Download class, particularly has_failed, is_active, is_complete, and purge()/remove().

Let me know if that's enough to unblock you 🙂

trestlesky commented 1 year ago

That was way easier than I expected, thanks for the clarification!