[game-data-packager] 01/01: steam.py: get list of owned games
Alexandre Detiste
detiste-guest at moszumanska.debian.org
Fri Apr 3 13:14:03 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 31e032ecd1d8415737b6c65aa81810b6bde4a0dd
Author: Alexandre Detiste <alexandre.detiste at gmail.com>
Date: Fri Apr 3 15:12:15 2015 +0200
steam.py: get list of owned games
needed for future GUI, related to #775365
---
game_data_packager/steam.py | 14 ++++++++++++++
1 file changed, 14 insertions(+)
diff --git a/game_data_packager/steam.py b/game_data_packager/steam.py
index 19ffe43..a8fff2e 100644
--- a/game_data_packager/steam.py
+++ b/game_data_packager/steam.py
@@ -16,6 +16,8 @@
# /usr/share/common-licenses/GPL-2.
import glob
+import xml.etree.ElementTree
+import urllib.request
def parse_acf(path):
for manifest in glob.glob(path + '/*.acf'):
@@ -39,3 +41,15 @@ def parse_acf(path):
if 'name' not in acf_struct:
acf_struct['name'] = acf_struct['installdir']
yield acf_struct
+
+def owned_steam_games(steam_id):
+ url = "http://steamcommunity.com/id/" + steam_id + "/games?xml=1"
+ html = urllib.request.urlopen(url)
+ tree = xml.etree.ElementTree.ElementTree()
+ tree.parse(html)
+ games_xml = tree.getiterator('game')
+ for game in games_xml:
+ appid = int(game.find('appID').text)
+ name = game.find('name').text
+ #print(appid, name)
+ yield {appid, name}
--
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