Scraping using ScreenScraper now always shows the ratings in the GUI.

This commit is contained in:
Leon Styhre 2020-12-16 19:03:05 +01:00
parent e6f16be221
commit ab2b29f398
2 changed files with 6 additions and 3 deletions

View file

@ -83,8 +83,7 @@ GuiScraperSearch::GuiScraperSearch(
mMD_Players = std::make_shared<TextComponent>(mWindow, "", font, mdColor);
mMD_Filler = std::make_shared<TextComponent>(mWindow, "", font, mdColor);
if (Settings::getInstance()->getBool("ScrapeRatings") &&
Settings::getInstance()->getString("Scraper") != "thegamesdb")
if (Settings::getInstance()->getString("Scraper") != "thegamesdb")
mScrapeRatings = true;
if (mScrapeRatings)

View file

@ -319,7 +319,11 @@ void ScreenScraperRequest::processGame(const pugi::xml_document& xmldoc,
result.mdl.get("name");
// Validate rating.
if (Settings::getInstance()->getBool("ScrapeRatings") && game.child("note")) {
// Process the rating even if the setting to scrape ratings has been disabled.
// This is required so that the rating can still be shown in the scraper GUI.
// GuiScraperSearch::saveMetadata() will take care of skipping the rating saving
// if this option has been set as such.
if (game.child("note")) {
float ratingVal = (game.child("note").text().as_int() / 20.0f);
// Round up to the closest .1 value, i.e. to the closest half-star.
ratingVal = Math::ceilf(ratingVal / 0.1) / 10;