From 998bfac4c02fc404614fb96c215bbe45bc8aca01 Mon Sep 17 00:00:00 2001 From: Kapiainen Date: Mon, 29 May 2017 11:09:15 +0300 Subject: [PATCH] Version 2.7.1 (#85) - Updated to support GOG Galaxy 1.2.x. --- Lauhdutin/@Resources/Backend/GOGGalaxy.py | 69 ++++++++++++++++++----- Lauhdutin/Main.ini | 2 +- Lauhdutin/Settings.ini | 2 +- Readme.md | 3 + 4 files changed, 60 insertions(+), 16 deletions(-) diff --git a/Lauhdutin/@Resources/Backend/GOGGalaxy.py b/Lauhdutin/@Resources/Backend/GOGGalaxy.py index d0cc6ea..5dc5dd7 100644 --- a/Lauhdutin/@Resources/Backend/GOGGalaxy.py +++ b/Lauhdutin/@Resources/Backend/GOGGalaxy.py @@ -9,10 +9,12 @@ class GOGGalaxy: def __init__(self, asPath): self.indexDB = os.path.join(asPath, "storage", "index.db") + self.galaxyDB = os.path.join(asPath, "storage", "galaxy.db") self.productdetailsDB = os.path.join(asPath, "storage", "productdetails.db") self.result = {} self.index = {} + self.galaxy = {} self.productdetails = {} self.values = [] @@ -30,6 +32,9 @@ def set_index_entry(self, key, value): def set_productdetails_entry(self, key, value): self.productdetails[key] = value + def set_galaxy_entry(self, key, value): + self.galaxy[key] = value + def get_value(self): if len(self.values) > 0: return self.values.pop(0) @@ -88,14 +93,33 @@ def process_productdetails_database(self): self.set_productdetails_entry(value[0], game) value = self.get_value() + def process_galaxy_database(self): + value = self.get_value() + while value: + if self.result_has(str(value[1])): + images = json.loads(value[7]) + game = {} + game[GameKeys.NAME] = Utility.title_move_the( + Utility.title_strip_unicode(value[5])) + print("\t\tGetting info about '%s'" % game[GameKeys.NAME]) + banner_url = images["logo"].replace("\/", "/") + banner_extension = banner_url[-4:] + banner_url = banner_url[:-4] + banner_url = "%s_392%s" % (banner_url[:-9], + banner_extension) + game[GameKeys.BANNER_URL] = banner_url + game[GameKeys.BANNER_PATH] = "GOG Galaxy\\%s%s" % (value[1], banner_extension) + self.set_galaxy_entry(str(value[1]), game) + value = self.get_value() + def get_games(self): self.result = {} self.index = {} self.productdetails = {} - if (not os.path.isfile(self.indexDB) or - not os.path.isfile(self.productdetailsDB)): - return self.result - print("\tConnecting to index database...") + if not os.path.isfile(self.indexDB): + print("\t'%s' does not exist..." % self.indexDB) + return {} + print("\tConnecting to 'index.db'...") con = sqlite3.connect(self.indexDB) cur = con.cursor() cur.execute("SELECT * FROM Products") @@ -105,14 +129,31 @@ def get_games(self): for gameID, gameDict in self.index.items(): for key, value in gameDict.items(): self.result[gameID][key] = value - print("\tConnecting to product details database...") - con = sqlite3.connect(self.productdetailsDB) - cur = con.cursor() - cur.execute("SELECT * FROM ProductDetails") - self.values = cur.fetchall() - con.close() - self.process_productdetails_database() - for gameID, gameDict in self.productdetails.items(): - for key, value in gameDict.items(): - self.result[gameID][key] = value + if os.path.isfile(self.galaxyDB): + print("\tConnecting to 'galaxy.db'...") + con = sqlite3.connect(self.galaxyDB) + cur = con.cursor() + cur.execute("SELECT * FROM LimitedDetails") + self.values = cur.fetchall() + con.close() + self.process_galaxy_database() + for gameID, gameDict in self.galaxy.items(): + for key, value in gameDict.items(): + self.result[gameID][key] = value + else: + print("\t'%s' does not exist..." % self.galaxyDB) + if os.path.isfile(self.productdetailsDB): + print("\tConnecting to 'productdetails.db'...") + con = sqlite3.connect(self.productdetailsDB) + cur = con.cursor() + cur.execute("SELECT * FROM ProductDetails") + self.values = cur.fetchall() + con.close() + self.process_productdetails_database() + for gameID, gameDict in self.productdetails.items(): + for key, value in gameDict.items(): + self.result[gameID][key] = value + else: + print("\t'%s' does not exist..." % self.productdetailsDB) + return {} return self.result diff --git a/Lauhdutin/Main.ini b/Lauhdutin/Main.ini index 8e3d3ec..b3db301 100644 --- a/Lauhdutin/Main.ini +++ b/Lauhdutin/Main.ini @@ -2,7 +2,7 @@ Name=Lauhdutin Author=Kapiainen Information=A Rainmeter skin for launching games. -Version=2.7.0 +Version=2.7.1 License=MIT [Rainmeter] diff --git a/Lauhdutin/Settings.ini b/Lauhdutin/Settings.ini index e992dc1..5aeb1dd 100644 --- a/Lauhdutin/Settings.ini +++ b/Lauhdutin/Settings.ini @@ -2,7 +2,7 @@ Name=Lauhdutin settings Author=Kapiainen Information=A Rainmeter skin for launching games. -Version=2.7.0 +Version=2.7.1 License=MIT [Rainmeter] diff --git a/Readme.md b/Readme.md index d55d8fa..3842eba 100644 --- a/Readme.md +++ b/Readme.md @@ -271,6 +271,9 @@ There are a few rules that **must** be followed when adding support for addition Any deviations from the rules regarding adding platform support will most likely result in a rejected pull request. # Changelog +**Version 2.7.1 - 2017/05/29:** +- Updated to support GOG Galaxy 1.2.x. + **Version 2.7.0 - 2017/05/15:** - Major GUI overhaul and optimizations. - Added support for multiple rows/columns of slots.