def print_info(path): """Print basic info.""" with open(path, 'rb') as handle: header = mgz.header.parse_stream(handle) handle.seek(0) summary = Summary(handle) dataset = summary.get_dataset() print('-------------') print( tabulate( [ ['Path', path], [ 'Duration', mgz.util.convert_to_timestamp( summary.get_duration() / 1000) ], ['Completed', summary.get_completed()], ['Restored', header.initial.restore_time > 0], ['Postgame', bool(summary.get_postgame())], [ 'Version', '{} ({}, {})'.format( header.version.name, header.game_version, round(header.save_version, 2)) ], [ 'Dataset', '{} {}'.format(dataset['name'], dataset['version']) ], ['Hash', summary.get_hash().hexdigest()], ['Encoding', summary.get_encoding()], ['Language', summary.get_language()], ['Map', summary.get_map()['name']] # pylint: disable=unsubscriptable-object ], tablefmt='plain'))
def print_info(path): """Print basic info.""" with open(path, 'rb') as handle: summary = Summary(handle) dataset = summary.get_dataset() header = summary.get_header() print('-------------') print( tabulate( [ ['Path', path], [ 'Duration', mgz.util.convert_to_timestamp( summary.get_duration() / 1000) ], ['Completed', summary.get_completed()], ['Restored', header.initial.restore_time > 0], ['Postgame', bool(summary.get_postgame())], ['Objects', bool(summary.get_objects()['objects'])], [ 'Version', '{} ({}, {}, {})'.format( header.version.name, header.game_version, header.save_version, header.log_version) ], [ 'Dataset', '{} {}'.format(dataset['name'], dataset['version']) ], ['File Hash', summary.get_file_hash()], [ 'Match Hash', summary.get_hash().hexdigest() if summary.get_hash() else None ], ['Encoding', summary.get_encoding()], ['Language', summary.get_language()], [ 'Map', '{} ({})'.format(summary.get_map()['name'], summary.get_map()['seed']) ] # pylint: disable=unsubscriptable-object ], tablefmt='plain'))