Start på asyncio

This commit is contained in:
Trygve 2022-03-13 17:33:26 +01:00
parent 052a06741f
commit 38332a8a90
1 changed files with 8 additions and 2 deletions

View File

@ -1,5 +1,7 @@
import otime import otime
import pickle import pickle
import asyncio
from watchgod import awatch
from config import config from config import config
from rich import print from rich import print
from rich import inspect from rich import inspect
@ -7,7 +9,7 @@ from rich.console import Console
from rich.columns import Columns from rich.columns import Columns
from rich.table import Table from rich.table import Table
def main(): def start():
event = otime.event(0, config['event_name']) event = otime.event(0, config['event_name'])
event.import_ttime_cnf('/home/trygve/Documents/sprintcup040330/sprintcup040330.cnf') event.import_ttime_cnf('/home/trygve/Documents/sprintcup040330/sprintcup040330.cnf')
event.import_ttime_db(config['db_file']) event.import_ttime_db(config['db_file'])
@ -15,5 +17,9 @@ def main():
event.match_runners_cards() event.match_runners_cards()
event.get_xml_res().write(config['xml_res_file']) event.get_xml_res().write(config['xml_res_file'])
async def main():
async for changes in awatch(config['db_file']):
print(changes)
if __name__ == "__main__": if __name__ == "__main__":
main() start()
asyncio.run(main())