From fa1754f70bb8f0d2d61a3c80fda93bda522853a9 Mon Sep 17 00:00:00 2001 From: "Casper V. Kristensen" Date: Sat, 11 Feb 2023 01:15:58 +0100 Subject: [PATCH] gog.com/game/ -> gog.com/en/game/ --- dailyreleases/stores/gog.py | 2 +- tests/test_parse_dirname.py | 21 +++++++++++---------- 2 files changed, 12 insertions(+), 11 deletions(-) diff --git a/dailyreleases/stores/gog.py b/dailyreleases/stores/gog.py index 71b7612..dd064b2 100644 --- a/dailyreleases/stores/gog.py +++ b/dailyreleases/stores/gog.py @@ -21,7 +21,7 @@ def search(query: str) -> Optional[str]: util.case_insensitive_close_matches(query, products, n=1, cutoff=0.90)[0] ] logger.debug("Best match is '%s'", best_match) - return "https://gog.com{url}".format(**best_match) + return "https://www.gog.com/en/game/{slug}".format(**best_match) except IndexError: logger.debug("Unable to find %s in GOG search results", query) return None diff --git a/tests/test_parse_dirname.py b/tests/test_parse_dirname.py index 3e03286..dc2be6c 100644 --- a/tests/test_parse_dirname.py +++ b/tests/test_parse_dirname.py @@ -74,19 +74,19 @@ class ParseDirnameTestCase(unittest.TestCase): self.assertEqual(Platform.OSX, r.platform) self.assertEqual(ReleaseType.GAME, r.type) self.assertIn("store.steampowered.com/app/510490", r.store_links["Steam"]) - self.assertIn("gog.com/game/the_fall_part_2_unbound", r.store_links["GOG"]) + self.assertIn("gog.com/en/game/the_fall_part_2_unbound", r.store_links["GOG"]) def test_macosx_update(self): pre = Pre( - "Man_O_War_Corsair_Warhammer_Naval_Battles_v1.3.2_MacOSX-Razor1911", + "Cult_of_the_Lamb_v1.1.3_MacOS-Razor1911", "nfo_link", datetime.utcnow(), ) r = parsing.parse_pre(pre) self.assertEqual(Platform.OSX, r.platform) self.assertEqual(ReleaseType.UPDATE, r.type) - self.assertIn("store.steampowered.com/app/344240", r.store_links["Steam"]) - self.assertIn("gog.com/game/man_o_war_corsair", r.store_links["GOG"]) + self.assertIn("store.steampowered.com/app/1313140", r.store_links["Steam"]) + self.assertIn("gog.com/en/game/cult_of_the_lamb", r.store_links["GOG"]) def test_linux_release(self): pre = Pre( @@ -96,7 +96,7 @@ class ParseDirnameTestCase(unittest.TestCase): self.assertEqual(Platform.LINUX, r.platform) self.assertEqual(ReleaseType.GAME, r.type) self.assertIn("store.steampowered.com/app/606710", r.store_links["Steam"]) - self.assertIn("gog.com/game/sphinx_and_the_cursed_mummy", r.store_links["GOG"]) + self.assertIn("gog.com/en/game/sphinx_and_the_cursed_mummy", r.store_links["GOG"]) def test_dlc_explicit(self): pre = Pre("Fallout.4.Far.Harbor.DLC-CODEX", "nfo_link", datetime.utcnow()) @@ -145,20 +145,21 @@ class ParseDirnameTestCase(unittest.TestCase): self.assertEqual(-1, r.num_reviews) def test_gog_exclusive(self): + # https://www.gog.com/en/games?tags=only-on-gog # TODO: Actually use GOG API (gog.update_info) pre = Pre( - "Dungeons.and.Dragons.Dragonshard.v2.0.0.10.Multilingual-DELiGHT", + "SimCity.3000.Unlimited.v2.0.0.10.Multilingual-DELiGHT", "nfo_link", datetime.utcnow(), ) r = parsing.parse_pre(pre) - self.assertIn("gog.com/game/dungeons_dragons_dragonshard", r.store_links["GOG"]) + self.assertIn("www.gog.com/en/game/simcity_3000", r.store_links["GOG"]) self.assertEqual(-1, r.score) def test_gog_exclusive2(self): - pre = Pre("Diablo.GOG.Classic-KaliMaaShaktiDe", "nfo_link", datetime.utcnow()) + pre = Pre("Europa.Universalis.II-KaliMaaShaktiDe", "nfo_link", datetime.utcnow()) r = parsing.parse_pre(pre) - self.assertIn("gog.com/game/diablo", r.store_links["GOG"]) + self.assertIn("gog.com/en/game/europa_universalis_ii", r.store_links["GOG"]) def test_epic_games_exclusive(self): pre = Pre("Vampire_The_Masquerade_Swansong-Razor1911", "nfo_link", datetime.utcnow()) @@ -179,7 +180,7 @@ class ParseDirnameTestCase(unittest.TestCase): datetime.utcnow(), ) r = parsing.parse_pre(pre) - self.assertIn("gog.com/game/curious_expedition_the", r.store_links["GOG"]) + self.assertIn("store.steampowered.com/app/358130", r.store_links["Steam"]) self.assertEqual(["MULTI.7", "RIP"], r.tags) def test_steam_package(self):