Event metoder bruker filobjekt istedet for paths nå

This commit is contained in:
Trygve 2022-05-29 22:43:08 +02:00
parent e11e25ea81
commit a037abe820

30
cli.py
View File

@ -14,6 +14,8 @@ def print_runners(Runners):
table.add_column("club", style="magenta")
table.add_column("card", style="red")
table.add_column("class", justify="right", style="green")
table.add_column("start_time", justify="right", style="green")
table.add_column("fork", justify="right", style="green")
table.add_column("Status", justify="right", style="blue")
for i in Runners:
@ -21,7 +23,7 @@ def print_runners(Runners):
o_class = i.o_class.name
except:
o_class = ''
table.add_row(i.fullname(), i.club ,str(i.card), o_class, i.status())
table.add_row(i.fullname(), i.club ,str(i.card), o_class, i.start_time, str(i.fork), i.status())
console = Console()
console.print(table)
@ -147,16 +149,16 @@ def main():
args = parser.parse_args()
if args.command == 'show_runners':
event = otime.Event(0, 'NoName')
event.import_ttime_cnf(args.ttcnf)
event.import_ttime_db(args.ttdb)
event.import_mtr_file(args.mtr)
event.import_ttime_cnf(open(args.ttcnf, encoding='latin-1'))
event.import_ttime_db(open(args.ttdb, encoding='latin-1'))
event.import_mtr_file(open(args.mtr, encoding='latin-1'))
event.match_runners_cards()
print_runners(event.runners)
elif args.command == 'show_runner':
event = otime.Event(0, 'NoName')
event.import_ttime_cnf(args.ttcnf)
event.import_ttime_db(args.ttdb)
event.import_mtr_file(args.mtr)
event.import_ttime_cnf(open(args.ttcnf, encoding='latin-1'))
event.import_ttime_db(open(args.ttdb, encoding='latin-1'))
event.import_mtr_file(open(args.mtr, encoding='latin-1'))
event.match_runners_cards()
for n in event.runners:
if args.runner == n.fullname():
@ -168,9 +170,9 @@ def main():
elif args.command == 'show_result':
event = otime.Event(0, 'NoName')
event.import_ttime_cnf(args.ttcnf)
event.import_ttime_db(args.ttdb)
event.import_mtr_file(args.mtr)
event.import_ttime_cnf(open(args.ttcnf, encoding='latin-1'))
event.import_ttime_db(open(args.ttdb, encoding='latin-1'))
event.import_mtr_file(open(args.mtr, encoding='latin-1'))
event.match_runners_cards()
for n in event.o_classes:
if args.o_class_str == n.name:
@ -185,14 +187,14 @@ def main():
print_class_result(event.runners, o_class)
elif args.command == 'show_classes':
event = otime.Event(0, 'NoName')
event.import_ttime_cnf(args.ttcnf)
event.import_ttime_cnf(open(args.ttcnf, encoding='latin-1'))
print_o_classes(event.o_classes)
elif args.command == 'create_xml':
event = otime.Event(0, 'NoName')
event.import_ttime_cnf(args.ttcnf)
event.import_ttime_db(args.ttdb)
event.import_mtr_file(args.mtr)
event.import_ttime_cnf(open(args.ttcnf, encoding='latin-1'))
event.import_ttime_db(open(args.ttdb, encoding='latin-1'))
event.import_mtr_file(open(args.mtr, encoding='latin-1'))
event.match_runners_cards()
event.get_xml_res().write(args.file)