def morgue_link(g): """Given a game dictionary, returns a URL to the game's morgue.""" source_file = os.path.basename(g['source_file']) server = R_SRC_SERVER.search(source_file).group(1) source = config.SOURCES.source(server) name = g['name'] stime = morgue_timestring( g['end_time'] ) if version_less_than(g['v'], '0.4'): if game_is_cao(g): return find_cao_morgue_link(name, stime) # Nothing we can do for anyone else with old games. return '' for morgue_base in source.morgue_bases(): morgue_url = morgue_base.url(source_file, g) if morgue_url: return morgue_url # Unknown morgue: raise Exception("Unknown source for morgues: %s" % src)
def morgue_filename(self, game_dict): return 'morgue-%s-%s.txt' % (game_dict['name'], morgue_timestring(game_dict['end_time']))