diff --git a/src/GameData.cpp b/src/GameData.cpp index 976d3e058..d6f11ca3e 100644 --- a/src/GameData.cpp +++ b/src/GameData.cpp @@ -1,5 +1,6 @@ #include "GameData.h" #include +#include #include #include #include @@ -57,6 +58,11 @@ std::string GameData::getBaseName() const return mBaseName; } +std::string GameData::getCleanName() const +{ + return regex_replace(mBaseName, boost::regex("\\((.*)\\)|\\[(.*)\\]"), ""); +} + void GameData::incTimesPlayed() { int timesPlayed = metadata()->getInt("playcount"); diff --git a/src/GameData.h b/src/GameData.h index e67ec2e1d..6f40c798b 100644 --- a/src/GameData.h +++ b/src/GameData.h @@ -21,6 +21,7 @@ public: std::string getBashPath() const; std::string getBaseName() const; + std::string getCleanName() const; bool isFolder() const override; diff --git a/src/components/GuiGameScraper.cpp b/src/components/GuiGameScraper.cpp index e15eab576..701cafb95 100644 --- a/src/components/GuiGameScraper.cpp +++ b/src/components/GuiGameScraper.cpp @@ -69,7 +69,7 @@ GuiGameScraper::GuiGameScraper(Window* window, ScraperSearchParams params, std:: //y = 3 is a spacer row mList.setEntry(Vector2i(0, 4), Vector2i(1, 1), &mSearchLabel, false, ComponentListComponent::AlignLeft); - mSearchText.setValue(!params.nameOverride.empty() ? params.nameOverride : params.game->getBaseName()); + mSearchText.setValue(!params.nameOverride.empty() ? params.nameOverride : params.game->getCleanName()); mSearchText.setSize(colWidth * 2 - mSearchLabel.getSize().x() - 20, mSearchText.getSize().y()); mList.setEntry(Vector2i(1, 4), Vector2i(1, 1), &mSearchText, true, ComponentListComponent::AlignRight); diff --git a/src/scrapers/GamesDBScraper.cpp b/src/scrapers/GamesDBScraper.cpp index a0cb66915..fc018493c 100644 --- a/src/scrapers/GamesDBScraper.cpp +++ b/src/scrapers/GamesDBScraper.cpp @@ -18,7 +18,7 @@ std::shared_ptr GamesDBScraper::makeHttpReq(ScraperSearchParams params) std::string cleanName = params.nameOverride; if(cleanName.empty()) - cleanName = params.game->getBaseName(); + cleanName = params.game->getCleanName(); path += "name=" + cleanName; //platform TODO, should use some params.system get method