mirror of
https://github.com/RetroDECK/ES-DE.git
synced 2025-04-10 19:15:13 +00:00
Moved some data and functions from the global to anonymous namespace.
This commit is contained in:
parent
187115a9e6
commit
fa17d8df66
|
@ -36,9 +36,8 @@ using namespace rapidjson;
|
|||
namespace
|
||||
{
|
||||
TheGamesDBJSONRequestResources resources;
|
||||
}
|
||||
|
||||
const std::map<PlatformId, std::string> gamesdb_new_platformid_map{
|
||||
const std::map<PlatformId, std::string> gamesdb_new_platformid_map{
|
||||
{THREEDO, "25"},
|
||||
{COMMODORE_AMIGA, "4911"},
|
||||
{COMMODORE_AMIGA_CD32, "4947"},
|
||||
|
@ -124,8 +123,9 @@ const std::map<PlatformId, std::string> gamesdb_new_platformid_map{
|
|||
{VIDEOPAC_ODYSSEY2, "4927"},
|
||||
{VECTREX, "4939"},
|
||||
{TANDY_COLOR_COMPUTER, "4941"},
|
||||
{TANDY_TRS80, "4941"},
|
||||
};
|
||||
{TANDY_TRS80, "4941"}};
|
||||
|
||||
} // namespace
|
||||
|
||||
void thegamesdb_generate_json_scraper_requests(
|
||||
const ScraperSearchParams& params,
|
||||
|
|
|
@ -26,9 +26,12 @@
|
|||
#include <cmath>
|
||||
#include <fstream>
|
||||
|
||||
const std::map<std::string, generate_scraper_requests_func> scraper_request_funcs{
|
||||
namespace
|
||||
{
|
||||
const std::map<std::string, generate_scraper_requests_func> scraper_request_funcs{
|
||||
{"thegamesdb", &thegamesdb_generate_json_scraper_requests},
|
||||
{"screenscraper", &screenscraper_generate_scraper_requests}};
|
||||
}
|
||||
|
||||
std::unique_ptr<ScraperSearchHandle> startScraperSearch(const ScraperSearchParams& params)
|
||||
{
|
||||
|
|
|
@ -23,9 +23,11 @@
|
|||
|
||||
using namespace PlatformIds;
|
||||
|
||||
// List of systems and their IDs from:
|
||||
// https://www.screenscraper.fr/api/systemesListe.php?devid=xxx&devpassword=yyy&softname=zzz&output=XML
|
||||
const std::map<PlatformId, unsigned short> screenscraper_platformid_map{
|
||||
namespace
|
||||
{
|
||||
// List of systems and their IDs from:
|
||||
// https://www.screenscraper.fr/api/systemesListe.php?devid=xxx&devpassword=yyy&softname=zzz&output=XML
|
||||
const std::map<PlatformId, unsigned short> screenscraper_platformid_map{
|
||||
{THREEDO, 29},
|
||||
{COMMODORE_AMIGA, 64},
|
||||
{COMMODORE_AMIGA_CD32, 130},
|
||||
|
@ -131,29 +133,28 @@ const std::map<PlatformId, unsigned short> screenscraper_platformid_map{
|
|||
{SPECTRAVIDEO, 218},
|
||||
{PALM_OS, 219}};
|
||||
|
||||
// Helper XML parsing method, finding a node-by-name recursively.
|
||||
pugi::xml_node find_node_by_name_re(const pugi::xml_node& node,
|
||||
const std::vector<std::string> node_names)
|
||||
{
|
||||
// Helper XML parsing method, finding a node-by-name recursively. Not currently used.
|
||||
// pugi::xml_node find_node_by_name_re(const pugi::xml_node& node,
|
||||
// const std::vector<std::string> node_names)
|
||||
// {
|
||||
// for (const std::string& _val : node_names) {
|
||||
// pugi::xpath_query query_node_name((static_cast<std::string>("//") +
|
||||
// _val).c_str()); pugi::xpath_node_set results = node.select_nodes(query_node_name);
|
||||
//
|
||||
// if (results.size() > 0)
|
||||
// return results.first().node();
|
||||
// }
|
||||
//
|
||||
// return pugi::xml_node();
|
||||
// }
|
||||
|
||||
for (const std::string& _val : node_names) {
|
||||
pugi::xpath_query query_node_name((static_cast<std::string>("//") + _val).c_str());
|
||||
pugi::xpath_node_set results = node.select_nodes(query_node_name);
|
||||
|
||||
if (results.size() > 0)
|
||||
return results.first().node();
|
||||
}
|
||||
|
||||
return pugi::xml_node();
|
||||
}
|
||||
|
||||
// Help XML parsing method, finding an direct child XML node starting from the parent and
|
||||
// filtering by an attribute value list.
|
||||
pugi::xml_node find_child_by_attribute_list(const pugi::xml_node& node_parent,
|
||||
// Help XML parsing method, finding an direct child XML node starting from the parent and
|
||||
// filtering by an attribute value list.
|
||||
pugi::xml_node find_child_by_attribute_list(const pugi::xml_node& node_parent,
|
||||
const std::string& node_name,
|
||||
const std::string& attribute_name,
|
||||
const std::vector<std::string> attribute_values)
|
||||
{
|
||||
{
|
||||
for (auto _val : attribute_values) {
|
||||
for (pugi::xml_node node : node_parent.children(node_name.c_str())) {
|
||||
if (node.attribute(attribute_name.c_str()).value() == _val)
|
||||
|
@ -162,7 +163,9 @@ pugi::xml_node find_child_by_attribute_list(const pugi::xml_node& node_parent,
|
|||
}
|
||||
|
||||
return pugi::xml_node(nullptr);
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
void screenscraper_generate_scraper_requests(const ScraperSearchParams& params,
|
||||
std::queue<std::unique_ptr<ScraperRequest>>& requests,
|
||||
|
|
Loading…
Reference in a new issue