feat: 支持弹幕下载

This commit is contained in:
amtoaer
2023-12-06 00:39:46 +08:00
parent de6eaeb4a6
commit 1686c1a8df
2 changed files with 14 additions and 16 deletions

6
poetry.lock generated
View File

@@ -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"

View File

@@ -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