This is an automated email from the git hooks/post-receive script.

skitt pushed a commit to branch master
in repository lgogdownloader.

commit 06980249a6b0e6babe7e2f96156fc6d23ec099f0
Author: Stephen Kitt <[email protected]>
Date:   Wed Oct 14 18:20:11 2015 +0200

    Imported Upstream version 2.26
---
 README.md                             |   2 +
 include/config.h                      |   2 +
 include/globalconstants.h             |   4 +-
 include/util.h                        |   1 +
 main.cpp                              | 152 ++++++++++++++++++----------------
 man/lgogdownloader.supplemental.groff |   9 +-
 src/downloader.cpp                    |  29 +++----
 src/util.cpp                          |  11 +++
 8 files changed, 111 insertions(+), 99 deletions(-)

diff --git a/README.md b/README.md
index d4c2b42..007d181 100644
--- a/README.md
+++ b/README.md
@@ -34,3 +34,5 @@ This repository contains the code of unofficial 
[GOG](http://www.gog.com/) downl
 - [GOG forum 
thread](https://www.gog.com/forum/general/lgogdownloader_gogdownloader_for_linux)
 - [LGOGDownloader @ AUR](https://aur.archlinux.org/packages/lgogdownloader/)
 - [LGOGDownloader @ AUR (git 
version)](https://aur.archlinux.org/packages/lgogdownloader-git/)
+- [LGOGDownloader @ Debian](https://tracker.debian.org/lgogdownloader)
+- [LGOGDownloader @ 
Ubuntu](https://launchpad.net/ubuntu/+source/lgogdownloader)
diff --git a/include/config.h b/include/config.h
index 4f07fbc..ea6fe6c 100644
--- a/include/config.h
+++ b/include/config.h
@@ -54,6 +54,7 @@ class Config
         std::string sToken;
         std::string sSecret;
         std::string sVersionString;
+        std::string sVersionNumber;
         std::string sConfigDirectory;
         std::string sCookiePath;
         std::string sConfigFilePath;
@@ -77,6 +78,7 @@ class Config
 
         unsigned int iInstallerPlatform;
         unsigned int iInstallerLanguage;
+        unsigned int iInclude;
         int iRetries;
         int iWait;
         int iCacheValid;
diff --git a/include/globalconstants.h b/include/globalconstants.h
index 8548f31..47ada3a 100644
--- a/include/globalconstants.h
+++ b/include/globalconstants.h
@@ -36,6 +36,7 @@ namespace GlobalConstants
     const unsigned int LANGUAGE_DA = 1 << 17;
     const unsigned int LANGUAGE_FI = 1 << 18;
     const unsigned int LANGUAGE_PT_BR = 1 << 19;
+    const unsigned int LANGUAGE_SK = 1 << 20;
 
     const std::vector<optionsStruct> LANGUAGES =
     {
@@ -58,7 +59,8 @@ namespace GlobalConstants
         { LANGUAGE_NO, "no", "Norwegian" , "no|nor|norwegian"      },
         { LANGUAGE_DA, "da", "Danish"    , "da|dan|danish"         },
         { LANGUAGE_FI, "fi", "Finnish"   , "fi|fin|finnish"        },
-        { LANGUAGE_PT_BR, "br", "Brazilian Portuguese", 
"br|pt_br|pt-br|ptbr|brazilian_portuguese" }
+        { LANGUAGE_PT_BR, "br", "Brazilian Portuguese", 
"br|pt_br|pt-br|ptbr|brazilian_portuguese" },
+        { LANGUAGE_SK, "sk", "Slovak"    , "sk|slk|slo|slovak"     }
     };
 
     // Platform constants
diff --git a/include/util.h b/include/util.h
index 865791d..d8d2813 100644
--- a/include/util.h
+++ b/include/util.h
@@ -47,6 +47,7 @@ namespace Util
     std::string getCacheHome();
     std::vector<std::string> tokenize(const std::string& str, const 
std::string& separator = ",");
     unsigned int getOptionValue(const std::string& str, const 
std::vector<GlobalConstants::optionsStruct>& options);
+    std::string getOptionNameString(const unsigned int& value, const 
std::vector<GlobalConstants::optionsStruct>& options);
 }
 
 #endif // UTIL_H
diff --git a/main.cpp b/main.cpp
index 6b2f0d3..020f3a7 100644
--- a/main.cpp
+++ b/main.cpp
@@ -13,7 +13,7 @@
 #include <boost/filesystem.hpp>
 #include <boost/program_options.hpp>
 
-#define VERSION_NUMBER "2.25"
+#define VERSION_NUMBER "2.26"
 
 #ifndef VERSION_STRING
 #   define VERSION_STRING "LGOGDownloader " VERSION_NUMBER
@@ -26,52 +26,50 @@ template<typename T> void 
set_vm_value(std::map<std::string, bpo::variable_value
     vm[option].value() = boost::any(value);
 }
 
-// Parse the priority string, making it an array of numeric codes, and 
override the ORed type if required
-void handle_priority(const std::string &what, const std::string 
&priority_string, std::vector<unsigned int> &priority, unsigned int &type, 
const std::vector<GlobalConstants::optionsStruct>& options)
+// Parse the options string
+void parseOptionString(const std::string &option_string, std::vector<unsigned 
int> &priority, unsigned int &type, const 
std::vector<GlobalConstants::optionsStruct>& options)
 {
-    std::vector<std::string> tokens = Util::tokenize(priority_string, ",");
-    for (std::vector<std::string>::iterator it = tokens.begin(); it != 
tokens.end(); it++)
+    type = 0;
+    std::vector<std::string> tokens_priority = Util::tokenize(option_string, 
",");
+    for (std::vector<std::string>::iterator it_priority = 
tokens_priority.begin(); it_priority != tokens_priority.end(); it_priority++)
     {
-        priority.push_back(Util::getOptionValue(*it, options));
+        unsigned int value = 0;
+        std::vector<std::string> tokens_value = Util::tokenize(*it_priority, 
"+");
+        for (std::vector<std::string>::iterator it_value = 
tokens_value.begin(); it_value != tokens_value.end(); it_value++)
+        {
+            value |= Util::getOptionValue(*it_value, options);
+        }
+        priority.push_back(value);
+        type |= value;
     }
-
-    unsigned int wanted = 0;
-    #ifdef DEBUG
-        std::cerr << "DEBUG INFO (handle_priority): for " << what << " found ";
-    #endif
-    for (std::vector<unsigned int>::iterator it = priority.begin(); it != 
priority.end(); it++)
-       {
-           wanted |= *it;
-            #ifdef DEBUG
-             std::cerr << *it << " ";
-            #endif
-       }
-    #ifdef DEBUG
-        std::cerr << std::endl;
-    #endif
-
-    if (wanted != type)
-       {
-            type = wanted;
-           std::cout << "Warning: for " << what << " the priority string 
doesn't match the enabled installers, forcing enabled installers to " << type 
<< std::endl;
-       }
 }
 
-unsigned int parseOptionString(const std::string &option_string, const 
std::vector<GlobalConstants::optionsStruct>& options)
+int main(int argc, char *argv[])
 {
-    unsigned int value = 0;
-    std::vector<std::string> tokens = Util::tokenize(option_string, ",");
-    for (std::vector<std::string>::iterator it = tokens.begin(); it != 
tokens.end(); it++)
+    // Constants for option selection with include/exclude
+    /* TODO: Add options to give better control for user
+             For example: option to select base game and DLC installers 
separately,
+             this requires some changes to Downloader class to implement */
+    const unsigned int OPTION_INSTALLERS = 1 << 0;
+    const unsigned int OPTION_EXTRAS     = 1 << 1;
+    const unsigned int OPTION_PATCHES    = 1 << 2;
+    const unsigned int OPTION_LANGPACKS  = 1 << 3;
+    const unsigned int OPTION_COVERS     = 1 << 4;
+    const unsigned int OPTION_DLCS       = 1 << 5;
+
+    const std::vector<GlobalConstants::optionsStruct> INCLUDE_OPTIONS =
     {
-        value |= Util::getOptionValue(*it, options);
-    }
-    return value;
-}
+        { OPTION_INSTALLERS, "i", "Installers",     "i|installers"             
 },
+        { OPTION_EXTRAS,     "e", "Extras",         "e|extras"                 
 },
+        { OPTION_PATCHES,    "p", "Patches",        "p|patches"                
 },
+        { OPTION_LANGPACKS,  "l", "Language packs", 
"l|languagepacks|langpacks" },
+        { OPTION_COVERS,     "c", "Covers",         "c|cover|covers"           
 },
+        { OPTION_DLCS,       "d", "DLCs",           "d|dlc|dlcs"               
 }
+    };
 
-int main(int argc, char *argv[])
-{
     Config config;
     config.sVersionString = VERSION_STRING;
+    config.sVersionNumber = VERSION_NUMBER;
 
     config.sCacheDirectory = Util::getCacheHome() + "/lgogdownloader";
     config.sXMLDirectory = config.sCacheDirectory + "/xml";
@@ -81,6 +79,7 @@ int main(int argc, char *argv[])
     config.sConfigFilePath = config.sConfigDirectory + "/config.cfg";
     config.sBlacklistFilePath = config.sConfigDirectory + "/blacklist.txt";
 
+    std::string priority_help_text = "Set priority by separating values with 
\",\"\nCombine values by separating with \"+\"";
     // Create help text for --platform option
     std::string platform_text = "Select which installers are downloaded\n";
     unsigned int platform_all = Util::getOptionValue("all", 
GlobalConstants::PLATFORMS);
@@ -89,6 +88,8 @@ int main(int argc, char *argv[])
         platform_text += GlobalConstants::PLATFORMS[i].str + " = " + 
GlobalConstants::PLATFORMS[i].regexp + "|" + 
std::to_string(GlobalConstants::PLATFORMS[i].id) + "\n";
     }
     platform_text += "All = all|" + std::to_string(platform_all);
+    platform_text += "\n\n" + priority_help_text;
+    platform_text += "\nExample: Linux if available otherwise Windows and Mac: 
l,w+m";
 
     // Create help text for --language option
     std::string language_text = "Select which language installers are 
downloaded\n";
@@ -98,7 +99,9 @@ int main(int argc, char *argv[])
         language_text +=  GlobalConstants::LANGUAGES[i].str + " = " + 
GlobalConstants::LANGUAGES[i].regexp + "|" + 
std::to_string(GlobalConstants::LANGUAGES[i].id) + "\n";
     }
     language_text += "Add the values to download multiple languages\nAll = 
all|" + std::to_string(language_all) + "\n"
-                    + "French + Polish = \"fr,pl\"|" + 
std::to_string(GlobalConstants::LANGUAGE_FR | GlobalConstants::LANGUAGE_PL) + " 
(" + std::to_string(GlobalConstants::LANGUAGE_FR) + "+" + 
std::to_string(GlobalConstants::LANGUAGE_PL) + "=" + 
std::to_string(GlobalConstants::LANGUAGE_FR | GlobalConstants::LANGUAGE_PL) + 
")";
+                    + "French + Polish = \"fr+pl\"|" + 
std::to_string(GlobalConstants::LANGUAGE_FR | GlobalConstants::LANGUAGE_PL) + " 
(" + std::to_string(GlobalConstants::LANGUAGE_FR) + "+" + 
std::to_string(GlobalConstants::LANGUAGE_PL) + "=" + 
std::to_string(GlobalConstants::LANGUAGE_FR | GlobalConstants::LANGUAGE_PL) + 
")";
+    language_text += "\n\n" + priority_help_text;
+    language_text += "\nExample: German if available otherwise English and 
French: de,en+fr";
 
     // Create help text for --check-orphans
     std::string orphans_regex_default = 
".*\\.(zip|exe|bin|dmg|old|deb|tar\\.gz|pkg|sh)$"; // Limit to files with these 
extensions (".old" is for renamed older version files)
@@ -106,8 +109,14 @@ int main(int argc, char *argv[])
 
     // Help text for subdir options
     std::string subdir_help_text = "\nTemplates:\n- %platform%\n- 
%gamename%\n- %dlcname%";
-    // Help text for priority options
-    std::string priority_help_text = "\nIf set, only the first matching one 
will be downloaded. If unset, all matching combinations will be 
downloaded.\nSyntax: use a string separated by \",\"";
+
+    // Help text for include and exclude options
+    std::string include_options_text;
+    for (unsigned int i = 0; i < INCLUDE_OPTIONS.size(); ++i)
+    {
+        include_options_text +=  INCLUDE_OPTIONS[i].str + " = " + 
INCLUDE_OPTIONS[i].regexp + "|" + std::to_string(INCLUDE_OPTIONS[i].id) + "\n";
+    }
+    include_options_text += "Separate with \",\" to use multiple values";
 
     std::vector<std::string> vFileIdStrings;
     std::vector<std::string> unrecognized_options_cfg;
@@ -124,18 +133,14 @@ int main(int argc, char *argv[])
         bool bNoColor = false;
         bool bNoUnicode = false;
         bool bNoDuplicateHandler = false;
-        bool bNoInstallers = false;
-        bool bNoExtras = false;
-        bool bNoPatches = false;
-        bool bNoLanguagePacks = false;
-        bool bNoDLC = false;
         bool bNoRemoteXML = false;
         bool bNoSubDirectories = false;
-        bool bNoCover = false;
         bool bNoPlatformDetection = false;
         bool bLogin = false;
         std::string sInstallerPlatform;
         std::string sInstallerLanguage;
+        std::string sIncludeOptions;
+        std::string sExcludeOptions;
         config.bReport = false;
         // Commandline options (no config file)
         options_cli_no_cfg.add_options()
@@ -154,7 +159,6 @@ int main(int argc, char *argv[])
             ("save-config", 
bpo::value<bool>(&config.bSaveConfig)->zero_tokens()->default_value(false), 
"Create config file with current settings")
             ("reset-config", 
bpo::value<bool>(&config.bResetConfig)->zero_tokens()->default_value(false), 
"Reset config settings to default")
             ("report", 
bpo::value<std::string>(&config.sReportFilePath)->implicit_value("lgogdownloader-report.log"),
 "Save report of downloaded/repaired files to specified file\nDefault filename: 
lgogdownloader-report.log")
-            ("no-cover", 
bpo::value<bool>(&bNoCover)->zero_tokens()->default_value(false), "Don't 
download cover images. Overrides --cover option.\nUseful for making exceptions 
when \"cover\" is set to true in config file.")
             ("update-cache", 
bpo::value<bool>(&config.bUpdateCache)->zero_tokens()->default_value(false), 
"Update game details cache")
             ("no-platform-detection", 
bpo::value<bool>(&bNoPlatformDetection)->zero_tokens()->default_value(false), 
"Don't try to detect supported platforms from game shelf.\nSkips the initial 
fast platform detection and detects the supported platforms from game details 
which is slower but more accurate.\nUseful in case platform identifier is 
missing for some games in the game shelf.\nUsing --platform with --list doesn't 
work with this option.")
             ("download-file", 
bpo::value<std::string>(&config.sFileIdString)->default_value(""), "Download 
files using fileid\n\nFormat:\n\"gamename/fileid\"\nor: 
\"gogdownloader://gamename/fileid\"\n\nMultiple 
files:\n\"gamename1/fileid1,gamename2/fileid2\"\nor: 
\"gogdownloader://gamename1/fileid1,gamename2/fileid2\"\n\nThis option ignores 
all subdir options. The files are downloaded to directory specified with 
--directory option.")
@@ -169,14 +173,8 @@ int main(int argc, char *argv[])
             ("limit-rate", 
bpo::value<curl_off_t>(&config.iDownloadRate)->default_value(0), "Limit 
download rate to value in kB\n0 = unlimited")
             ("xml-directory", bpo::value<std::string>(&config.sXMLDirectory), 
"Set directory for GOG XML files")
             ("chunk-size", 
bpo::value<size_t>(&config.iChunkSize)->default_value(10), "Chunk size (in MB) 
when creating XML")
-            ("platform", 
bpo::value<std::string>(&sInstallerPlatform)->default_value(std::to_string(GlobalConstants::PLATFORM_WINDOWS|GlobalConstants::PLATFORM_LINUX)),
 platform_text.c_str())
-            ("language", 
bpo::value<std::string>(&sInstallerLanguage)->default_value(std::to_string(GlobalConstants::LANGUAGE_EN)),
 language_text.c_str())
-            ("no-installers", 
bpo::value<bool>(&bNoInstallers)->zero_tokens()->default_value(false), "Don't 
download/list/repair installers")
-            ("no-extras", 
bpo::value<bool>(&bNoExtras)->zero_tokens()->default_value(false), "Don't 
download/list/repair extras")
-            ("no-patches", 
bpo::value<bool>(&bNoPatches)->zero_tokens()->default_value(false), "Don't 
download/list/repair patches")
-            ("no-language-packs", 
bpo::value<bool>(&bNoLanguagePacks)->zero_tokens()->default_value(false), 
"Don't download/list/repair language packs")
-            ("no-dlc", 
bpo::value<bool>(&bNoDLC)->zero_tokens()->default_value(false), "Don't 
download/list/repair DLCs")
-            ("cover", 
bpo::value<bool>(&config.bCover)->zero_tokens()->default_value(false), 
"Download cover images")
+            ("platform", 
bpo::value<std::string>(&sInstallerPlatform)->default_value("w+l"), 
platform_text.c_str())
+            ("language", 
bpo::value<std::string>(&sInstallerLanguage)->default_value("en"), 
language_text.c_str())
             ("no-remote-xml", 
bpo::value<bool>(&bNoRemoteXML)->zero_tokens()->default_value(false), "Don't 
use remote XML for repair")
             ("no-unicode", 
bpo::value<bool>(&bNoUnicode)->zero_tokens()->default_value(false), "Don't use 
Unicode in the progress bar")
             ("no-color", 
bpo::value<bool>(&bNoColor)->zero_tokens()->default_value(false), "Don't use 
coloring in the progress bar")
@@ -196,10 +194,10 @@ int main(int argc, char *argv[])
             ("subdir-game", 
bpo::value<std::string>(&config.sGameSubdir)->default_value("%gamename%"), 
("Set subdirectory for game" + subdir_help_text).c_str())
             ("use-cache", 
bpo::value<bool>(&config.bUseCache)->zero_tokens()->default_value(false), ("Use 
game details cache"))
             ("cache-valid", 
bpo::value<int>(&config.iCacheValid)->default_value(2880), ("Set how long 
cached game details are valid (in minutes)\nDefault: 2880 minutes (48 hours)"))
-            ("language-priority", 
bpo::value<std::string>(&config.sLanguagePriority)->default_value(""), ("Set 
priority of systems" + priority_help_text + ", like \"4,1\" or \"fr,en\" for 
French first, then English if no French version").c_str())
-            ("platform-priority", 
bpo::value<std::string>(&config.sPlatformPriority)->default_value(""), ("Set 
priority of platforms" + priority_help_text + ", like \"4,1\" or 
\"linux,windows\" for Linux first, then Windows if no Linux version").c_str())
             ("save-serials", 
bpo::value<bool>(&config.bSaveSerials)->zero_tokens()->default_value(false), 
"Save serial numbers when downloading")
             ("ignore-dlc-count", 
bpo::value<std::string>(&config.sIgnoreDLCCountRegex)->implicit_value(".*"), 
"Set regular expression filter for games to ignore DLC count 
information\nIgnoring DLC count information helps in situations where the 
account page doesn't provide accurate information about DLCs")
+            ("include", 
bpo::value<std::string>(&sIncludeOptions)->default_value("all"), ("Select what 
to download/list/repair\n" + include_options_text).c_str())
+            ("exclude", 
bpo::value<std::string>(&sExcludeOptions)->default_value("covers"), ("Select 
what not to download/list/repair\n" + include_options_text).c_str())
         ;
         // Options read from config file
         options_cfg_only.add_options()
@@ -317,16 +315,9 @@ int main(int argc, char *argv[])
         config.bColor = !bNoColor;
         config.bUnicode = !bNoUnicode;
         config.bDuplicateHandler = !bNoDuplicateHandler;
-        config.bInstallers = !bNoInstallers;
-        config.bExtras = !bNoExtras;
-        config.bPatches = !bNoPatches;
-        config.bLanguagePacks = !bNoLanguagePacks;
-        config.bDLC = !bNoDLC;
         config.bRemoteXML = !bNoRemoteXML;
         config.bSubDirectories = !bNoSubDirectories;
         config.bPlatformDetection = !bNoPlatformDetection;
-        config.iInstallerLanguage = parseOptionString(sInstallerLanguage, 
GlobalConstants::LANGUAGES);
-        config.iInstallerPlatform = parseOptionString(sInstallerPlatform, 
GlobalConstants::PLATFORMS);
 
         for (auto i = unrecognized_options_cli.begin(); i != 
unrecognized_options_cli.end(); ++i)
             if (i->compare(0, GlobalConstants::PROTOCOL_PREFIX.length(), 
GlobalConstants::PROTOCOL_PREFIX) == 0)
@@ -347,22 +338,37 @@ int main(int argc, char *argv[])
             return 1;
         }
 
-        // Override cover option
-        if (bNoCover)
-            config.bCover = false;
-
         if (bLogin)
         {
             config.bLoginAPI = true;
             config.bLoginHTTP = true;
         }
 
-        // Handle priority business
-        if (!config.sLanguagePriority.empty())
-            handle_priority("languages", config.sLanguagePriority, 
config.vLanguagePriority, config.iInstallerLanguage, 
GlobalConstants::LANGUAGES);
-        if (!config.sPlatformPriority.empty())
-            handle_priority("platforms", config.sPlatformPriority, 
config.vPlatformPriority, config.iInstallerPlatform, 
GlobalConstants::PLATFORMS);
+        parseOptionString(sInstallerLanguage, config.vLanguagePriority, 
config.iInstallerLanguage, GlobalConstants::LANGUAGES);
+        parseOptionString(sInstallerPlatform, config.vPlatformPriority, 
config.iInstallerPlatform, GlobalConstants::PLATFORMS);
 
+        unsigned int include_value = 0;
+        unsigned int exclude_value = 0;
+        std::vector<std::string> vInclude = Util::tokenize(sIncludeOptions, 
",");
+        std::vector<std::string> vExclude = Util::tokenize(sExcludeOptions, 
",");
+        for (std::vector<std::string>::iterator it = vInclude.begin(); it != 
vInclude.end(); it++)
+        {
+            include_value |= Util::getOptionValue(*it, INCLUDE_OPTIONS);
+        }
+        for (std::vector<std::string>::iterator it = vExclude.begin(); it != 
vExclude.end(); it++)
+        {
+            exclude_value |= Util::getOptionValue(*it, INCLUDE_OPTIONS);
+        }
+        config.iInclude = include_value & ~exclude_value;
+
+        // Assign values
+        // TODO: Use config.iInclude in Downloader class directly and get rid 
of this value assignment
+        config.bCover = (config.iInclude & OPTION_COVERS);
+        config.bInstallers = (config.iInclude & OPTION_INSTALLERS);
+        config.bExtras = (config.iInclude & OPTION_EXTRAS);
+        config.bPatches = (config.iInclude & OPTION_PATCHES);
+        config.bLanguagePacks = (config.iInclude & OPTION_LANGPACKS);
+        config.bDLC = (config.iInclude & OPTION_DLCS);
     }
     catch (std::exception& e)
     {
diff --git a/man/lgogdownloader.supplemental.groff 
b/man/lgogdownloader.supplemental.groff
index 52e1735..22423a0 100644
--- a/man/lgogdownloader.supplemental.groff
+++ b/man/lgogdownloader.supplemental.groff
@@ -85,14 +85,11 @@ Must be in the following format:
 }
 
 [priorities]
-For both languages and platforms, the default behavior is to download all 
enabled ones.
-The \fBlanguage-priority\fB and \fBplatform-priority\fB switches enable a 
priority-based mode: only the first matching one will be downloaded.
+Separating values with "," when using \fBlanguage\fP and \fBplatform\fP 
switches enables a priority-based mode: only the first matching one will be 
downloaded.
 .PP
-For example, setting \fBlanguage\fB to 5 means both French and English will be 
downloaded (if available) for all games. Setting \fBlanguage-priority\fB to 4,1 
means that the French version (and only that one) will be downloaded if 
available, and if not, the English version will be downloaded.
+For example, setting \fBlanguage\fP to \fBfr+en\fP means both French and 
English will be downloaded (if available) for all games. Setting \fBlanguage\fP 
to \fBfr,en\fP means that the French version (and only that one) will be 
downloaded if available, and if not, the English version will be downloaded.
 .PP
-You're allowed to "stack" codes in the priority string if needed. If you set 
\fBlanguage-priority\fB 132,1 it means it'll download both Spanish (128) and 
French (4) versions if they are available, and the English (1) one only if none 
of French and Spanish are available.
-.PP
-Ideally the \fBlanguage\fB and \fBplatform\fB settings should match the sum of 
all enabled codes in the "priority" versions. If they don't, they'll be 
overrided with a warning.
+You're allowed to "stack" codes in the priority string if needed. If you set 
\fBlanguage\fP to \fBes+fr,en\fP it means it'll download both Spanish (es) and 
French (fr) versions if they are available, and the English (en) one only if 
none of French and Spanish are available.
 
 [availability]
 The latest version of this distribution is available from 
\fIhttps://github.com/Sude-/lgogdownloader\fP
diff --git a/src/downloader.cpp b/src/downloader.cpp
index 8de7a9a..9a5ed31 100644
--- a/src/downloader.cpp
+++ b/src/downloader.cpp
@@ -121,6 +121,10 @@ int Downloader::login()
 {
     char *pwd;
     std::string email;
+    if (!isatty(STDIN_FILENO)) {
+        std::cout << "Unable to read email and password" << std::endl;
+        return 0;
+    }
     std::cout << "Email: ";
     std::getline(std::cin,email);
     pwd = getpass("Password: ");
@@ -290,6 +294,7 @@ int Downloader::getGameDetails()
                 {
                     gameDetails dlc;
                     dlc = gogAPI->getGameDetails(gameItems[i].dlcnames[j], 
conf.iInstallerPlatform, conf.iInstallerLanguage, config.bDuplicateHandler);
+                    dlc.filterWithPriorities(config);
                     if (dlc.extras.empty() && config.bExtras) // Try to get 
extras from account page if API didn't return any extras
                     {
                         if (gameDetailsJSON.empty())
@@ -405,12 +410,7 @@ void Downloader::listGames()
                             continue;
                         }
 
-                        std::string languages;
-                        for (unsigned int k = 0; k < 
GlobalConstants::LANGUAGES.size(); k++) // Check which languages the installer 
supports
-                        {
-                            if (games[i].installers[j].language & 
GlobalConstants::LANGUAGES[k].id)
-                                languages += (languages.empty() ? "" : ", 
")+GlobalConstants::LANGUAGES[k].str;
-                        }
+                        std::string languages = 
Util::getOptionNameString(games[i].installers[j].language, 
GlobalConstants::LANGUAGES);
 
                         std::cout   << "\tid: " << games[i].installers[j].id 
<< std::endl
                                     << "\tname: " << 
games[i].installers[j].name << std::endl
@@ -457,12 +457,7 @@ void Downloader::listGames()
                         continue;
                     }
 
-                    std::string languages;
-                    for (unsigned int k = 0; k < 
GlobalConstants::LANGUAGES.size(); k++) // Check which languages the patch 
supports
-                    {
-                        if (games[i].patches[j].language & 
GlobalConstants::LANGUAGES[k].id)
-                            languages += (languages.empty() ? "" : ", 
")+GlobalConstants::LANGUAGES[k].str;
-                    }
+                    std::string languages = 
Util::getOptionNameString(games[i].patches[j].language, 
GlobalConstants::LANGUAGES);
 
                     std::cout   << "\tid: " << games[i].patches[j].id << 
std::endl
                                 << "\tname: " << games[i].patches[j].name << 
std::endl
@@ -2990,6 +2985,8 @@ int Downloader::saveGameDetailsCache()
 
     Json::Value json;
 
+    json["version-string"] = config.sVersionString;
+    json["version-number"] = config.sVersionNumber;
     json["date"] = bptime::to_iso_string(bptime::second_clock::local_time());
 
     for (unsigned int i = 0; i < this->games.size(); ++i)
@@ -3262,13 +3259,7 @@ void Downloader::showWishlist()
                     if (config.bPlatformDetection && !(platform & 
config.iInstallerPlatform))
                         continue;
 
-                    for (unsigned int j = 0; j < 
GlobalConstants::PLATFORMS.size(); ++j)
-                    {
-                        if (GlobalConstants::PLATFORMS[j].id & platform)
-                        {
-                            platforms_text += (platforms_text.empty() ? "" : 
", ")+GlobalConstants::PLATFORMS[j].str;
-                        }
-                    }
+                    platforms_text = Util::getOptionNameString(platform, 
GlobalConstants::PLATFORMS);
                 }
 
                 std::vector<std::string> tags;
diff --git a/src/util.cpp b/src/util.cpp
index 0accd6e..fcfb93e 100644
--- a/src/util.cpp
+++ b/src/util.cpp
@@ -460,3 +460,14 @@ unsigned int Util::getOptionValue(const std::string& str, 
const std::vector<Glob
     }
     return value;
 }
+
+std::string Util::getOptionNameString(const unsigned int& value, const 
std::vector<GlobalConstants::optionsStruct>& options)
+{
+    std::string str;
+    for (unsigned int i = 0; i < options.size(); ++i)
+    {
+        if (value & options[i].id)
+            str += (str.empty() ? "" : ", ")+options[i].str;
+    }
+    return str;
+}

-- 
Alioth's /usr/local/bin/git-commit-notice on 
/srv/git.debian.org/git/pkg-games/lgogdownloader.git

_______________________________________________
Pkg-games-commits mailing list
[email protected]
http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pkg-games-commits

Reply via email to