def main():
config_path = Path(sys.argv[1]) if len(sys.argv) > 1 else Path.home() / '.config' / 'whereisit.toml'
with open(config_path) as f:
config = toml.load(f)
import logging
logging.getLogger('aiohttp.client').setLevel(logging.ERROR)
db_path = Path.home() / '.local' / 'share' / config['database']['path']
orm.sql_debug(config['database'].get('debug', False))
database.bind("sqlite", str(db_path), create_db=True)
database.generate_mapping(create_tables=True)
with orm.db_session():
orm.select(t for t in database.Tracking
if t.id not in list(config['trackings'].keys())).delete(bulk=True)
asyncio.set_event_loop_policy(uvloop.EventLoopPolicy())
with contextlib.closing(asyncio.get_event_loop()) as loop:
tracker = Tracker(loop=loop, db=database, config=config)
loop.create_task(tracker.run())
loop.run_forever()
评论列表
文章目录