2020-09-21 17:17:34 +00:00
|
|
|
// SPDX-License-Identifier: MIT
|
2020-05-26 16:34:33 +00:00
|
|
|
//
|
2020-09-21 17:17:34 +00:00
|
|
|
// EmulationStation Desktop Edition
|
2020-06-21 12:25:28 +00:00
|
|
|
// GamesDBJSONScraper.h
|
2020-05-26 16:34:33 +00:00
|
|
|
//
|
2020-06-21 12:25:28 +00:00
|
|
|
// Functions specifically for scraping from thegamesdb.net
|
|
|
|
// Called from Scraper.
|
2020-05-26 16:34:33 +00:00
|
|
|
//
|
|
|
|
|
2019-02-08 02:08:11 +00:00
|
|
|
#ifndef ES_APP_SCRAPERS_GAMES_DB_JSON_SCRAPER_H
|
|
|
|
#define ES_APP_SCRAPERS_GAMES_DB_JSON_SCRAPER_H
|
|
|
|
|
|
|
|
#include "scrapers/Scraper.h"
|
|
|
|
|
2020-05-26 16:34:33 +00:00
|
|
|
namespace pugi {
|
2019-02-08 02:08:11 +00:00
|
|
|
class xml_document;
|
|
|
|
}
|
|
|
|
|
2020-05-26 16:34:33 +00:00
|
|
|
void thegamesdb_generate_json_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-02-08 02:08:11 +00:00
|
|
|
|
2020-06-06 11:10:33 +00:00
|
|
|
void thegamesdb_generate_json_scraper_requests(
|
2020-06-21 12:25:28 +00:00
|
|
|
const std::string& gameIDs,
|
|
|
|
std::queue<std::unique_ptr<ScraperRequest>>& requests,
|
|
|
|
std::vector<ScraperSearchResult>& results);
|
2020-06-06 11:10:33 +00:00
|
|
|
|
2019-02-08 02:08:11 +00:00
|
|
|
class TheGamesDBJSONRequest : public ScraperHttpRequest
|
|
|
|
{
|
|
|
|
public:
|
2020-06-21 12:25:28 +00:00
|
|
|
// ctor for a GetGameList request.
|
|
|
|
TheGamesDBJSONRequest(
|
|
|
|
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
|
|
|
|
TheGamesDBJSONRequest(
|
|
|
|
std::vector<ScraperSearchResult>& resultsWrite,
|
|
|
|
const std::string& url)
|
|
|
|
: ScraperHttpRequest(resultsWrite, url),
|
|
|
|
mRequestQueue(nullptr)
|
|
|
|
{
|
|
|
|
}
|
2019-02-08 02:08:11 +00:00
|
|
|
|
|
|
|
protected:
|
2020-06-21 12:25:28 +00:00
|
|
|
//void retrieveMediaURLs()
|
2020-06-06 11:10:33 +00:00
|
|
|
|
2020-06-21 12:25:28 +00:00
|
|
|
void process(const std::unique_ptr<HttpReq>& req,
|
|
|
|
std::vector<ScraperSearchResult>& results) override;
|
|
|
|
bool isGameRequest() { return !mRequestQueue; }
|
2019-02-08 02:08:11 +00:00
|
|
|
|
2020-06-21 12:25:28 +00:00
|
|
|
std::queue<std::unique_ptr<ScraperRequest>>* mRequestQueue;
|
2019-02-08 02:08:11 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // ES_APP_SCRAPERS_GAMES_DB_JSON_SCRAPER_H
|