init with some kind of working prototype
This commit is contained in:
commit
b5cb22822e
22 changed files with 1292 additions and 0 deletions
36
unwind/__main__.py
Normal file
36
unwind/__main__.py
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
import asyncio
|
||||
import logging
|
||||
|
||||
from . import config
|
||||
from .db import close_connection_pool, open_connection_pool
|
||||
from .imdb import load_imdb
|
||||
from .request import session
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
|
||||
async def run_import():
|
||||
await open_connection_pool()
|
||||
|
||||
with session() as s:
|
||||
s.headers["Accept-Language"] = "en-GB, en;q=0.5"
|
||||
|
||||
for name, imdb_id in config.imdb.items():
|
||||
log.info("Loading data for %s ... ⚡️", name)
|
||||
await load_imdb(imdb_id)
|
||||
|
||||
await close_connection_pool()
|
||||
|
||||
|
||||
def main():
|
||||
logging.basicConfig(
|
||||
format="%(asctime)s.%(msecs)03d [%(name)s:%(process)d] %(levelname)s: %(message)s",
|
||||
datefmt="%H:%M:%S",
|
||||
level=config.loglevel,
|
||||
)
|
||||
log.debug(f"Log level: {config.loglevel}")
|
||||
|
||||
asyncio.run(run_import())
|
||||
|
||||
|
||||
main()
|
||||
Loading…
Add table
Add a link
Reference in a new issue