Main Structures

The outline of the key structures in the replay object.

Replay

class sc2reader.resources.Replay(replay_file, filename=None, load_level=4, engine=<module 'sc2reader.engine' from '/home/docs/checkouts/readthedocs.org/user_builds/sc2reader/envs/latest/local/lib/python2.7/site-packages/sc2reader-0.7.0rc0-py2.7.egg/sc2reader/engine/__init__.pyc'>, do_tracker_events=True, **options)
register_datapack(datapack, filterfunc=<function <lambda>>)

Allows you to specify your own datapacks for use when loading replays. Datapacks are checked for use with the supplied filterfunc in reverse registration order to give user registered datapacks preference over factory default datapacks.

This is how you would add mappings for your favorite custom map.

Parameters:
  • datapack – A BaseData object to use for mapping unit types and ability codes to their corresponding classes.
  • filterfunc – A function that accepts a partially loaded Replay object as an argument and returns true if the datapack should be used on this replay.
register_default_datapacks()

Registers factory default datapacks.

register_default_readers()

Registers factory default readers.

register_reader(data_file, reader, filterfunc=<function <lambda>>)

Allows you to specify your own reader for use when reading the data files packed into the .SC2Replay archives. Datapacks are checked for use with the supplied filterfunc in reverse registration order to give user registered datapacks preference over factory default datapacks.

Don’t use this unless you know what you are doing.

Parameters:
  • data_file – The full file name that you would like this reader to parse.
  • reader – The Reader object you wish to use to read the data file.
  • filterfunc – A function that accepts a partially loaded Replay object as an argument and returns true if the reader should be used on this replay.

Map

class sc2reader.resources.Map(map_file, filename=None, region=None, map_hash=None, **options)
classmethod get_url(region, map_hash)

Builds a download URL for the map from its components.

Game Summary

class sc2reader.resources.GameSummary(summary_file, filename=None, lang=u'enUS', **options)