From 2ee67407d86458398c9436e8e46f5a1cfe158e94 Mon Sep 17 00:00:00 2001 From: Leon Styhre Date: Thu, 6 Aug 2020 12:52:06 +0200 Subject: [PATCH] Scraper allowance information is now logged as debug info. --- es-app/src/scrapers/GamesDBJSONScraper.cpp | 4 +++- es-app/src/scrapers/ScreenScraper.cpp | 14 +++++++++++++- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/es-app/src/scrapers/GamesDBJSONScraper.cpp b/es-app/src/scrapers/GamesDBJSONScraper.cpp index 5fbc42075..347a08c1c 100644 --- a/es-app/src/scrapers/GamesDBJSONScraper.cpp +++ b/es-app/src/scrapers/GamesDBJSONScraper.cpp @@ -432,8 +432,10 @@ void TheGamesDBJSONRequest::process(const std::unique_ptr& req, doc["remaining_monthly_allowance"].GetInt() + doc["extra_allowance"].GetInt(); } + LOG(LogDebug) << "TheGamesDBJSONRequest::process(): " + "Remaining monthly scraping allowance: " << + results.back().scraperRequestAllowance; } - return; } diff --git a/es-app/src/scrapers/ScreenScraper.cpp b/es-app/src/scrapers/ScreenScraper.cpp index 32030990a..cf91b71c4 100644 --- a/es-app/src/scrapers/ScreenScraper.cpp +++ b/es-app/src/scrapers/ScreenScraper.cpp @@ -236,7 +236,9 @@ void ScreenScraperRequest::processGame(const pugi::xml_document& xmldoc, result.gameID = game.attribute("id").as_string(); // Find how many more requests we can make before the scraper request - // allowance counter is reset. + // allowance counter is reset. For some strange reason the ssuser information + // is not provided for all games even though the request looks identical apart + // from the game name. unsigned requestsToday = data.child("ssuser").child("requeststoday").text().as_uint(); unsigned maxRequestsPerDay = @@ -331,6 +333,16 @@ void ScreenScraperRequest::processGame(const pugi::xml_document& xmldoc, result.mdl.get("players"); } + if (maxRequestsPerDay > 0) { + LOG(LogDebug) << "ScreenScraperRequest::processGame(): Daily scraping allowance: " << + requestsToday << "/" << maxRequestsPerDay << " (" << + result.scraperRequestAllowance << " remaining)."; + } + else { + LOG(LogDebug) << "ScreenScraperRequest::processGame(): Daily scraping allowance: " + "No statistics were provided with the response."; + } + // Media super-node. pugi::xml_node media_list = game.child("medias");