[game-data-packager] 01/03: steam: cache list of owned games

Alexandre Detiste detiste-guest at moszumanska.debian.org
Sun Dec 27 10:43:56 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 26cd05f6bc19a8beb85aff46c9abd49f175a3f91
Author: Alexandre Detiste <alexandre.detiste at gmail.com>
Date:   Sun Dec 27 09:55:57 2015 +0100

    steam: cache list of owned games
---
 game_data_packager/steam.py | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/game_data_packager/steam.py b/game_data_packager/steam.py
index c2c4817..ab4ce74 100644
--- a/game_data_packager/steam.py
+++ b/game_data_packager/steam.py
@@ -58,6 +58,9 @@ def parse_acf(path):
             yield acf_struct
 
 def owned_steam_games(steam_id):
+    if owned_steam_games.STEAM_GAMES is not None:
+        return owned_steam_games.STEAM_GAMES
+    owned_steam_games.STEAM_GAMES = []
     url = "http://steamcommunity.com/profiles/" + steam_id + "/games?xml=1"
     html = urllib.request.urlopen(urllib.request.Request(url, headers={'User-Agent': AGENT}))
     tree = xml.etree.ElementTree.ElementTree()
@@ -67,7 +70,10 @@ def owned_steam_games(steam_id):
         appid = int(game.find('appID').text)
         name = game.find('name').text
         #print(appid, name)
-        yield (appid, name)
+        owned_steam_games.STEAM_GAMES.append((appid, name))
+    return owned_steam_games.STEAM_GAMES
+
+owned_steam_games.STEAM_GAMES = None
 
 def get_steam_id():
     path = os.path.expanduser('~/.steam/config/loginusers.vdf')

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