Remove the default value of follow parameter in `updateStatus`.

`false` is a pretty bad default value as most user want to track
the real download.

By removing the default value, we force user to make a choice.
We could have change the default value to true but it would have been
a silent API change and we don't want that.
This commit is contained in:
Matthieu Gautier 2023-02-07 11:25:34 +01:00
parent f239f2de18
commit 2c3b7409aa
2 changed files with 8 additions and 7 deletions

View File

@ -71,14 +71,15 @@ class Download {
* - A first one to download the metadlink. * - A first one to download the metadlink.
* - A second one to download the real file. * - A second one to download the real file.
* *
* By default, `Download` track only the first download. So status may appear * If `follow` is true, updateStatus tries to detect that and tracks
* as COMPLETE even if the real file downloading is still running. * the second download when the first one is finished.
* By passing true to follow, `Dowload` will detect that and will track the * By passing false to `follow`, `Download` will only track the first download.
* second download instead.
* *
* `getFoo` methods are based on the last statusUpdate. * `getFoo` methods are based on the last statusUpdate.
*
* @param follow: Do we have to follow following downloads.
*/ */
void updateStatus(bool follow=false); void updateStatus(bool follow);
/** /**
* Pause the download (and call updateStatus) * Pause the download (and call updateStatus)

View File

@ -130,7 +130,7 @@ Downloader::Downloader() :
try { try {
for (auto gid : mp_aria->tellActive()) { for (auto gid : mp_aria->tellActive()) {
m_knownDownloads[gid] = std::unique_ptr<Download>(new Download(mp_aria, gid)); m_knownDownloads[gid] = std::unique_ptr<Download>(new Download(mp_aria, gid));
m_knownDownloads[gid]->updateStatus(); m_knownDownloads[gid]->updateStatus(false);
} }
} catch (std::exception& e) { } catch (std::exception& e) {
std::cerr << "aria2 tellActive failed : " << e.what() << std::endl; std::cerr << "aria2 tellActive failed : " << e.what() << std::endl;
@ -138,7 +138,7 @@ Downloader::Downloader() :
try { try {
for (auto gid : mp_aria->tellWaiting()) { for (auto gid : mp_aria->tellWaiting()) {
m_knownDownloads[gid] = std::unique_ptr<Download>(new Download(mp_aria, gid)); m_knownDownloads[gid] = std::unique_ptr<Download>(new Download(mp_aria, gid));
m_knownDownloads[gid]->updateStatus(); m_knownDownloads[gid]->updateStatus(false);
} }
} catch (std::exception& e) { } catch (std::exception& e) {
std::cerr << "aria2 tellWaiting failed : " << e.what() << std::endl; std::cerr << "aria2 tellWaiting failed : " << e.what() << std::endl;