Skip to content

Commit 83d3809

Browse files
committed
Add option to print observers to sc2printer.
1 parent 0dbe561 commit 83d3809

File tree

1 file changed

+13
-6
lines changed

1 file changed

+13
-6
lines changed

sc2reader/scripts/sc2printer.py

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,11 @@ def printReplay(filepath, arguments):
2828
print(" Team {0}\t{1} ({2})".format(team.number, team.players[0].name, team.players[0].pick_race[0]))
2929
for player in team.players[1:]:
3030
print(" \t{0} ({1})".format(player.name, player.pick_race[0]))
31+
if arguments.observers:
32+
print(" Observers:")
33+
for observer in replay.observers:
34+
print(" {0}".format(observer.name))
35+
3136
if arguments.messages:
3237
print(" Messages:")
3338
for message in replay.messages:
@@ -43,9 +48,9 @@ def printReplay(filepath, arguments):
4348
print("\nVersion {0} replay:\n\t{1}".format(e.replay.release_string, e.replay.filepath))
4449
print("\t{0}, Type={1:X}".format(e.msg, e.type))
4550
print("\tPrevious Event: {0}".format(prev.name))
46-
print("\t\t"+prev.bytes.encode('hex'))
51+
print("\t\t" + prev.bytes.encode('hex'))
4752
print("\tFollowing Bytes:")
48-
print("\t\t"+e.buffer.read_range(e.location, e.location+30).encode('hex'))
53+
print("\t\t" + e.buffer.read_range(e.location, e.location + 30).encode('hex'))
4954
print("Error with '{0}': ".format(filepath))
5055
print(e)
5156
except Exception as e:
@@ -92,13 +97,15 @@ def main():
9297

9398
shared_args = parser.add_argument_group('Shared Arguments')
9499
shared_args.add_argument('--date', action="store_true", default=True,
95-
help="print(game date [default on]")
100+
help="print game date [default on]")
96101
shared_args.add_argument('--length', action="store_true", default=False,
97-
help="print(game duration mm:ss in game time (not real time) [default off]")
102+
help="print game duration mm:ss in game time (not real time) [default off]")
98103
shared_args.add_argument('--map', action="store_true", default=True,
99-
help="print(map name [default on]")
104+
help="print map name [default on]")
100105
shared_args.add_argument('--teams', action="store_true", default=True,
101-
help="print(teams, their players, and the race matchup [default on]")
106+
help="print teams, their players, and the race matchup [default on]")
107+
shared_args.add_argument('--observers', action="store_true", default=True,
108+
help="print observers")
102109

103110
replay_args = parser.add_argument_group('Replay Options')
104111
replay_args.add_argument('--messages', action="store_true", default=False,

0 commit comments

Comments
 (0)