From ed8a2125f3a863dd76afb25ec3a4ad9e13dd4960 Mon Sep 17 00:00:00 2001 From: xtaodada Date: Fri, 18 Aug 2023 23:14:22 +0800 Subject: [PATCH] :bug: Fix bilibili fav download sql --- defs/bilibili_download.py | 4 ++-- defs/bilibili_fav.py | 22 ---------------------- 2 files changed, 2 insertions(+), 24 deletions(-) diff --git a/defs/bilibili_download.py b/defs/bilibili_download.py index 7aae110..798bd59 100644 --- a/defs/bilibili_download.py +++ b/defs/bilibili_download.py @@ -272,7 +272,7 @@ async def audio_download( type=12, title=info.get("title", ""), cover=info.get("cover", ""), - message_id=0, + message_id=msg.id if push_id else 0, file_id=msg.audio.file_id, timestamp=int(time.time()), ) @@ -412,7 +412,7 @@ async def go_upload( type=2, title=info.get("title", ""), cover=info.get("pic", ""), - message_id=0, + message_id=msg.id if push_id else 0, file_id=msg.video.file_id, timestamp=int(time.time()), ) diff --git a/defs/bilibili_fav.py b/defs/bilibili_fav.py index 517a470..f3c5195 100644 --- a/defs/bilibili_fav.py +++ b/defs/bilibili_fav.py @@ -67,17 +67,6 @@ async def process_video(data: Media, m: Message): msg = await go_upload(video, 0, m, push_id=bilifav_channel) if not msg: raise BilibiliFavException - video_db = BiliFav( - id=data.id, - bv_id=data.bvid.lower(), - type=data.type.value, - title=data.title, - cover=data.cover, - message_id=msg.id, - file_id=msg.video.file_id, - timestamp=int(time.time()), - ) - await BiliFavAction.add_bili_fav(video_db) async def process_audio_from_cache(audio: Audio, audio_db: BiliFav): @@ -102,17 +91,6 @@ async def process_audio(data: Media, m: Message): msg = await audio_download(audio, m, push_id=bilifav_channel) if not msg: raise BilibiliFavException - audio_db = BiliFav( - id=data.id, - bv_id=data.bvid.lower(), - type=data.type.value, - title=data.title, - cover=data.cover, - message_id=msg.id, - file_id=msg.audio.file_id, - timestamp=int(time.time()), - ) - await BiliFavAction.add_bili_fav(audio_db) async def check_update(m: Message):