From 83baa5b5d0811c58d8e2e3c0f6447285a2302f64 Mon Sep 17 00:00:00 2001 From: Leon Styhre Date: Sat, 2 Mar 2024 15:49:43 +0100 Subject: [PATCH] Added a more informative error message than 'HTTP error code 430' when exceeding the daily ScreenScraper quota --- es-app/src/scrapers/Scraper.cpp | 2 +- es-core/src/HttpReq.cpp | 9 +++++++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/es-app/src/scrapers/Scraper.cpp b/es-app/src/scrapers/Scraper.cpp index f4c01c993..4457e73c4 100644 --- a/es-app/src/scrapers/Scraper.cpp +++ b/es-app/src/scrapers/Scraper.cpp @@ -35,7 +35,7 @@ namespace std::unique_ptr startScraperSearch(const ScraperSearchParams& params) { - std::string name = Settings::getInstance()->getString("Scraper"); + std::string name {Settings::getInstance()->getString("Scraper")}; // Handle a potentially invalid entry in the configuration file. if (name != "screenscraper" && name != "thegamesdb") { name = "screenscraper"; diff --git a/es-core/src/HttpReq.cpp b/es-core/src/HttpReq.cpp index 691e640bd..73fd81ead 100644 --- a/es-core/src/HttpReq.cpp +++ b/es-core/src/HttpReq.cpp @@ -263,8 +263,13 @@ HttpReq::Status HttpReq::status() long responseCode; curl_easy_getinfo(msg->easy_handle, CURLINFO_RESPONSE_CODE, &responseCode); - if (responseCode == 404 && mScraperRequest && - Settings::getInstance()->getBool("ScraperIgnoreHTTP404Errors")) { + if (responseCode == 430 && + Settings::getInstance()->getString("Scraper") == "screenscraper") { + req->mContent << "You have exceeded your daily scrape quota"; + req->mStatus = REQ_SUCCESS; + } + else if (responseCode == 404 && mScraperRequest && + Settings::getInstance()->getBool("ScraperIgnoreHTTP404Errors")) { req->mStatus = REQ_RESOURCE_NOT_FOUND; } else {