From b94f20166724f63fc87a2ca7f880336bb3f254b9 Mon Sep 17 00:00:00 2001 From: thsrite Date: Thu, 16 May 2024 20:44:57 +0800 Subject: [PATCH] =?UTF-8?q?fix=20=E6=8B=86=E5=8C=85=E5=9C=BA=E6=99=AF?= =?UTF-8?q?=E4=B8=8B=EF=BC=8C=E4=B8=8B=E8=BD=BD=E9=80=9A=E7=9F=A5=E6=A0=87?= =?UTF-8?q?=E9=A2=98=E5=B1=95=E7=A4=BA=E5=AE=9E=E9=99=85=E4=B8=8B=E8=BD=BD?= =?UTF-8?q?=E7=9A=84=E9=9B=86=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/chain/download.py | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/app/chain/download.py b/app/chain/download.py index 290c8ab3..15ae7d1d 100644 --- a/app/chain/download.py +++ b/app/chain/download.py @@ -34,7 +34,8 @@ class DownloadChain(ChainBase): self.mediaserver = MediaServerOper() def post_download_message(self, meta: MetaBase, mediainfo: MediaInfo, torrent: TorrentInfo, - channel: MessageChannel = None, userid: str = None, username: str = None): + channel: MessageChannel = None, userid: str = None, username: str = None, + download_episodes: str = None): """ 发送添加下载的消息 :param meta: 元数据 @@ -80,7 +81,7 @@ class DownloadChain(ChainBase): mtype=NotificationType.Download, userid=userid, title=f"{mediainfo.title_year} " - f"{meta.season_episode} 开始下载", + f"{download_episodes or meta.season_episode} 开始下载", text=msg_text, image=mediainfo.get_message_image())) @@ -207,6 +208,9 @@ class DownloadChain(ChainBase): _torrent = context.torrent_info _media = context.media_info _meta = context.meta_info + + # 实际下载的集数 + download_episodes = StringUtils.format_ep(list(episodes)) if episodes else _meta.episode _folder_name = "" if not torrent_file: # 下载种子文件,得到的可能是文件也可能是磁力链 @@ -284,7 +288,7 @@ class DownloadChain(ChainBase): tvdbid=_media.tvdb_id, doubanid=_media.douban_id, seasons=_meta.season, - episodes=_meta.episode, + episodes=download_episodes, image=_media.get_backdrop_image(), download_hash=_hash, torrent_name=_torrent.title, @@ -321,7 +325,8 @@ class DownloadChain(ChainBase): self.downloadhis.add_files(files_to_add) # 发送消息(群发,不带channel和userid) - self.post_download_message(meta=_meta, mediainfo=_media, torrent=_torrent, username=username) + self.post_download_message(meta=_meta, mediainfo=_media, torrent=_torrent, + username=username, download_episodes=download_episodes) # 下载成功后处理 self.download_added(context=context, download_dir=download_dir, torrent_path=torrent_file) # 广播事件