This commit is contained in:
Trygve 2022-03-13 21:19:07 +01:00
parent 38332a8a90
commit 3a9be6b974

View File

@ -1,6 +1,8 @@
#!/usr/bin/env python
import otime
import pickle
import asyncio
from difflib import Differ
from watchgod import awatch
from config import config
from rich import print
@ -9,6 +11,7 @@ from rich.console import Console
from rich.columns import Columns
from rich.table import Table
def start():
event = otime.event(0, config['event_name'])
event.import_ttime_cnf('/home/trygve/Documents/sprintcup040330/sprintcup040330.cnf')
@ -18,8 +21,18 @@ def start():
event.get_xml_res().write(config['xml_res_file'])
async def main():
db_file = open(config['db_file'], 'r', encoding='latin_1').readlines()
async for changes in awatch(config['db_file']):
print(changes)
#print(dir(changes))
#print(changes.difference())
db_file_u = open(config['db_file'], 'r', encoding='latin_1').readlines()
d = Differ()
result = list(d.compare(db_file, db_file_u))
for line in result:
if line[:1] == '+':
print(line)
if __name__ == "__main__":
start()
asyncio.run(main())