mirror of
https://github.com/RetroDECK/ES-DE.git
synced 2024-11-25 23:55:38 +00:00
Added support for scraping fan art images.
Also added scraping of box back covers when using TheGamesDB.
This commit is contained in:
parent
a135edb02e
commit
92f5284bf3
|
@ -278,6 +278,12 @@ const std::string FileData::getCoverPath() const
|
|||
return getMediafilePath("covers");
|
||||
}
|
||||
|
||||
const std::string FileData::getFanArtPath() const
|
||||
{
|
||||
// Return path to the fan art image.
|
||||
return getMediafilePath("fanart");
|
||||
}
|
||||
|
||||
const std::string FileData::getMarqueePath() const
|
||||
{
|
||||
// Return path to the marquee image.
|
||||
|
|
|
@ -65,6 +65,7 @@ public:
|
|||
const std::string get3DBoxPath() const;
|
||||
const std::string getBackCoverPath() const;
|
||||
const std::string getCoverPath() const;
|
||||
const std::string getFanArtPath() const;
|
||||
const std::string getMarqueePath() const;
|
||||
const std::string getPhysicalMediaPath() const;
|
||||
const std::string getMiximagePath() const;
|
||||
|
|
|
@ -183,6 +183,9 @@ void MediaViewer::findMedia()
|
|||
mScreenshotIndex = static_cast<int>(mImageFiles.size() - 1);
|
||||
}
|
||||
|
||||
if ((mediaFile = mGame->getFanArtPath()) != "")
|
||||
mImageFiles.push_back(mediaFile);
|
||||
|
||||
if ((mediaFile = mGame->getMiximagePath()) != "")
|
||||
mImageFiles.push_back(mediaFile);
|
||||
|
||||
|
|
|
@ -353,15 +353,16 @@ void GuiScraperMenu::openContentOptions()
|
|||
}
|
||||
});
|
||||
|
||||
// Box back cover images are not supported by TheGamesDB, so gray out the option if this
|
||||
// scraper is selected.
|
||||
if (Settings::getInstance()->getString("Scraper") == "thegamesdb") {
|
||||
scrapeBackCovers->setEnabled(false);
|
||||
scrapeBackCovers->setOpacity(DISABLED_OPACITY);
|
||||
scrapeBackCovers->getParent()
|
||||
->getChild(scrapeBackCovers->getChildIndex() - 1)
|
||||
->setOpacity(DISABLED_OPACITY);
|
||||
}
|
||||
// Scrape fan art images.
|
||||
auto scrapeFanArt = std::make_shared<SwitchComponent>(mWindow);
|
||||
scrapeFanArt->setState(Settings::getInstance()->getBool("ScrapeFanArt"));
|
||||
s->addWithLabel("FAN ART IMAGES", scrapeFanArt);
|
||||
s->addSaveFunc([scrapeFanArt, s] {
|
||||
if (scrapeFanArt->getState() != Settings::getInstance()->getBool("ScrapeFanArt")) {
|
||||
Settings::getInstance()->setBool("ScrapeFanArt", scrapeFanArt->getState());
|
||||
s->setNeedsSaving();
|
||||
}
|
||||
});
|
||||
|
||||
// Scrape marquee images.
|
||||
auto scrape_marquees = std::make_shared<SwitchComponent>(mWindow);
|
||||
|
|
|
@ -733,6 +733,7 @@ void GuiScraperSearch::update(int deltaTime)
|
|||
results_scrape[i].box3DUrl = it->box3DUrl;
|
||||
results_scrape[i].backcoverUrl = it->backcoverUrl;
|
||||
results_scrape[i].coverUrl = it->coverUrl;
|
||||
results_scrape[i].fanartUrl = it->fanartUrl;
|
||||
results_scrape[i].marqueeUrl = it->marqueeUrl;
|
||||
results_scrape[i].screenshotUrl = it->screenshotUrl;
|
||||
results_scrape[i].titlescreenUrl = it->titlescreenUrl;
|
||||
|
|
|
@ -402,6 +402,7 @@ void processMediaURLs(const Value& images,
|
|||
result.gameID = it->name.GetString();
|
||||
const Value& gameMedia = images[it->name];
|
||||
result.coverUrl = "";
|
||||
result.fanartUrl = "";
|
||||
result.marqueeUrl = "";
|
||||
result.screenshotUrl = "";
|
||||
result.titlescreenUrl = "";
|
||||
|
@ -420,6 +421,13 @@ void processMediaURLs(const Value& images,
|
|||
if (mediatype == "boxart" && mediaside == "front")
|
||||
if (gameMedia[i]["filename"].IsString())
|
||||
result.coverUrl = base_url + gameMedia[i]["filename"].GetString();
|
||||
if (mediatype == "boxart" && mediaside == "back")
|
||||
if (gameMedia[i]["filename"].IsString())
|
||||
result.backcoverUrl = base_url + gameMedia[i]["filename"].GetString();
|
||||
// Only process the first fanart result.
|
||||
if (mediatype == "fanart" && result.fanartUrl == "")
|
||||
if (gameMedia[i]["filename"].IsString())
|
||||
result.fanartUrl = base_url + gameMedia[i]["filename"].GetString();
|
||||
if (mediatype == "clearlogo")
|
||||
if (gameMedia[i]["filename"].IsString())
|
||||
result.marqueeUrl = base_url + gameMedia[i]["filename"].GetString();
|
||||
|
|
|
@ -212,6 +212,14 @@ MDResolveHandle::MDResolveHandle(const ScraperSearchResult& result,
|
|||
mediaFileInfo.resizeFile = true;
|
||||
scrapeFiles.push_back(mediaFileInfo);
|
||||
}
|
||||
if (Settings::getInstance()->getBool("ScrapeFanArt") && result.fanartUrl != "") {
|
||||
mediaFileInfo.fileURL = result.fanartUrl;
|
||||
mediaFileInfo.fileFormat = result.fanartFormat;
|
||||
mediaFileInfo.subDirectory = "fanart";
|
||||
mediaFileInfo.existingMediaFile = search.game->getFanArtPath();
|
||||
mediaFileInfo.resizeFile = true;
|
||||
scrapeFiles.push_back(mediaFileInfo);
|
||||
}
|
||||
if (Settings::getInstance()->getBool("ScrapePhysicalMedia") && result.physicalmediaUrl != "") {
|
||||
mediaFileInfo.fileURL = result.physicalmediaUrl;
|
||||
mediaFileInfo.fileFormat = result.physicalmediaFormat;
|
||||
|
|
|
@ -69,6 +69,7 @@ struct ScraperSearchResult {
|
|||
std::string box3DUrl;
|
||||
std::string backcoverUrl;
|
||||
std::string coverUrl;
|
||||
std::string fanartUrl;
|
||||
std::string marqueeUrl;
|
||||
std::string physicalmediaUrl;
|
||||
std::string screenshotUrl;
|
||||
|
@ -79,6 +80,7 @@ struct ScraperSearchResult {
|
|||
std::string box3DFormat;
|
||||
std::string backcoverFormat;
|
||||
std::string coverFormat;
|
||||
std::string fanartFormat;
|
||||
std::string marqueeFormat;
|
||||
std::string physicalmediaFormat;
|
||||
std::string screenshotFormat;
|
||||
|
|
|
@ -559,6 +559,9 @@ void ScreenScraperRequest::processGame(const pugi::xml_document& xmldoc,
|
|||
// Box cover.
|
||||
processMedia(result, media_list, ssConfig.media_cover, result.coverUrl,
|
||||
result.coverFormat, region);
|
||||
// Fan art.
|
||||
processMedia(result, media_list, ssConfig.media_fanart, result.fanartUrl,
|
||||
result.fanartFormat, region);
|
||||
// Marquee (wheel).
|
||||
processMedia(result, media_list, ssConfig.media_marquee, result.marqueeUrl,
|
||||
result.marqueeFormat, region);
|
||||
|
|
|
@ -73,6 +73,7 @@ public:
|
|||
std::string media_3dbox = "box-3D";
|
||||
std::string media_backcover = "box-2D-back";
|
||||
std::string media_cover = "box-2D";
|
||||
std::string media_fanart = "fanart";
|
||||
std::string media_marquee = "wheel";
|
||||
std::string media_physicalmedia = "support-2D";
|
||||
std::string media_screenshot = "ss";
|
||||
|
|
|
@ -272,6 +272,13 @@ void BasicGameListView::removeMedia(FileData* game)
|
|||
removeEmptyDirFunc(systemMediaDir, mediaType, path);
|
||||
}
|
||||
|
||||
while (Utils::FileSystem::exists(game->getFanArtPath())) {
|
||||
mediaType = "fanart";
|
||||
path = game->getFanArtPath();
|
||||
Utils::FileSystem::removeFile(path);
|
||||
removeEmptyDirFunc(systemMediaDir, mediaType, path);
|
||||
}
|
||||
|
||||
while (Utils::FileSystem::exists(game->getMarqueePath())) {
|
||||
mediaType = "marquees";
|
||||
path = game->getMarqueePath();
|
||||
|
|
|
@ -625,6 +625,13 @@ void GridGameListView::removeMedia(FileData* game)
|
|||
removeEmptyDirFunc(systemMediaDir, mediaType, path);
|
||||
}
|
||||
|
||||
while (Utils::FileSystem::exists(game->getFanArtPath())) {
|
||||
mediaType = "fanart";
|
||||
path = game->getFanArtPath();
|
||||
Utils::FileSystem::removeFile(path);
|
||||
removeEmptyDirFunc(systemMediaDir, mediaType, path);
|
||||
}
|
||||
|
||||
while (Utils::FileSystem::exists(game->getMarqueePath())) {
|
||||
mediaType = "marquees";
|
||||
path = game->getMarqueePath();
|
||||
|
|
|
@ -97,6 +97,7 @@ void Settings::setDefaults()
|
|||
mBoolMap["ScrapeTitleScreens"] = {true, true};
|
||||
mBoolMap["ScrapeCovers"] = {true, true};
|
||||
mBoolMap["ScrapeBackCovers"] = {true, true};
|
||||
mBoolMap["ScrapeFanArt"] = {true, true};
|
||||
mBoolMap["ScrapeMarquees"] = {true, true};
|
||||
mBoolMap["Scrape3DBoxes"] = {true, true};
|
||||
mBoolMap["ScrapePhysicalMedia"] = {true, true};
|
||||
|
|
Loading…
Reference in a new issue