[game-data-packager] 01/01: advertise in help_text when game is avaible on GOG or Steam

Alexandre Detiste detiste-guest at moszumanska.debian.org
Tue May 5 10:07:08 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 30687fea3d442524c1fa6e0f435d36dd27578391
Author: Alexandre Detiste <alexandre.detiste at gmail.com>
Date:   Tue May 5 12:03:38 2015 +0200

    advertise in help_text when game is avaible on GOG or Steam
    
    the URL are clickable at least with Konsole,
    Gnome Terminal & ShellInABox
    
    any more elaborated help_text in yaml files
    will overide this
---
 game_data_packager/__init__.py | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)

diff --git a/game_data_packager/__init__.py b/game_data_packager/__init__.py
index 4efaa33..81ecd2a 100644
--- a/game_data_packager/__init__.py
+++ b/game_data_packager/__init__.py
@@ -716,6 +716,26 @@ class GameData(object):
                    'resource.1_106_cd'
                    ), (self.shortname, wanted.name)
 
+        # advertise where to buy games
+        # if it's not already in the help_text
+        gog_url = self.gog.get('url')
+        gog_pp = '22d200f8670dbdb3e253a90eee5098477c95c23d' # ScummVM
+        steam_id = {self.steam.get('id')}
+        for package in self.packages.values():
+            gog_url = package.gog.get('url', gog_url)
+            gog_pp = package.gog.get('pp', gog_pp)
+            steam_id.add(package.steam.get('id'))
+        steam_id.discard(None)
+        www = list()
+        if steam_id and '://store.steampowered.com/' not in self.help_text:
+            www.append('http://store.steampowered.com/app/%s/' % min(steam_id))
+        if gog_url and '://www.gog.com/' not in self.help_text:
+            www.append('http://www.gog.com/game/' + gog_url + '?pp=' + gog_pp)
+        if www:
+            random.shuffle(www)
+            self.help_text += '\nThis game can be bought online here:\n '
+            self.help_text += '\n '.join(www)
+
     def __enter__(self):
         return self
 

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