From eec52fa5bab31d55e1342b819bde5be2cdd228a6 Mon Sep 17 00:00:00 2001 From: thsrite Date: Fri, 13 Oct 2023 13:56:23 +0800 Subject: [PATCH 1/2] =?UTF-8?q?fix=20=E4=B8=8B=E8=BD=BD=E7=94=A8=E6=88=B7?= =?UTF-8?q?=E7=B2=BE=E7=AE=80=E4=B8=8B=E8=BD=BD=E8=BF=9B=E5=BA=A6=E6=B6=88?= =?UTF-8?q?=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/plugins/downloadingmsg/__init__.py | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/app/plugins/downloadingmsg/__init__.py b/app/plugins/downloadingmsg/__init__.py index 73323b2b..f72ab6ad 100644 --- a/app/plugins/downloadingmsg/__init__.py +++ b/app/plugins/downloadingmsg/__init__.py @@ -117,7 +117,7 @@ class DownloadingMsg(_PluginBase): if not userid: continue # 如果用户是管理员,无需重复推送 - if self._type == "admin" or self._type == "both" and self._adminuser and userid in str( + if (self._type == "admin" or self._type == "both") and self._adminuser and userid in str( self._adminuser).split(","): logger.debug("管理员已推送") continue @@ -177,10 +177,14 @@ class DownloadingMsg(_PluginBase): else: media_name = torrent.title - messages.append(f"{index}. {media_name}\n" - f"{torrent.title} " - f"{StringUtils.str_filesize(torrent.size)} " - f"{round(torrent.progress, 1)}%") + if not self._adminuser or userid not in str(self._adminuser).split(","): + # 下载用户发送精简消息 + messages.append(f"{index}. {media_name} {round(torrent.progress, 1)}%") + else: + messages.append(f"{index}. {media_name}\n" + f"{torrent.title} " + f"{StringUtils.str_filesize(torrent.size)} " + f"{round(torrent.progress, 1)}%") index += 1 # 用户消息渠道 From 761e66b2005a8c5973f99a830558f2d74e775224 Mon Sep 17 00:00:00 2001 From: thsrite Date: Fri, 13 Oct 2023 14:29:07 +0800 Subject: [PATCH 2/2] =?UTF-8?q?fix=20=E4=BB=8E=E4=B8=8B=E8=BD=BD=E5=8E=86?= =?UTF-8?q?=E5=8F=B2=E8=8E=B7=E5=8F=96tmdbid=E5=85=A5=E5=BA=93=E5=88=AE?= =?UTF-8?q?=E5=89=8A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/plugins/dirmonitor/__init__.py | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/app/plugins/dirmonitor/__init__.py b/app/plugins/dirmonitor/__init__.py index 6718e9b4..28645285 100644 --- a/app/plugins/dirmonitor/__init__.py +++ b/app/plugins/dirmonitor/__init__.py @@ -263,22 +263,26 @@ class DirMonitor(_PluginBase): target: Path = self._dirconf.get(mon_path) # 查询转移方式 transfer_type = self._transferconf.get(mon_path) + # 根据父路径获取下载历史 + download_history = self.downloadhis.get_by_path(Path(event_path).parent) # 识别媒体信息 - mediainfo: MediaInfo = self.chain.recognize_media(meta=file_meta) + mediainfo: MediaInfo = self.chain.recognize_media(meta=file_meta, + tmdbid=download_history.tmdbid if download_history else None) if not mediainfo: logger.warn(f'未识别到媒体信息,标题:{file_meta.name}') - if self._notify: - self.chain.post_message(Notification( - mtype=NotificationType.Manual, - title=f"{file_path.name} 未识别到媒体信息,无法入库!" - )) # 新增转移成功历史记录 - self.transferhis.add_fail( + his = self.transferhis.add_fail( src_path=file_path, mode=transfer_type, meta=file_meta ) + if self._notify: + self.chain.post_message(Notification( + mtype=NotificationType.Manual, + title=f"{file_path.name} 未识别到媒体信息,无法入库!\n" + f"回复:```\n/redo {his.id} [tmdbid]|[类型]\n``` 手动识别转移。" + )) return # 如果未开启新增已入库媒体是否跟随TMDB信息变化则根据tmdbid查询之前的title