🐛 Fix bilibili fav audio cache

This commit is contained in:
xtaodada 2023-08-21 10:18:07 +08:00
parent ed8a2125f3
commit 224bf15b72
Signed by: xtaodada
GPG Key ID: 4CBB3F4FA8C85659
2 changed files with 4 additions and 0 deletions

View File

@ -110,6 +110,8 @@ async def check_update(m: Message):
continue continue
if await BiliFavAction.get_by_bv_id(data.bvid, fav=True): if await BiliFavAction.get_by_bv_id(data.bvid, fav=True):
continue continue
if await BiliFavAction.get_by_id(data.id, fav=True):
continue
n = await m.reply(f"处理 {data.type.name} {data.bvid} 中...") n = await m.reply(f"处理 {data.type.name} {data.bvid} 中...")
try: try:
if data.type == MediaType.video: if data.type == MediaType.video:

View File

@ -10,6 +10,8 @@ from models.models.bilifav import BiliFav
class BiliFavAction: class BiliFavAction:
@staticmethod @staticmethod
async def get_by_id(id_: int, fav: bool = False) -> Optional[BiliFav]: async def get_by_id(id_: int, fav: bool = False) -> Optional[BiliFav]:
if not id_:
return None
async with sqlite.session() as session: async with sqlite.session() as session:
session = cast(AsyncSession, session) session = cast(AsyncSession, session)
statement = select(BiliFav).where(BiliFav.id == id_) statement = select(BiliFav).where(BiliFav.id == id_)