[game-data-packager] 01/01: HTML page: sort by Franchise & initial release year

Alexandre Detiste detiste-guest at moszumanska.debian.org
Sun Feb 21 10:59:37 UTC 2016


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 1735b9332115c5fca34de67809b748308fb4a9ae
Author: Alexandre Detiste <alexandre.detiste at gmail.com>
Date:   Sun Feb 21 11:58:56 2016 +0100

    HTML page: sort by Franchise & initial release year
    
    add missing tags for Maniac Mansion
---
 data/maniacmansion.yaml |  1 +
 data/tentacle.yaml      |  1 +
 tools/babel.py          | 14 ++++++++++++--
 3 files changed, 14 insertions(+), 2 deletions(-)

diff --git a/data/maniacmansion.yaml b/data/maniacmansion.yaml
index dadfd52..dbe5550 100644
--- a/data/maniacmansion.yaml
+++ b/data/maniacmansion.yaml
@@ -1,4 +1,5 @@
 ---
+franchise: Maniac Mansion
 longname: Maniac Mansion
 copyright: © 1988 Lucasfilm Games
 # for upgrade from versions where it was not multilingual
diff --git a/data/tentacle.yaml b/data/tentacle.yaml
index 56bc15e..4939ece 100644
--- a/data/tentacle.yaml
+++ b/data/tentacle.yaml
@@ -1,4 +1,5 @@
 ---
+franchise: Maniac Mansion
 longname: Day Of The Tentacle
 copyright: © 1993 LucasArts
 plugin: scummvm_common
diff --git a/tools/babel.py b/tools/babel.py
index 637a8ce..01b4777 100755
--- a/tools/babel.py
+++ b/tools/babel.py
@@ -39,7 +39,13 @@ for name, game in load_games().items():
     # free-as-in-beer
     fullfree = True
     somefree = False
+    if game.copyright:
+        year = game.copyright[2:6]
+    else:
+        year = None
     for package in game.packages.values():
+        if not year and package.copyright:
+            year = package.copyright[2:6]
         if not package.demo_for:
             for m_lang in package.langs:
                 if m_lang not in stats:
@@ -54,6 +60,10 @@ for name, game in load_games().items():
     genre = game.genre or 'Unknown'
     genres[genre] = genres.get(genre, 0) + 1
     stats['genre'] = genre
+    if game.franchise:
+        stats['sort_key'] = game.franchise.lower() + ' ' + year
+    else:
+        stats['sort_key'] = game.shortname
     stats['shortname'] = name
     stats['longname'] = game.longname
     stats['url_wiki'] = game.wikibase + (game.wiki or '')
@@ -91,7 +101,7 @@ with open('debian/TODO', 'r', encoding='utf8') as missing:
             for char in line.lower():
                 if 'a' <= char <= 'z' or '0' <= char <= '9':
                    shortname += char
-            stats['shortname'] = shortname
+            stats['sort_key'] = shortname
             if '#' not in line:
                 stats['longname'] = line
             else:
@@ -105,7 +115,7 @@ with open('debian/TODO', 'r', encoding='utf8') as missing:
                                    % (longname, bug, bug, remainder))
             games.append(stats)
 
-games = sorted(games, key=lambda k: (k['genre'], k['shortname'], k['longname']))
+games = sorted(games, key=lambda k: (k['genre'], k['sort_key']))
 
 langs_order = [k for k, v in sorted(langs.items(), key=lambda kv: (-kv[1], kv[0]))]
 

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