Skip to content
This repository has been archived by the owner on Oct 20, 2021. It is now read-only.

Commit

Permalink
Show field size info.
Browse files Browse the repository at this point in the history
Helpful for #2
  • Loading branch information
enzanki-ars committed Dec 31, 2017
1 parent 2355cf0 commit fad077d
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
9 changes: 9 additions & 0 deletions rocketleaguereplayanalysis/main.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import argparse
import os
import time
from pprint import pprint

from rocketleaguereplayanalysis.data.data_loader import load_data, \
set_data_start, set_data_end
Expand All @@ -10,6 +11,7 @@
do_render_player_data_scoreboard_with_drive, \
do_render_player_data_scoreboard, do_render_player_data_drive
from rocketleaguereplayanalysis.util.export import export_parsed_data
from rocketleaguereplayanalysis.util.extra_info import get_field_dimensions

version = 'v1.3.1-dev'

Expand Down Expand Up @@ -76,6 +78,11 @@ def main():
action='store_const',
const=True,
default=False)
parser.add_argument('--show_field_size',
help='Show the calculated field size.',
action='store_const',
const=True,
default=False)
parser.add_argument('--version',
action='version',
help='Print version and exit (' + version + ')',
Expand All @@ -92,6 +99,8 @@ def main():
set_data_start(args.data_start)
if args.data_end:
set_data_end(args.data_end)
if args.show_field_size:
pprint(get_field_dimensions())
if args.export_parsed_data:
print('Exporting data.')
export_parsed_data(video_prefix)
Expand Down
7 changes: 4 additions & 3 deletions rocketleaguereplayanalysis/util/export.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,17 @@ def export_parsed_data(prefix):
import json
import os

from pprint import pprint

from rocketleaguereplayanalysis.data.object_numbers import \
get_player_info
from rocketleaguereplayanalysis.parser.frames import get_frames
from rocketleaguereplayanalysis.util.extra_info import get_field_dimensions

export = {
'player_info': get_player_info(),
'field_size': get_field_dimensions(),
'frames': get_frames()
}

with open(os.path.join(prefix + '-export-parsed-data.json'), 'w') as export_file:
with open(os.path.join(prefix + '-export-parsed-data.json'),
'w') as export_file:
json.dump(export, export_file)

0 comments on commit fad077d

Please sign in to comment.