[game-data-packager] 01/01: GOG:owned_gog_games() not yet used, may hang waiting for input (#798740)

Alexandre Detiste detiste-guest at moszumanska.debian.org
Sat Sep 12 08:52:46 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 7f45bc06e861d1628583aebedda2b913b0cc4b70
Author: Alexandre Detiste <alexandre.detiste at gmail.com>
Date:   Sat Sep 12 10:49:06 2015 +0200

    GOG:owned_gog_games() not yet used, may hang waiting for input (#798740)
---
 game_data_packager/gog.py | 39 +++++++++++++++++++++++++++++++++++++++
 1 file changed, 39 insertions(+)

diff --git a/game_data_packager/gog.py b/game_data_packager/gog.py
new file mode 100644
index 0000000..6f3ebe0
--- /dev/null
+++ b/game_data_packager/gog.py
@@ -0,0 +1,39 @@
+#!/usr/bin/python3
+# encoding=utf-8
+#
+# Copyright © 2015 Alexandre Detiste <alexandre at detiste.be>
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+#
+# You can find the GPL license text on a Debian system under
+# /usr/share/common-licenses/GPL-2.
+
+import json
+import os
+import subprocess
+
+from .util import which
+
+def owned_gog_games():
+    cache = os.path.expanduser('~/.cache/lgogdownloader/gamedetails.json')
+    if os.path.isfile(cache):
+       data = json.load(open(cache, encoding='utf-8'))
+       for key in data['games']:
+           yield key['gamename']
+    elif which('lgogdownloader'):
+       try:
+           list = subprocess.check_output(['lgogdownloader', '--list'],
+                               stdin=subprocess.DEVNULL,
+                               stderr=subprocess.DEVNULL,
+                               universal_newlines=True)
+       except subprocess.CalledProcessError:
+           return
+       for line in list.splitlines():
+           yield line

-- 
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