[game-data-packager] 04/04: GOG: don't require innoextract for games with Linux package

Alexandre Detiste detiste-guest at moszumanska.debian.org
Thu Sep 17 08:10:14 UTC 2015


This is an automated email from the git hooks/post-receive script.

detiste-guest pushed a commit to branch master
in repository game-data-packager.

commit f12e2d8028d2d171a597f606f6dee2cfdda1a8c8
Author: Alexandre Detiste <alexandre.detiste at gmail.com>
Date:   Thu Sep 17 10:08:54 2015 +0200

    GOG: don't require innoextract for games with Linux package
---
 game_data_packager/__init__.py | 15 +++++++++------
 game_data_packager/gog.py      | 14 ++++++++++++++
 2 files changed, 23 insertions(+), 6 deletions(-)

diff --git a/game_data_packager/__init__.py b/game_data_packager/__init__.py
index 2e099ad..4127cfa 100644
--- a/game_data_packager/__init__.py
+++ b/game_data_packager/__init__.py
@@ -2707,13 +2707,16 @@ class GameData(object):
                 possible.add(package)
             # download game if it is already owned by user's GOG.com account
             # user must have used 'lgogdownloader' at least once to make this work
-            elif gog_id and which('innoextract') and gog_id in GOG.owned_games():
-                if lang_score(package.lang) == 0:
-                    logger.debug('%s can be downloaded with lgogdownloader', package.name)
+            elif gog_id and gog_id in GOG.owned_games():
+                if which('innoextract') or GOG.is_native(gog_id):
+                    if lang_score(package.lang) == 0:
+                        logger.debug('%s can be downloaded with lgogdownloader', package.name)
+                    else:
+                        logger.info('%s can be downloaded with lgogdownloader', package.name)
+                    possible.add(package)
+                    possible_with_lgogdownloader.add(package.name)
                 else:
-                    logger.info('%s can be downloaded with lgogdownloader', package.name)
-                possible.add(package)
-                possible_with_lgogdownloader.add(package.name)
+                    self.missing_tools.add('innoextract')
             else:
                 logger.debug('%s is impossible', package.name)
 
diff --git a/game_data_packager/gog.py b/game_data_packager/gog.py
index 5cdaccc..c2e0b11 100644
--- a/game_data_packager/gog.py
+++ b/game_data_packager/gog.py
@@ -48,4 +48,18 @@ class Gog:
 
         return self.available
 
+    def is_native(self, wanted):
+        cache = os.path.expanduser('~/.cache/lgogdownloader/gamedetails.json')
+        if not os.path.isfile(cache):
+            return
+
+        data = json.load(open(cache, encoding='utf-8'))
+        for game in data['games']:
+            if game['gamename'] != wanted:
+                continue
+            for installer in game['installers']:
+                if installer['platform'] == 4:
+                    return True
+            return False
+
 GOG = Gog()

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-games/game-data-packager.git



More information about the Pkg-games-commits mailing list