diff --git a/main.cpp b/main.cpp index 5a903f9..af07624 100644 --- a/main.cpp +++ b/main.cpp @@ -85,7 +85,7 @@ int main(int argc, char *argv[]) ("repair", bpo::value(&config.bRepair)->zero_tokens()->default_value(false), "Repair downloaded files\nUse --repair --download to redownload files when filesizes don't match (possibly different version). Redownload will delete the old file") ("game", bpo::value(&config.sGameRegex)->default_value(""), "Set regular expression filter\nfor download/list/repair (Perl syntax)\nAliases: \"all\", \"free\"") ("directory", bpo::value(&config.sDirectory)->default_value(""), "Set download directory") - #ifndef ENVIRONMENT32 + #ifdef ENVIRONMENT64 ("limit-rate", bpo::value(&config.iDownloadRate)->default_value(0), "Limit download rate to value in kB\n0 = unlimited") #endif ("create-xml", bpo::value(&config.sXMLFile)->default_value(""), "Create GOG XML for file\n\"automatic\" to enable automatic XML creation") diff --git a/src/api.cpp b/src/api.cpp index 87369c9..69f2656 100644 --- a/src/api.cpp +++ b/src/api.cpp @@ -372,13 +372,6 @@ std::string API::getInstallerLink(const std::string& game_name, const std::strin Json::Reader *jsonparser = new Json::Reader; if (jsonparser->parse(json, root)) { - /* - std::string result = root["result"].asString(); - int timestamp = root["timestamp"].asInt(); - int available = root["file"]["available"].asInt(); - std::string link = root["file"]["link"].asString(); - std::string message = root["file"]["message"].asString(); - */ #ifdef DEBUG std::cerr << "DEBUG INFO (API::getInstallerLink)" << std::endl << root << std::endl; #endif @@ -417,15 +410,6 @@ std::string API::getExtraLink(const std::string& game_name, const std::string& i Json::Reader *jsonparser = new Json::Reader; if (jsonparser->parse(json, root)) { - /* - std::string result = root["result"].asString(); - int timestamp = root["timestamp"].asInt(); - int available = root["file"]["available"].asInt(); - std::string link = root["file"]["link"].asString(); - std::string type = root["file"]["type"].asString(); - std::string name = root["file"]["name"].asString(); - std::string message = root["file"]["message"].asString(); - */ #ifdef DEBUG std::cerr << "DEBUG INFO (API::getExtraLink)" << std::endl << root << std::endl; #endif @@ -465,13 +449,6 @@ std::string API::getXML(const std::string& game_name, const std::string& id) Json::Reader *jsonparser = new Json::Reader; if (jsonparser->parse(json, root)) { - /* - std::string result = root["result"].asString(); - int timestamp = root["timestamp"].asInt(); - int available = root["file"]["available"].asInt(); - std::string link = root["file"]["link"].asString(); - std::string message = root["file"]["message"].asString(); - */ #ifdef DEBUG std::cerr << "DEBUG INFO (API::getXML)" << std::endl << root << std::endl; #endif diff --git a/src/downloader.cpp b/src/downloader.cpp index ca7fdb8..7ede4f0 100644 --- a/src/downloader.cpp +++ b/src/downloader.cpp @@ -49,7 +49,6 @@ int Downloader::init() curl_global_init(CURL_GLOBAL_ALL); curlhandle = curl_easy_init(); - curl_easy_setopt(curlhandle, CURLOPT_VERBOSE, 0); curl_easy_setopt(curlhandle, CURLOPT_FOLLOWLOCATION, 1); curl_easy_setopt(curlhandle, CURLOPT_USERAGENT, config.sVersionString.c_str()); curl_easy_setopt(curlhandle, CURLOPT_NOPROGRESS, 0); @@ -59,9 +58,10 @@ int Downloader::init() curl_easy_setopt(curlhandle, CURLOPT_COOKIEFILE, config.sCookiePath.c_str()); curl_easy_setopt(curlhandle, CURLOPT_COOKIEJAR, config.sCookiePath.c_str()); curl_easy_setopt(curlhandle, CURLOPT_SSL_VERIFYPEER, config.bVerifyPeer); - - if (config.bVerbose) - curl_easy_setopt(curlhandle, CURLOPT_VERBOSE, 1); + curl_easy_setopt(curlhandle, CURLOPT_VERBOSE, config.bVerbose); + #ifdef ENVIRONMENT64 + curl_easy_setopt(curlhandle, CURLOPT_MAX_RECV_SPEED_LARGE, config.iDownloadRate); + #endif gogAPI = new API(config.sToken, config.sSecret, config.bVerbose, config.bVerifyPeer); progressbar = new ProgressBar(!config.bNoUnicode, !config.bNoColor); @@ -313,12 +313,8 @@ void Downloader::repair() curl_easy_setopt(curlhandle, CURLOPT_FOLLOWLOCATION, 1); curl_easy_setopt(curlhandle, CURLOPT_WRITEFUNCTION, Downloader::writeData); curl_easy_setopt(curlhandle, CURLOPT_READFUNCTION, Downloader::readData); - curl_easy_setopt(curlhandle, CURLOPT_SSL_VERIFYPEER, config.bVerifyPeer); curl_easy_setopt(curlhandle, CURLOPT_NOPROGRESS, 0); curl_easy_setopt(curlhandle, CURLOPT_PROGRESSFUNCTION, Downloader::progressCallback); - #ifndef ENVIRONMENT32 - curl_easy_setopt(curlhandle, CURLOPT_MAX_RECV_SPEED_LARGE, config.iDownloadRate); - #endif for (unsigned int i = 0; i < games.size(); ++i) { @@ -386,21 +382,14 @@ void Downloader::download() curl_easy_setopt(curlhandle, CURLOPT_FOLLOWLOCATION, 1); curl_easy_setopt(curlhandle, CURLOPT_WRITEFUNCTION, Downloader::writeData); curl_easy_setopt(curlhandle, CURLOPT_READFUNCTION, Downloader::readData); - curl_easy_setopt(curlhandle, CURLOPT_SSL_VERIFYPEER, config.bVerifyPeer); curl_easy_setopt(curlhandle, CURLOPT_NOPROGRESS, 0); curl_easy_setopt(curlhandle, CURLOPT_PROGRESSFUNCTION, Downloader::progressCallback); - #ifndef ENVIRONMENT32 - curl_easy_setopt(curlhandle, CURLOPT_MAX_RECV_SPEED_LARGE, config.iDownloadRate); - #endif for (unsigned int i = 0; i < games.size(); ++i) { // Download covers if (!config.bNoCover && !config.bUpdateCheck) { - // Doesn't work as intended unless we use "games[i].gamename" as base directory for installers and extras - // std::string directory = config.sDirectory + games[i].gamename + "/"; - // Take path from installer path because for some games the base directory for installer/extra path is not "gamename" std::string filepath = Util::makeFilepath(config.sDirectory, games[i].installers[0].path, games[i].gamename);