Skip to content

Commit

Permalink
Version 2.7.1 (#85)
Browse files Browse the repository at this point in the history
- Updated to support GOG Galaxy 1.2.x.
  • Loading branch information
Kapiainen authored May 29, 2017
1 parent e2209b2 commit 998bfac
Show file tree
Hide file tree
Showing 4 changed files with 60 additions and 16 deletions.
69 changes: 55 additions & 14 deletions Lauhdutin/@Resources/Backend/GOGGalaxy.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 = []

Expand All @@ -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)
Expand Down Expand Up @@ -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")
Expand All @@ -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
2 changes: 1 addition & 1 deletion Lauhdutin/Main.ini
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down
2 changes: 1 addition & 1 deletion Lauhdutin/Settings.ini
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down
3 changes: 3 additions & 0 deletions Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit 998bfac

Please sign in to comment.