2020-05-26 16:34:33 +00:00
|
|
|
//
|
2020-06-21 12:25:28 +00:00
|
|
|
// ScreenScraper.h
|
2020-05-26 16:34:33 +00:00
|
|
|
//
|
2020-06-21 12:25:28 +00:00
|
|
|
// Functions specifically for scraping from screenscraper.fr
|
|
|
|
// Called from Scraper.
|
2020-05-26 16:34:33 +00:00
|
|
|
//
|
|
|
|
|
2019-01-11 19:51:05 +00:00
|
|
|
#pragma once
|
|
|
|
#ifndef ES_APP_SCRAPERS_SCREEN_SCRAPER_H
|
|
|
|
#define ES_APP_SCRAPERS_SCREEN_SCRAPER_H
|
|
|
|
|
|
|
|
#include "scrapers/Scraper.h"
|
|
|
|
#include "EmulationStation.h"
|
|
|
|
|
|
|
|
namespace pugi { class xml_document; }
|
|
|
|
|
2020-05-26 16:34:33 +00:00
|
|
|
void screenscraper_generate_scraper_requests(
|
2020-06-21 12:25:28 +00:00
|
|
|
const ScraperSearchParams& params,
|
|
|
|
std::queue< std::unique_ptr<ScraperRequest> >& requests,
|
|
|
|
std::vector<ScraperSearchResult>& results);
|
2019-01-11 19:51:05 +00:00
|
|
|
|
|
|
|
class ScreenScraperRequest : public ScraperHttpRequest
|
|
|
|
{
|
|
|
|
public:
|
2020-06-21 12:25:28 +00:00
|
|
|
// ctor for a GetGameList request.
|
|
|
|
ScreenScraperRequest(std::queue< std::unique_ptr<ScraperRequest> >& requestsWrite,
|
|
|
|
std::vector<ScraperSearchResult>& resultsWrite,
|
|
|
|
const std::string& url) : ScraperHttpRequest(resultsWrite, url),
|
|
|
|
mRequestQueue(&requestsWrite) {}
|
|
|
|
|
|
|
|
// ctor for a GetGame request.
|
|
|
|
ScreenScraperRequest(std::vector<ScraperSearchResult>& resultsWrite,
|
|
|
|
const std::string& url) : ScraperHttpRequest(resultsWrite, url),
|
|
|
|
mRequestQueue(nullptr) {}
|
|
|
|
|
|
|
|
// Settings for the scraper.
|
|
|
|
static const struct ScreenScraperConfig {
|
|
|
|
std::string getGameSearchUrl(const std::string gameName) const;
|
|
|
|
|
|
|
|
// Access to the API.
|
|
|
|
const std::string API_DEV_U =
|
|
|
|
{ 91, 32, 7, 17 };
|
|
|
|
const std::string API_DEV_P =
|
|
|
|
{ 108, 28, 54, 55, 83, 43, 91, 44, 30, 22, 41, 12, 0, 108, 38, 29 };
|
|
|
|
const std::string API_DEV_KEY =
|
|
|
|
{ 54, 73, 115, 100, 101, 67, 111, 107, 79, 66, 68, 66, 67, 56, 118, 77, 54, 88, 101, 54 };
|
|
|
|
const std::string API_URL_BASE = "https://www.screenscraper.fr/api2";
|
2020-08-05 20:38:44 +00:00
|
|
|
const std::string API_SOFT_NAME = "EmulationStation-DE " +
|
2020-06-21 12:25:28 +00:00
|
|
|
static_cast<std::string>(PROGRAM_VERSION_STRING);
|
|
|
|
|
|
|
|
// Which type of image artwork we need. Possible values (not a comprehensive list):
|
|
|
|
// - ss: in-game screenshot
|
|
|
|
// - box-3D: 3D boxart
|
|
|
|
// - box-2D: 2D boxart (default)
|
|
|
|
// - screenmarque : marquee
|
|
|
|
// - sstitle: in-game start screenshot
|
|
|
|
// - steamgrid: Steam artwork
|
|
|
|
// - wheel: spine
|
|
|
|
// - support-2D: media showing the 2d boxart on the cart
|
|
|
|
// - support-3D: media showing the 3d boxart on the cart
|
2020-08-05 20:38:44 +00:00
|
|
|
// - video: gameplay videos
|
|
|
|
// - video-normalized: gameplay videos in smaller file sizes with lower audio quality
|
2020-06-21 12:25:28 +00:00
|
|
|
//
|
2020-08-05 20:38:44 +00:00
|
|
|
// Note that not all games contain values for all these, so we default to "ss".
|
2020-06-21 12:25:28 +00:00
|
|
|
//
|
|
|
|
|
|
|
|
std::string media_3dbox = "box-3D";
|
|
|
|
std::string media_cover = "box-2D";
|
|
|
|
std::string media_marquee = "wheel";
|
|
|
|
std::string media_screenshot = "ss";
|
2020-08-05 20:38:44 +00:00
|
|
|
std::string media_video = "video";
|
2020-06-21 12:25:28 +00:00
|
|
|
|
|
|
|
// Which Region to use when selecting the artwork.
|
|
|
|
// Applies to: artwork, name of the game, date of release.
|
|
|
|
// This is read from es_settings.cfg, setting 'ScraperRegion'.
|
|
|
|
|
|
|
|
// Which Language to use when selecting the textual information.
|
|
|
|
// Applies to: description, genre.
|
|
|
|
// This is read from es_settings.cfg, setting 'ScraperLanguage'.
|
|
|
|
|
|
|
|
ScreenScraperConfig() {};
|
|
|
|
} configuration;
|
2019-01-11 19:51:05 +00:00
|
|
|
|
|
|
|
protected:
|
2020-06-21 12:25:28 +00:00
|
|
|
void process(const std::unique_ptr<HttpReq>& req,
|
|
|
|
std::vector<ScraperSearchResult>& results) override;
|
|
|
|
|
|
|
|
void processList(const pugi::xml_document& xmldoc, std::vector<ScraperSearchResult>& results);
|
|
|
|
void processGame(const pugi::xml_document& xmldoc, std::vector<ScraperSearchResult>& results);
|
|
|
|
void processMedia(ScraperSearchResult& result,
|
|
|
|
const pugi::xml_node& media_list,
|
|
|
|
std::string mediaType,
|
|
|
|
std::string& fileURL,
|
|
|
|
std::string& fileFormat,
|
|
|
|
std::string region);
|
|
|
|
bool isGameRequest() { return !mRequestQueue; }
|
|
|
|
|
|
|
|
std::queue< std::unique_ptr<ScraperRequest> >* mRequestQueue;
|
2019-01-11 19:51:05 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // ES_APP_SCRAPERS_SCREEN_SCRAPER_H
|