1
0
Fork 0

gog.com/game/ -> gog.com/en/game/

This commit is contained in:
Casper V. Kristensen 2023-02-11 01:15:58 +01:00
parent 2ba7cc0367
commit fa1754f70b
2 changed files with 12 additions and 11 deletions

View file

@ -21,7 +21,7 @@ def search(query: str) -> Optional[str]:
util.case_insensitive_close_matches(query, products, n=1, cutoff=0.90)[0] util.case_insensitive_close_matches(query, products, n=1, cutoff=0.90)[0]
] ]
logger.debug("Best match is '%s'", best_match) 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: except IndexError:
logger.debug("Unable to find %s in GOG search results", query) logger.debug("Unable to find %s in GOG search results", query)
return None return None

View file

@ -74,19 +74,19 @@ class ParseDirnameTestCase(unittest.TestCase):
self.assertEqual(Platform.OSX, r.platform) self.assertEqual(Platform.OSX, r.platform)
self.assertEqual(ReleaseType.GAME, r.type) self.assertEqual(ReleaseType.GAME, r.type)
self.assertIn("store.steampowered.com/app/510490", r.store_links["Steam"]) 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): def test_macosx_update(self):
pre = Pre( 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", "nfo_link",
datetime.utcnow(), datetime.utcnow(),
) )
r = parsing.parse_pre(pre) r = parsing.parse_pre(pre)
self.assertEqual(Platform.OSX, r.platform) self.assertEqual(Platform.OSX, r.platform)
self.assertEqual(ReleaseType.UPDATE, r.type) self.assertEqual(ReleaseType.UPDATE, r.type)
self.assertIn("store.steampowered.com/app/344240", r.store_links["Steam"]) self.assertIn("store.steampowered.com/app/1313140", r.store_links["Steam"])
self.assertIn("gog.com/game/man_o_war_corsair", r.store_links["GOG"]) self.assertIn("gog.com/en/game/cult_of_the_lamb", r.store_links["GOG"])
def test_linux_release(self): def test_linux_release(self):
pre = Pre( pre = Pre(
@ -96,7 +96,7 @@ class ParseDirnameTestCase(unittest.TestCase):
self.assertEqual(Platform.LINUX, r.platform) self.assertEqual(Platform.LINUX, r.platform)
self.assertEqual(ReleaseType.GAME, r.type) self.assertEqual(ReleaseType.GAME, r.type)
self.assertIn("store.steampowered.com/app/606710", r.store_links["Steam"]) 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): def test_dlc_explicit(self):
pre = Pre("Fallout.4.Far.Harbor.DLC-CODEX", "nfo_link", datetime.utcnow()) 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) self.assertEqual(-1, r.num_reviews)
def test_gog_exclusive(self): def test_gog_exclusive(self):
# https://www.gog.com/en/games?tags=only-on-gog
# TODO: Actually use GOG API (gog.update_info) # TODO: Actually use GOG API (gog.update_info)
pre = Pre( pre = Pre(
"Dungeons.and.Dragons.Dragonshard.v2.0.0.10.Multilingual-DELiGHT", "SimCity.3000.Unlimited.v2.0.0.10.Multilingual-DELiGHT",
"nfo_link", "nfo_link",
datetime.utcnow(), datetime.utcnow(),
) )
r = parsing.parse_pre(pre) 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) self.assertEqual(-1, r.score)
def test_gog_exclusive2(self): 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) 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): def test_epic_games_exclusive(self):
pre = Pre("Vampire_The_Masquerade_Swansong-Razor1911", "nfo_link", datetime.utcnow()) pre = Pre("Vampire_The_Masquerade_Swansong-Razor1911", "nfo_link", datetime.utcnow())
@ -179,7 +180,7 @@ class ParseDirnameTestCase(unittest.TestCase):
datetime.utcnow(), datetime.utcnow(),
) )
r = parsing.parse_pre(pre) 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) self.assertEqual(["MULTI.7", "RIP"], r.tags)
def test_steam_package(self): def test_steam_package(self):