mirror of
https://github.com/Sude-/lgogdownloader.git
synced 2024-11-20 11:49:17 +01:00
Add support for DLC language packs
This commit is contained in:
parent
4f5300be75
commit
ff2264763e
@ -650,6 +650,22 @@ void Downloader::listGames()
|
||||
<< "\tsize: " << games[i].dlcs[j].extras[k].size << std::endl
|
||||
<< std::endl;
|
||||
}
|
||||
for (unsigned int k = 0; k < games[i].dlcs[j].languagepacks.size(); ++k)
|
||||
{
|
||||
std::string filepath = games[i].dlcs[j].languagepacks[k].getFilepath();
|
||||
if (config.blacklist.isBlacklisted(filepath)) {
|
||||
if (config.bVerbose)
|
||||
std::cerr << "skipped blacklisted file " << filepath << std::endl;
|
||||
continue;
|
||||
}
|
||||
|
||||
std::cout << "\tgamename: " << games[i].dlcs[j].gamename << std::endl
|
||||
<< "\tid: " << games[i].dlcs[j].languagepacks[k].id << std::endl
|
||||
<< "\tname: " << games[i].dlcs[j].languagepacks[k].name << std::endl
|
||||
<< "\tpath: " << games[i].dlcs[j].languagepacks[k].path << std::endl
|
||||
<< "\tsize: " << games[i].dlcs[j].languagepacks[k].size << std::endl
|
||||
<< std::endl;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -910,6 +926,41 @@ void Downloader::repair()
|
||||
std::cout << std::endl;
|
||||
}
|
||||
}
|
||||
if (config.bLanguagePacks)
|
||||
{
|
||||
for (unsigned int k = 0; k < games[i].dlcs[j].languagepacks.size(); ++k)
|
||||
{
|
||||
std::string filepath = games[i].dlcs[j].languagepacks[k].getFilepath();
|
||||
if (config.blacklist.isBlacklisted(filepath)) {
|
||||
if (config.bVerbose)
|
||||
std::cerr << "skipped blacklisted file " << filepath << std::endl;
|
||||
continue;
|
||||
}
|
||||
|
||||
// Get XML data
|
||||
std::string XML = "";
|
||||
if (config.bRemoteXML)
|
||||
{
|
||||
XML = gogAPI->getXML(games[i].dlcs[j].gamename, games[i].dlcs[j].languagepacks[k].id);
|
||||
if (gogAPI->getError())
|
||||
{
|
||||
std::cerr << gogAPI->getErrorMessage() << std::endl;
|
||||
gogAPI->clearError();
|
||||
}
|
||||
}
|
||||
|
||||
std::string url = gogAPI->getLanguagePackLink(games[i].dlcs[j].gamename, games[i].dlcs[j].languagepacks[k].id);
|
||||
if (gogAPI->getError())
|
||||
{
|
||||
std::cerr << gogAPI->getErrorMessage() << std::endl;
|
||||
gogAPI->clearError();
|
||||
continue;
|
||||
}
|
||||
std::cout << "Repairing file " << filepath << std::endl;
|
||||
this->repairFile(url, filepath, XML, games[i].dlcs[j].gamename);
|
||||
std::cout << std::endl;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1013,6 +1064,13 @@ void Downloader::download()
|
||||
dlQueue.push(games[i].dlcs[j].extras[k]);
|
||||
}
|
||||
}
|
||||
if (config.bLanguagePacks)
|
||||
{
|
||||
for (unsigned int k = 0; k < games[i].dlcs[j].languagepacks.size(); ++k)
|
||||
{
|
||||
dlQueue.push(games[i].dlcs[j].languagepacks[k]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -2324,6 +2382,29 @@ void Downloader::checkStatus()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (config.bLanguagePacks)
|
||||
{
|
||||
for (unsigned int k = 0; k < games[i].dlcs[j].languagepacks.size(); ++k)
|
||||
{
|
||||
boost::filesystem::path filepath = games[i].dlcs[j].languagepacks[k].getFilepath();
|
||||
|
||||
if (config.blacklist.isBlacklisted(filepath.native()))
|
||||
continue;
|
||||
std::string localHash = this->getLocalFileHash(filepath.string(), games[i].dlcs[j].gamename);
|
||||
uintmax_t filesize;
|
||||
|
||||
if (boost::filesystem::exists(filepath) && boost::filesystem::is_regular_file(filepath))
|
||||
{
|
||||
filesize = boost::filesystem::file_size(filepath);
|
||||
std::cout << "OK " << games[i].dlcs[j].gamename << " " << filepath.filename().string() << " " << filesize << " " << localHash << std::endl;
|
||||
}
|
||||
else
|
||||
{
|
||||
std::cout << "ND " << games[i].dlcs[j].gamename << " " << filepath.filename().string() << std::endl;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -3166,7 +3247,7 @@ void Downloader::printProgress()
|
||||
|
||||
char progress_percentage_text[200];
|
||||
sprintf(progress_percentage_text, "%3.0f%% ", fraction * 100);
|
||||
int progress_percentage_text_length = strlen(progress_percentage_text);
|
||||
int progress_percentage_text_length = strlen(progress_percentage_text) + 1;
|
||||
|
||||
bptime::time_duration eta(bptime::seconds((long)((progress_info.dltotal - progress_info.dlnow) / progress_info.rate)));
|
||||
std::stringstream eta_ss;
|
||||
|
@ -132,6 +132,13 @@ void gameDetails::makeFilepaths(const gameSpecificDirectoryConfig& config)
|
||||
filepath = Util::makeFilepath(directory, this->dlcs[i].extras[j].path, this->gamename, subdir, 0, this->dlcs[i].gamename);
|
||||
this->dlcs[i].extras[j].setFilepath(filepath);
|
||||
}
|
||||
|
||||
for (unsigned int j = 0; j < this->dlcs[i].languagepacks.size(); ++j)
|
||||
{
|
||||
subdir = config.bSubDirectories ? config.sDLCSubdir + "/" + config.sLanguagePackSubdir : "";
|
||||
filepath = Util::makeFilepath(directory, this->dlcs[i].languagepacks[j].path, this->gamename, subdir, 0, this->dlcs[i].gamename);
|
||||
this->dlcs[i].languagepacks[j].setFilepath(filepath);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user