From 92b41b02025fe0616e124b2d4a8cde8a2e23fa9c Mon Sep 17 00:00:00 2001 From: "Casper V. Kristensen" Date: Fri, 7 Jun 2019 21:17:28 +0200 Subject: [PATCH] Add Epic Games Store. --- dailyreleases/stores/__init__.py | 3 ++- tests/test_parse_dirname.py | 5 +++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/dailyreleases/stores/__init__.py b/dailyreleases/stores/__init__.py index 21b7148..d50d3bd 100644 --- a/dailyreleases/stores/__init__.py +++ b/dailyreleases/stores/__init__.py @@ -25,6 +25,7 @@ def find_store_links(game_name: str) -> Dict[str, str]: "origin.com": "Origin", "ubi(soft)?.com": "Ubisoft", "www.microsoft.com/.*p": "Microsoft Store", + "epicgames.com/store": "Epic Games", "itch.io": "Itch.io", "bigfishgames.com/games": "Big Fish Games", "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 - 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(): if re.search(store_url, link, flags=re.IGNORECASE): return {store_name: link} diff --git a/tests/test_parse_dirname.py b/tests/test_parse_dirname.py index cb52b0c..067622d 100644 --- a/tests/test_parse_dirname.py +++ b/tests/test_parse_dirname.py @@ -129,6 +129,11 @@ class ParseDirnameTestCase(unittest.TestCase): r = parsing.parse_pre(pre) 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): pre = Pre("Ode.RIP.MULTI12-SiMPLEX", "nfo_link", datetime.utcnow()) r = parsing.parse_pre(pre)