forked from Trygve/otime
Event metoder bruker filobjekt istedet for paths nå
This commit is contained in:
parent
e11e25ea81
commit
a037abe820
30
cli.py
30
cli.py
@ -14,6 +14,8 @@ def print_runners(Runners):
|
|||||||
table.add_column("club", style="magenta")
|
table.add_column("club", style="magenta")
|
||||||
table.add_column("card", style="red")
|
table.add_column("card", style="red")
|
||||||
table.add_column("class", justify="right", style="green")
|
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")
|
table.add_column("Status", justify="right", style="blue")
|
||||||
|
|
||||||
for i in Runners:
|
for i in Runners:
|
||||||
@ -21,7 +23,7 @@ def print_runners(Runners):
|
|||||||
o_class = i.o_class.name
|
o_class = i.o_class.name
|
||||||
except:
|
except:
|
||||||
o_class = ''
|
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 = Console()
|
||||||
console.print(table)
|
console.print(table)
|
||||||
@ -147,16 +149,16 @@ def main():
|
|||||||
args = parser.parse_args()
|
args = parser.parse_args()
|
||||||
if args.command == 'show_runners':
|
if args.command == 'show_runners':
|
||||||
event = otime.Event(0, 'NoName')
|
event = otime.Event(0, 'NoName')
|
||||||
event.import_ttime_cnf(args.ttcnf)
|
event.import_ttime_cnf(open(args.ttcnf, encoding='latin-1'))
|
||||||
event.import_ttime_db(args.ttdb)
|
event.import_ttime_db(open(args.ttdb, encoding='latin-1'))
|
||||||
event.import_mtr_file(args.mtr)
|
event.import_mtr_file(open(args.mtr, encoding='latin-1'))
|
||||||
event.match_runners_cards()
|
event.match_runners_cards()
|
||||||
print_runners(event.runners)
|
print_runners(event.runners)
|
||||||
elif args.command == 'show_runner':
|
elif args.command == 'show_runner':
|
||||||
event = otime.Event(0, 'NoName')
|
event = otime.Event(0, 'NoName')
|
||||||
event.import_ttime_cnf(args.ttcnf)
|
event.import_ttime_cnf(open(args.ttcnf, encoding='latin-1'))
|
||||||
event.import_ttime_db(args.ttdb)
|
event.import_ttime_db(open(args.ttdb, encoding='latin-1'))
|
||||||
event.import_mtr_file(args.mtr)
|
event.import_mtr_file(open(args.mtr, encoding='latin-1'))
|
||||||
event.match_runners_cards()
|
event.match_runners_cards()
|
||||||
for n in event.runners:
|
for n in event.runners:
|
||||||
if args.runner == n.fullname():
|
if args.runner == n.fullname():
|
||||||
@ -168,9 +170,9 @@ def main():
|
|||||||
|
|
||||||
elif args.command == 'show_result':
|
elif args.command == 'show_result':
|
||||||
event = otime.Event(0, 'NoName')
|
event = otime.Event(0, 'NoName')
|
||||||
event.import_ttime_cnf(args.ttcnf)
|
event.import_ttime_cnf(open(args.ttcnf, encoding='latin-1'))
|
||||||
event.import_ttime_db(args.ttdb)
|
event.import_ttime_db(open(args.ttdb, encoding='latin-1'))
|
||||||
event.import_mtr_file(args.mtr)
|
event.import_mtr_file(open(args.mtr, encoding='latin-1'))
|
||||||
event.match_runners_cards()
|
event.match_runners_cards()
|
||||||
for n in event.o_classes:
|
for n in event.o_classes:
|
||||||
if args.o_class_str == n.name:
|
if args.o_class_str == n.name:
|
||||||
@ -185,14 +187,14 @@ def main():
|
|||||||
print_class_result(event.runners, o_class)
|
print_class_result(event.runners, o_class)
|
||||||
elif args.command == 'show_classes':
|
elif args.command == 'show_classes':
|
||||||
event = otime.Event(0, 'NoName')
|
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)
|
print_o_classes(event.o_classes)
|
||||||
|
|
||||||
elif args.command == 'create_xml':
|
elif args.command == 'create_xml':
|
||||||
event = otime.Event(0, 'NoName')
|
event = otime.Event(0, 'NoName')
|
||||||
event.import_ttime_cnf(args.ttcnf)
|
event.import_ttime_cnf(open(args.ttcnf, encoding='latin-1'))
|
||||||
event.import_ttime_db(args.ttdb)
|
event.import_ttime_db(open(args.ttdb, encoding='latin-1'))
|
||||||
event.import_mtr_file(args.mtr)
|
event.import_mtr_file(open(args.mtr, encoding='latin-1'))
|
||||||
event.match_runners_cards()
|
event.match_runners_cards()
|
||||||
event.get_xml_res().write(args.file)
|
event.get_xml_res().write(args.file)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user