mirror of
https://github.com/RetroDECK/ES-DE.git
synced 2024-11-25 23:55:38 +00:00
If wheel (marquee) images on ScreenScraper falls back to another region, then the wheel-hd image is now used instead if that matches the set region.
This commit is contained in:
parent
2d2507df73
commit
33b52d61b5
|
@ -561,6 +561,7 @@ void ScreenScraperRequest::processGame(const pugi::xml_document& xmldoc,
|
||||||
|
|
||||||
// Media super-node.
|
// Media super-node.
|
||||||
pugi::xml_node media_list = game.child("medias");
|
pugi::xml_node media_list = game.child("medias");
|
||||||
|
bool regionFallback {false};
|
||||||
|
|
||||||
if (media_list) {
|
if (media_list) {
|
||||||
// 3D box.
|
// 3D box.
|
||||||
|
@ -576,12 +577,20 @@ void ScreenScraperRequest::processGame(const pugi::xml_document& xmldoc,
|
||||||
processMedia(result, media_list, ssConfig.media_fanart, result.fanartUrl,
|
processMedia(result, media_list, ssConfig.media_fanart, result.fanartUrl,
|
||||||
result.fanartFormat, region);
|
result.fanartFormat, region);
|
||||||
// Marquee (wheel).
|
// Marquee (wheel).
|
||||||
processMedia(result, media_list, ssConfig.media_marquee, result.marqueeUrl,
|
regionFallback = processMedia(result, media_list, ssConfig.media_marquee,
|
||||||
result.marqueeFormat, region);
|
result.marqueeUrl, result.marqueeFormat, region);
|
||||||
// Marquee HD (wheel-hd) fallback if no regular wheel image was found.
|
// Marquee HD (wheel-hd) fallback if no regular wheel image was found or if the
|
||||||
if (result.marqueeUrl == "")
|
// image found was a fallback to another region than the one requested. If it was
|
||||||
processMedia(result, media_list, ssConfig.media_marquee_hd, result.marqueeUrl,
|
// a fallback to another region then it will only get replaced with the wheel-hd
|
||||||
result.marqueeFormat, region);
|
// image if that is matching the requested region.
|
||||||
|
if (regionFallback || result.marqueeUrl == "") {
|
||||||
|
std::string marqueeUrlTemp {result.marqueeUrl};
|
||||||
|
if (processMedia(result, media_list, ssConfig.media_marquee_hd, result.marqueeUrl,
|
||||||
|
result.marqueeFormat, region) &&
|
||||||
|
marqueeUrlTemp != "") {
|
||||||
|
result.marqueeUrl = marqueeUrlTemp;
|
||||||
|
}
|
||||||
|
}
|
||||||
// Physical media.
|
// Physical media.
|
||||||
processMedia(result, media_list, ssConfig.media_physicalmedia, result.physicalmediaUrl,
|
processMedia(result, media_list, ssConfig.media_physicalmedia, result.physicalmediaUrl,
|
||||||
result.physicalmediaFormat, region);
|
result.physicalmediaFormat, region);
|
||||||
|
@ -608,14 +617,15 @@ void ScreenScraperRequest::processGame(const pugi::xml_document& xmldoc,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ScreenScraperRequest::processMedia(ScraperSearchResult& result,
|
bool ScreenScraperRequest::processMedia(ScraperSearchResult& result,
|
||||||
const pugi::xml_node& media_list,
|
const pugi::xml_node& media_list,
|
||||||
std::string mediaType,
|
std::string& mediaType,
|
||||||
std::string& fileURL,
|
std::string& fileURL,
|
||||||
std::string& fileFormat,
|
std::string& fileFormat,
|
||||||
std::string region)
|
const std::string& region)
|
||||||
{
|
{
|
||||||
pugi::xml_node art {pugi::xml_node(nullptr)};
|
pugi::xml_node art {pugi::xml_node(nullptr)};
|
||||||
|
bool regionFallback {false};
|
||||||
|
|
||||||
// Do an XPath query for media[type='$media_type'], then filter by region.
|
// Do an XPath query for media[type='$media_type'], then filter by region.
|
||||||
// We need to do this because any child of 'medias' has the form
|
// We need to do this because any child of 'medias' has the form
|
||||||
|
@ -649,6 +659,8 @@ void ScreenScraperRequest::processMedia(ScraperSearchResult& result,
|
||||||
for (auto node : results) {
|
for (auto node : results) {
|
||||||
if (node.node().attribute("region").value() == regionEntry) {
|
if (node.node().attribute("region").value() == regionEntry) {
|
||||||
art = node.node();
|
art = node.node();
|
||||||
|
if (region != regionEntry)
|
||||||
|
regionFallback = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -671,6 +683,8 @@ void ScreenScraperRequest::processMedia(ScraperSearchResult& result,
|
||||||
"Failed to find media XML node with name '"
|
"Failed to find media XML node with name '"
|
||||||
<< mediaType << "'";
|
<< mediaType << "'";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return regionFallback;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Currently not used in this module.
|
// Currently not used in this module.
|
||||||
|
|
|
@ -102,12 +102,12 @@ protected:
|
||||||
|
|
||||||
void processList(const pugi::xml_document& xmldoc, std::vector<ScraperSearchResult>& results);
|
void processList(const pugi::xml_document& xmldoc, std::vector<ScraperSearchResult>& results);
|
||||||
void processGame(const pugi::xml_document& xmldoc, std::vector<ScraperSearchResult>& results);
|
void processGame(const pugi::xml_document& xmldoc, std::vector<ScraperSearchResult>& results);
|
||||||
void processMedia(ScraperSearchResult& result,
|
bool processMedia(ScraperSearchResult& result,
|
||||||
const pugi::xml_node& media_list,
|
const pugi::xml_node& media_list,
|
||||||
std::string mediaType,
|
std::string& mediaType,
|
||||||
std::string& fileURL,
|
std::string& fileURL,
|
||||||
std::string& fileFormat,
|
std::string& fileFormat,
|
||||||
std::string region);
|
const std::string& region);
|
||||||
bool isGameRequest() { return !mRequestQueue; }
|
bool isGameRequest() { return !mRequestQueue; }
|
||||||
|
|
||||||
std::queue<std::unique_ptr<ScraperRequest>>* mRequestQueue;
|
std::queue<std::unique_ptr<ScraperRequest>>* mRequestQueue;
|
||||||
|
|
Loading…
Reference in a new issue