Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature Request]: Select external downloader (aria2 and e.t.c) #295

Open
Danik2343 opened this issue Aug 1, 2023 · 1 comment
Open
Labels
enhancement New feature or request

Comments

@Danik2343
Copy link

[Feature Request]: Select external downloader (aria2 and e.t.c)

@bkw777
Copy link
Owner

bkw777 commented Aug 2, 2023

This is not as simple as the sudo or xterm options.
The download command isn't simply run, it's highly integrated.

The .deb files are downloaded in batch by writing a special aria2c syntax job file format to stdin, and parsing the stdout to monitor progress while working.

To support a different downloader, you would need to write a whole different "driver" for that downloader, essentially a replacement DownloadManager.vala (also other parts would need to be decoupled a little to make it so all the special bits are inside DownloadManager, to allow drop-in replacement of some other DownloadManager, but that's not a problem)

Never the less I've always wanted this to be configurable too.

I think I should do 2 things.
1 - Make AsyncTask more generic and clean up the seperation so that everything special to aria2c is all just inside DownloadManager, and then it would be possible to have other versions of DownloadManager that drop in without having to change anything else. I've been planning to do that to make a version that uses libcurl instead of an external executable.

2 - That would be nice just on principle but in addition to that it would be useful to have an option like the xterm option where there is both internal and external options, where even if the internal option is all integrated, the external options are simpler where they DO just run the command with only a simple string substitution for the url and filename etc. This method of operating would be less efficient since it would have to run the command once per individual file, and it's a lot of files. But that's ok as long as the good reference method is still always available built-in.

There is still a bit of a problem with special settings like proxy. Each different downloader would have it's own different way of doing that. I guess that will have to be handled by supplying more special tokens similar to printf format specifiers, like instead of %s for string, maybe %u for url and %p for proxy, etc, or maybe do them as environment variables like ${URL} , ${PROXY}, etc.

Hm, I guess we could even still support batch mode by having a variable for a url list. At run-time, we decide whether to run a loop if single-file downloads or a single batch download by just looking at the configured command to see which it has ${URL} or ${URLLIST} in it.

The checksums would be a little more work. Righ now it hands the checksums to aria2c, and aria2c is what checks the checksums. With any other command, we'd have to do our own checksum verification.

Similarly we'd have to provide progress monitoring by repeatedly statting the partial download file instead of reading the progress from the command output, or we just accept the progress being messier by just dumping the commands progress output to stdout instead of generating our own progress bar.

I guess I've just convinced myself it's doable.

@bkw777 bkw777 added the enhancement New feature or request label Aug 2, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants