1
0
Fork 0

Add Epic Games Store.

This commit is contained in:
Casper V. Kristensen 2019-06-07 21:17:28 +02:00
parent 6cd8e69f3f
commit 92b41b0202
Signed by: caspervk
GPG key ID: 289CA03790535054
2 changed files with 7 additions and 1 deletions

View file

@ -25,6 +25,7 @@ def find_store_links(game_name: str) -> Dict[str, str]:
"origin.com": "Origin", "origin.com": "Origin",
"ubi(soft)?.com": "Ubisoft", "ubi(soft)?.com": "Ubisoft",
"www.microsoft.com/.*p": "Microsoft Store", "www.microsoft.com/.*p": "Microsoft Store",
"epicgames.com/store": "Epic Games",
"itch.io": "Itch.io", "itch.io": "Itch.io",
"bigfishgames.com/games": "Big Fish Games", "bigfishgames.com/games": "Big Fish Games",
"gamejolt.com": "Game Jolt", "gamejolt.com": "Game Jolt",
@ -33,7 +34,7 @@ def find_store_links(game_name: str) -> Dict[str, str]:
} }
# Multiple store links are sometimes returned, but we believe in Google's algorithm and choose the first one # Multiple store links are sometimes returned, but we believe in Google's algorithm and choose the first one
for link in web_search(f"{game_name} buy"): for link in web_search(f"{game_name} game buy"):
for store_url, store_name in known_stores.items(): for store_url, store_name in known_stores.items():
if re.search(store_url, link, flags=re.IGNORECASE): if re.search(store_url, link, flags=re.IGNORECASE):
return {store_name: link} return {store_name: link}

View file

@ -129,6 +129,11 @@ class ParseDirnameTestCase(unittest.TestCase):
r = parsing.parse_pre(pre) r = parsing.parse_pre(pre)
self.assertIn("gog.com/game/diablo", r.store_links["GOG"]) self.assertIn("gog.com/game/diablo", r.store_links["GOG"])
def test_epic_games_exclusive(self):
pre = Pre("Journey-CODEX", "nfo_link", datetime.utcnow())
r = parsing.parse_pre(pre)
self.assertIn("epicgames.com/store/en-US/product/journey", r.store_links["Epic Games"])
def test_score_non_steam(self): def test_score_non_steam(self):
pre = Pre("Ode.RIP.MULTI12-SiMPLEX", "nfo_link", datetime.utcnow()) pre = Pre("Ode.RIP.MULTI12-SiMPLEX", "nfo_link", datetime.utcnow())
r = parsing.parse_pre(pre) r = parsing.parse_pre(pre)