mirror of https://github.com/kiwix/libkiwix.git
add get aria2 launch cmd method
This commit is contained in:
parent
9850be7267
commit
20a2c78733
|
@ -97,6 +97,7 @@ class Downloader
|
|||
|
||||
size_t getNbDownload() { return m_knownDownloads.size(); }
|
||||
std::vector<std::string> getDownloadIds();
|
||||
const std::string &getAria2LaunchCmd();
|
||||
|
||||
private:
|
||||
std::map<std::string, std::unique_ptr<Download>> m_knownDownloads;
|
||||
|
|
|
@ -78,6 +78,9 @@ Aria2::Aria2():
|
|||
callCmd.push_back("--max-concurrent-downloads=42");
|
||||
callCmd.push_back("--rpc-max-request-size=6M");
|
||||
callCmd.push_back("--file-allocation=none");
|
||||
for (auto &cmd : callCmd) {
|
||||
m_launchCmd.append(cmd).append(" ");
|
||||
}
|
||||
mp_aria = Subprocess::run(callCmd);
|
||||
mp_curl = curl_easy_init();
|
||||
char errbuf[CURL_ERROR_SIZE];
|
||||
|
|
|
@ -26,6 +26,7 @@ class Aria2
|
|||
std::string m_downloadDir;
|
||||
CURL* mp_curl;
|
||||
pthread_mutex_t m_lock;
|
||||
std::string m_launchCmd;
|
||||
|
||||
std::string doRequest(const MethodCall& methodCall);
|
||||
|
||||
|
@ -43,6 +44,7 @@ class Aria2
|
|||
void pause(const std::string& gid);
|
||||
void unpause(const std::string& gid);
|
||||
void remove(const std::string& gid);
|
||||
const std::string &getLaunchCmd() { return m_launchCmd; };
|
||||
};
|
||||
|
||||
}; //end namespace kiwix
|
||||
|
|
|
@ -163,6 +163,11 @@ std::vector<std::string> Downloader::getDownloadIds() {
|
|||
return ret;
|
||||
}
|
||||
|
||||
const std::string &Downloader::getAria2LaunchCmd()
|
||||
{
|
||||
return mp_aria->getLaunchCmd();
|
||||
}
|
||||
|
||||
Download* Downloader::startDownload(const std::string& uri)
|
||||
{
|
||||
for (auto& p: m_knownDownloads) {
|
||||
|
|
Loading…
Reference in New Issue