mirror of
https://github.com/Sude-/lgogdownloader.git
synced 2025-02-02 05:52:31 +01:00
Merge branch 'exit-status' of https://github.com/chewi/lgogdownloader
This commit is contained in:
commit
0dfa610c28
@ -65,14 +65,14 @@ class Downloader
|
|||||||
virtual ~Downloader();
|
virtual ~Downloader();
|
||||||
int init();
|
int init();
|
||||||
int login();
|
int login();
|
||||||
void listGames();
|
int listGames();
|
||||||
void updateCheck();
|
void updateCheck();
|
||||||
void repair();
|
void repair();
|
||||||
void download();
|
void download();
|
||||||
void checkOrphans();
|
void checkOrphans();
|
||||||
void checkStatus();
|
void checkStatus();
|
||||||
void updateCache();
|
void updateCache();
|
||||||
void downloadFileWithId(const std::string& fileid_string, const std::string& output_filepath);
|
int downloadFileWithId(const std::string& fileid_string, const std::string& output_filepath);
|
||||||
void showWishlist();
|
void showWishlist();
|
||||||
CURL* curlhandle;
|
CURL* curlhandle;
|
||||||
Timer timer;
|
Timer timer;
|
||||||
|
9
main.cpp
9
main.cpp
@ -556,6 +556,9 @@ int main(int argc, char *argv[])
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int res = 0;
|
||||||
|
|
||||||
if (config.bShowWishlist)
|
if (config.bShowWishlist)
|
||||||
downloader.showWishlist();
|
downloader.showWishlist();
|
||||||
else if (config.bUpdateCache)
|
else if (config.bUpdateCache)
|
||||||
@ -566,7 +569,7 @@ int main(int argc, char *argv[])
|
|||||||
{
|
{
|
||||||
for (std::vector<std::string>::iterator it = vFileIdStrings.begin(); it != vFileIdStrings.end(); it++)
|
for (std::vector<std::string>::iterator it = vFileIdStrings.begin(); it != vFileIdStrings.end(); it++)
|
||||||
{
|
{
|
||||||
downloader.downloadFileWithId(*it, config.sOutputFilename);
|
res |= downloader.downloadFileWithId(*it, config.sOutputFilename) ? 1 : 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (config.bRepair) // Repair file
|
else if (config.bRepair) // Repair file
|
||||||
@ -574,7 +577,7 @@ int main(int argc, char *argv[])
|
|||||||
else if (config.bDownload) // Download games
|
else if (config.bDownload) // Download games
|
||||||
downloader.download();
|
downloader.download();
|
||||||
else if (config.bListDetails || config.bList) // Detailed list of games/extras
|
else if (config.bListDetails || config.bList) // Detailed list of games/extras
|
||||||
downloader.listGames();
|
res = downloader.listGames();
|
||||||
else if (!config.sOrphanRegex.empty()) // Check for orphaned files if regex for orphans is set
|
else if (!config.sOrphanRegex.empty()) // Check for orphaned files if regex for orphans is set
|
||||||
downloader.checkOrphans();
|
downloader.checkOrphans();
|
||||||
else if (config.bCheckStatus)
|
else if (config.bCheckStatus)
|
||||||
@ -593,5 +596,5 @@ int main(int argc, char *argv[])
|
|||||||
if (!config.sOrphanRegex.empty() && config.bDownload)
|
if (!config.sOrphanRegex.empty() && config.bDownload)
|
||||||
downloader.checkOrphans();
|
downloader.checkOrphans();
|
||||||
|
|
||||||
return 0;
|
return res;
|
||||||
}
|
}
|
||||||
|
@ -496,12 +496,15 @@ int Downloader::getGameDetails()
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Downloader::listGames()
|
int Downloader::listGames()
|
||||||
{
|
{
|
||||||
if (config.bListDetails) // Detailed list
|
if (config.bListDetails) // Detailed list
|
||||||
{
|
{
|
||||||
if (this->games.empty())
|
if (this->games.empty()) {
|
||||||
this->getGameDetails();
|
int res = this->getGameDetails();
|
||||||
|
if (res > 0)
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
for (unsigned int i = 0; i < games.size(); ++i)
|
for (unsigned int i = 0; i < games.size(); ++i)
|
||||||
{
|
{
|
||||||
@ -697,6 +700,7 @@ void Downloader::listGames()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Downloader::repair()
|
void Downloader::repair()
|
||||||
@ -2791,8 +2795,9 @@ void Downloader::saveChangelog(const std::string& changelog, const std::string&
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Downloader::downloadFileWithId(const std::string& fileid_string, const std::string& output_filepath)
|
int Downloader::downloadFileWithId(const std::string& fileid_string, const std::string& output_filepath)
|
||||||
{
|
{
|
||||||
|
int res = 1;
|
||||||
size_t pos = fileid_string.find("/");
|
size_t pos = fileid_string.find("/");
|
||||||
if (pos == std::string::npos)
|
if (pos == std::string::npos)
|
||||||
{
|
{
|
||||||
@ -2826,7 +2831,7 @@ void Downloader::downloadFileWithId(const std::string& fileid_string, const std:
|
|||||||
else
|
else
|
||||||
filepath = output_filepath;
|
filepath = output_filepath;
|
||||||
std::cout << "Downloading: " << filepath << std::endl;
|
std::cout << "Downloading: " << filepath << std::endl;
|
||||||
this->downloadFile(url, filepath, std::string(), gamename);
|
res = this->downloadFile(url, filepath, std::string(), gamename);
|
||||||
std::cout << std::endl;
|
std::cout << std::endl;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -2836,7 +2841,7 @@ void Downloader::downloadFileWithId(const std::string& fileid_string, const std:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Downloader::showWishlist()
|
void Downloader::showWishlist()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user