chore: 整理代码逻辑,留出下载字幕的入口

This commit is contained in:
amtoaer
2023-12-05 23:59:46 +08:00
parent 46d1810e7c
commit de6eaeb4a6
5 changed files with 104 additions and 50 deletions

View File

@@ -4,7 +4,14 @@ import sys
import uvloop
from loguru import logger
from commands import recheck, refresh_tags, upper_thumb
from commands import (
recheck,
refresh_nfo,
refresh_poster,
refresh_subtitle,
refresh_upper,
refresh_video,
)
from models import init_model
from processor import cleanup, process
from settings import settings
@@ -14,12 +21,15 @@ asyncio.set_event_loop_policy(uvloop.EventLoopPolicy())
async def entry() -> None:
await init_model()
for command, func in [
for command, func in (
("once", process),
("recheck", recheck),
("upper_thumb", upper_thumb),
("refresh_tags", refresh_tags),
]:
("refresh_poster", refresh_poster),
("refresh_upper", refresh_upper),
("refresh_nfo", refresh_nfo),
("refresh_video", refresh_video),
("refresh_subtitle", refresh_subtitle),
):
if any(command in _ for _ in sys.argv):
logger.info("Running {}...", command)
await func()