fix: make database async
This commit is contained in:
24
read.py
24
read.py
@ -1,16 +1,16 @@
|
||||
#!/usr/bin/env python3
|
||||
import argparse
|
||||
import re
|
||||
import os
|
||||
import yaml
|
||||
from os import path
|
||||
import logging
|
||||
import coloredlogs
|
||||
import asyncio
|
||||
|
||||
import logging
|
||||
import os
|
||||
import re
|
||||
from logging.handlers import TimedRotatingFileHandler
|
||||
from os import path
|
||||
from typing import List, Optional
|
||||
|
||||
import coloredlogs
|
||||
import yaml
|
||||
|
||||
from core import CoreConfig, Utils
|
||||
|
||||
|
||||
@ -44,7 +44,7 @@ class BaseReader:
|
||||
pass
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
async def main():
|
||||
parser = argparse.ArgumentParser(description="Import Game Information")
|
||||
parser.add_argument(
|
||||
"--game",
|
||||
@ -140,8 +140,12 @@ if __name__ == "__main__":
|
||||
for dir, mod in titles.items():
|
||||
if args.game in mod.game_codes:
|
||||
handler = mod.reader(config, args.version, bin_arg, opt_arg, args.extra)
|
||||
loop = asyncio.get_event_loop()
|
||||
loop.run_until_complete(handler.read())
|
||||
|
||||
await handler.read()
|
||||
|
||||
|
||||
logger.info("Done")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
asyncio.run(main())
|
||||
|
Reference in New Issue
Block a user