From 1686c1a8df2bdeb074115392301d9bde7ca23268 Mon Sep 17 00:00:00 2001 From: amtoaer Date: Wed, 6 Dec 2023 00:39:46 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=94=AF=E6=8C=81=E5=BC=B9=E5=B9=95?= =?UTF-8?q?=E4=B8=8B=E8=BD=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- poetry.lock | 6 +++--- processor.py | 24 +++++++++++------------- 2 files changed, 14 insertions(+), 16 deletions(-) diff --git a/poetry.lock b/poetry.lock index dbec0d6..a0a12ad 100644 --- a/poetry.lock +++ b/poetry.lock @@ -1,4 +1,4 @@ -# This file is automatically @generated by Poetry 1.7.0 and should not be changed by hand. +# This file is automatically @generated by Poetry 1.7.1 and should not be changed by hand. [[package]] name = "aerich" @@ -301,7 +301,7 @@ pillow = ">=10.1.0,<10.2.0" pycryptodomex = ">=3.19.0,<3.20.0" pyyaml = ">=6.0,<7.0" qrcode = ">=7.4.2,<7.5.0" -qrcode-terminal = ">=0.8,<1.0" +qrcode_terminal = ">=0.8,<1.0" requests = ">=2.31.0,<2.32.0" rsa = ">=4.9,<5.0" tqdm = ">=4.66.1,<4.67.0" @@ -311,7 +311,7 @@ yarl = ">=1.9.2,<1.10.0" type = "git" url = "https://github.com/amtoaer/bilibili-api.git" reference = "dev" -resolved_reference = "30db504b410787bdc8a5cd1ff63bacf6b365f393" +resolved_reference = "0281d7c58e8a26706cefc96e7e427cb05a26d866" [[package]] name = "black" diff --git a/processor.py b/processor.py index 124674a..5e87eb4 100644 --- a/processor.py +++ b/processor.py @@ -3,7 +3,7 @@ import datetime from asyncio import Semaphore, create_subprocess_exec from asyncio.subprocess import DEVNULL -from bilibili_api import favorite_list, video +from bilibili_api import ass, favorite_list, video from bilibili_api.exceptions import ResponseCodeException from loguru import logger from tortoise import Tortoise @@ -236,18 +236,16 @@ async def process_favorite_item( fav_item.name, ) if process_subtitle: - pass - # # 写入字幕,上游库获取字幕有 bug,暂时不做实现 - # if not await aexists(fav_item.subtitle_path): - # await ass.make_ass_file_danmakus_protobuf( - # v, 0, str(fav_item.subtitle_path.resolve()) - # ) - # else: - # logger.info( - # "Subtitle of {} {} already exists, skipped.", - # fav_item.bvid, - # fav_item.name, - # ) + if not await aexists(fav_item.subtitle_path): + await ass.make_ass_file_danmakus_protobuf( + v, 0, str(fav_item.subtitle_path.resolve()) + ) + else: + logger.info( + "Subtitle of {} {} already exists, skipped.", + fav_item.bvid, + fav_item.name, + ) if process_video: if await aexists(fav_item.video_path): fav_item.downloaded = True