mirror of https://github.com/kiwix/libkiwix.git
wip
This commit is contained in:
parent
3ab3ffe3ea
commit
6b04eb3214
|
@ -88,7 +88,7 @@ class Download {
|
||||||
class Downloader
|
class Downloader
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
Downloader();
|
Downloader(std::string sessionFileDir = "");
|
||||||
virtual ~Downloader();
|
virtual ~Downloader();
|
||||||
|
|
||||||
void close();
|
void close();
|
||||||
|
|
|
@ -18,6 +18,7 @@ class KiwixServe
|
||||||
bool isRunning();
|
bool isRunning();
|
||||||
int getPort() { return m_port; }
|
int getPort() { return m_port; }
|
||||||
int setPort(int port);
|
int setPort(int port);
|
||||||
|
void setLibraryPath(std::string path) { m_libraryPath = path; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::unique_ptr<Subprocess> mp_kiwixServe;
|
std::unique_ptr<Subprocess> mp_kiwixServe;
|
||||||
|
|
|
@ -22,7 +22,7 @@
|
||||||
|
|
||||||
namespace kiwix {
|
namespace kiwix {
|
||||||
|
|
||||||
Aria2::Aria2():
|
Aria2::Aria2(std::string sessionFileDir):
|
||||||
mp_aria(nullptr),
|
mp_aria(nullptr),
|
||||||
m_port(42042),
|
m_port(42042),
|
||||||
m_secret("kiwixariarpc"),
|
m_secret("kiwixariarpc"),
|
||||||
|
@ -35,7 +35,12 @@ Aria2::Aria2():
|
||||||
|
|
||||||
std::string rpc_port = "--rpc-listen-port=" + to_string(m_port);
|
std::string rpc_port = "--rpc-listen-port=" + to_string(m_port);
|
||||||
std::string download_dir = "--dir=" + getDataDirectory();
|
std::string download_dir = "--dir=" + getDataDirectory();
|
||||||
std::string session_file = appendToDirectory(getDataDirectory(), "kiwix.session");
|
std::string session_file;
|
||||||
|
if (sessionFileDir.empty()) {
|
||||||
|
session_file = appendToDirectory(getDataDirectory(), "kiwix.session");
|
||||||
|
} else {
|
||||||
|
session_file = appendToDirectory(sessionFileDir, "kiwix.session");
|
||||||
|
}
|
||||||
std::string session = "--save-session=" + session_file;
|
std::string session = "--save-session=" + session_file;
|
||||||
std::string inputFile = "--input-file=" + session_file;
|
std::string inputFile = "--input-file=" + session_file;
|
||||||
// std::string log_dir = "--log=\"" + logDir + "\"";
|
// std::string log_dir = "--log=\"" + logDir + "\"";
|
||||||
|
|
|
@ -30,7 +30,7 @@ class Aria2
|
||||||
std::string doRequest(const MethodCall& methodCall);
|
std::string doRequest(const MethodCall& methodCall);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
Aria2();
|
Aria2(std::string sessionFileDir = "");
|
||||||
virtual ~Aria2();
|
virtual ~Aria2();
|
||||||
void close();
|
void close();
|
||||||
|
|
||||||
|
|
|
@ -124,8 +124,8 @@ void Download::cancelDownload()
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Constructor */
|
/* Constructor */
|
||||||
Downloader::Downloader() :
|
Downloader::Downloader(std::string sessionFileDir) :
|
||||||
mp_aria(new Aria2())
|
mp_aria(new Aria2(sessionFileDir))
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
for (auto gid : mp_aria->tellActive()) {
|
for (auto gid : mp_aria->tellActive()) {
|
||||||
|
|
Loading…
Reference in New Issue