diff --git a/include/globalconstants.h b/include/globalconstants.h index 614c956..5934d13 100644 --- a/include/globalconstants.h +++ b/include/globalconstants.h @@ -123,6 +123,7 @@ namespace GlobalConstants const unsigned int LIST_FORMAT_DETAILS_JSON = 1 << 2; const unsigned int LIST_FORMAT_TAGS = 1 << 3; const unsigned int LIST_FORMAT_TRANSFORMATIONS = 1 << 4; + const unsigned int LIST_FORMAT_USERDATA = 1 << 5; const std::vector LIST_FORMAT = { @@ -130,7 +131,8 @@ namespace GlobalConstants { LIST_FORMAT_DETAILS_TEXT, "details", "Details", "d|details" }, { LIST_FORMAT_DETAILS_JSON, "json", "JSON", "j|json" }, { LIST_FORMAT_TAGS, "tags", "Tags", "t|tags" }, - { LIST_FORMAT_TRANSFORMATIONS, "transform", "Transformations", "tr|transform|transformations" } + { LIST_FORMAT_TRANSFORMATIONS, "transform", "Transformations", "tr|transform|transformations" }, + { LIST_FORMAT_USERDATA, "userdata", "User data", "ud|userdata" } }; const unsigned int GFTYPE_BASE_INSTALLER = 1 << 0; diff --git a/src/downloader.cpp b/src/downloader.cpp index e2b74d1..d8a706e 100644 --- a/src/downloader.cpp +++ b/src/downloader.cpp @@ -565,6 +565,21 @@ int Downloader::listGames() } } } + else if (Globals::globalConfig.iListFormat == GlobalConstants::LIST_FORMAT_USERDATA) + { + Json::Value userdata; + std::istringstream response(gogWebsite->getResponse("https://embed.gog.com/userData.json")); + try + { + response >> userdata; + } + catch(const Json::Exception& exc) + { + std::cerr << "Failed to get user data" << std::endl; + return 1; + } + std::cout << userdata << std::endl; + } else { if (this->games.empty()) {