Beispiel #1
0
 def create_test_replay_repo(self, start_list, end_list, name_list):
     repo = replay_pb2.ReplayRepo()
     for idx, name in enumerate(name_list):
         entry = repo.replays.add()
         entry.filepath = os.path.join(self.conf.aoe2_replay_dir, name)
         entry.start_secs = start_list[idx]
         entry.end_secs = end_list[idx]
     io_util.serialize_to_gz_file(self.conf.replay_repo, repo)
     return repo
Beispiel #2
0
def list_replay_in_repo(conf):
    is_short_listing = False
    if len(conf.subcommand) > 1:
        is_short_listing = 'short' == conf.subcommand[1]
    replay_repo = io_util.parse_from_gz_file(conf.replay_repo,
                                             replay_pb2.ReplayRepo())

    if not is_short_listing:
        logging.info("Replay repo:\n%s", replay_repo)
    else:
        lines = [
            short_listing_format(conf, i, r)
            for i, r in enumerate(replay_repo.replays)
        ]
        logging.info("Replay repo:\n%s", "\n".join(lines))
 def test_parse_replay_files(self):
     self.conf.do_parse = False
     repo = replay_pb2.ReplayRepo()
     aoe2_replay_repo_builder.parse_replay_files(self.conf, repo)
     self.assertEqual(0, len(repo.replays))
 def test_find_replay_files(self):
     unix_secs = int(time.time())
     records = self.create_dummy_record_files(3)
     repo = replay_pb2.ReplayRepo()
     aoe2_replay_repo_builder.find_replay_files(self.conf, repo)
     self.assertEqual(len(records), len(repo.replays))
Beispiel #5
0
def plot_last_replay_in_repo(conf):
    replay_repo = io_util.parse_from_gz_file(conf.replay_repo,
                                             replay_pb2.ReplayRepo())
    lastest_replay = max((r for r in replay_repo.replays),
                         key=lambda r: r.start_secs)
    plot_replay(conf, lastest_replay)
Beispiel #6
0
def plot_replay_by_idx(conf):
    if len(conf.subcommand) < 2:
        raise Exception("plot_ts needs index")
    replay_repo = io_util.parse_from_gz_file(conf.replay_repo,
                                             replay_pb2.ReplayRepo())
    plot_replay(conf, replay_repo.replays[int(conf.subcommand[1])])