I'm working on a nicer progress bar for it, but I observe a weird behavior with libcurl. When file is fully downloaded and it's resuming and int progress_callback(void *clientp, double dltotal, double dlnow, double ultotal, double ulnow) is called, I always get dltotal as 389.0 and dlnow as 0.0. What is this 389.0 about? I expect them both to be 0.0 at that point. You can add some basic debug output to observe that (when it downloads straight - it's OK, but when resuming a fully downloaded file - things go weird). What do you think it is?
UPDATE: Created a patch: http://pastie.org/6077909
* Switched the rate from calculating it manually to simply getting it from curl_easy_getinfo. Curl happens already to calculate rate by itself.
* Introduced Unicode progress bar. Most terminals used these days support Unicode so it makes sense to make it a default. --no-unicode option allows switching ASCII style simple progress bar back.
* Moved the config to shared_ptr in order to pass it around (callback needs it).
* Had to use a workaround to detect the case of (dlnow == 0.0) && (dltotal == 389.0) otherwise the progress bar will be missing the very last small part. I'm not sure - may be it's specific to my version of curl, you can switch on the debug line mentioned there and see if this bug surfaces for you or not.
Note: found a bug in case of downloading covers - files aren't resumed even if they were downloaded only partially (didn't fix that).
just fyi a couple of unimportant cosmetic things regarding the progress bar, while testing just now and getting the download of my most recent purchase i see that every now and then the progress bar looks like this:
99% [==========================] 0.04/0.04MB @ -nankB/s
instead of saying 100% at the beginning, however this is for files already downloaded so it ought really be 100% :)
This can be the same bug that I encountered with dltotal being 389.0. See above.