feat: tag 获取失败不影响主流程

This commit is contained in:
amtoaer
2023-12-04 01:35:29 +08:00
parent 38caf1f0d6
commit 89e2567fef
2 changed files with 10 additions and 3 deletions

View File

@@ -66,8 +66,6 @@ async def upper_thumb():
async def refresh_tags():
"""刷新已存在的视频的标签,从不支持标签的版本升级上来后需要手动调用一次"""
items = await FavoriteItem.filter(
type=MediaType.VIDEO,
status=MediaStatus.NORMAL,
downloaded=True,
tags=None,
).prefetch_related("upper")

View File

@@ -194,7 +194,16 @@ async def process_video(
if process_nfo:
if not await aexists(fav_item.nfo_path):
if fav_item.tags is None:
fav_item.tags = [_["tag_name"] for _ in await v.get_tags()]
try:
fav_item.tags = [
_["tag_name"] for _ in await v.get_tags()
]
except Exception:
logger.exception(
"Failed to get tags of video {} {}",
fav_item.bvid,
fav_item.name,
)
# 写入 nfo
await EpisodeInfo(
title=fav_item.name,