diff --git a/package.json b/package.json index 66876c7..2b60a05 100644 --- a/package.json +++ b/package.json @@ -386,7 +386,7 @@ "PlayletCategory": { "name": "短剧自动分类", "description": "网络短剧自动整理到独立的分类目录。", - "version": "1.1", + "version": "1.2", "icon": "Amule_A.png", "author": "jxxghp", "level": 1 diff --git a/plugins/brushflow/__init__.py b/plugins/brushflow/__init__.py index 147b639..27cd7bf 100644 --- a/plugins/brushflow/__init__.py +++ b/plugins/brushflow/__init__.py @@ -1852,13 +1852,13 @@ class BrushFlow(_PluginBase): """ if not self._notify: return - self.chain.post_message(Notification( + self.post_message( mtype=NotificationType.SiteMessage, title=f"【刷流任务删种】", text=f"站点:{site_name}\n" f"标题:{torrent_title}\n" f"原因:{reason}" - )) + ) def __send_add_message(self, torrent: TorrentInfo): """ @@ -1886,11 +1886,11 @@ class BrushFlow(_PluginBase): if torrent.hit_and_run: msg_text = f"{msg_text}\nHit&Run:是" - self.chain.post_message(Notification( + self.post_message( mtype=NotificationType.SiteMessage, title="【刷流任务种子下载】", text=msg_text - )) + ) def __get_torrents_size(self) -> int: """ diff --git a/plugins/dirmonitor/__init__.py b/plugins/dirmonitor/__init__.py index c1449bb..d52066d 100644 --- a/plugins/dirmonitor/__init__.py +++ b/plugins/dirmonitor/__init__.py @@ -381,11 +381,11 @@ class DirMonitor(_PluginBase): meta=file_meta ) if self._notify: - self.chain.post_message(Notification( + self.post_message( mtype=NotificationType.Manual, title=f"{file_path.name} 未识别到媒体信息,无法入库!\n" f"回复:```\n/redo {his.id} [tmdbid]|[类型]\n``` 手动识别转移。" - )) + ) return # 如果未开启新增已入库媒体是否跟随TMDB信息变化则根据tmdbid查询之前的title @@ -436,12 +436,12 @@ class DirMonitor(_PluginBase): transferinfo=transferinfo ) if self._notify: - self.chain.post_message(Notification( + self.post_message( mtype=NotificationType.Manual, title=f"{mediainfo.title_year}{file_meta.season_episode} 入库失败!", text=f"原因:{transferinfo.message or '未知'}", image=mediainfo.get_message_image() - )) + ) return # 新增转移成功历史记录 diff --git a/plugins/linkmonitor/__init__.py b/plugins/linkmonitor/__init__.py index 391a3d2..ed67771 100644 --- a/plugins/linkmonitor/__init__.py +++ b/plugins/linkmonitor/__init__.py @@ -322,21 +322,21 @@ class LinkMonitor(_PluginBase): # 转移失败 logger.warn(f"{file_path.name} 硬链接失败:{errmsg}") if self._notify: - self.chain.post_message(Notification( + self.post_message( mtype=NotificationType.Manual, title=f"{file_path.name} 硬链接失败!", text=f"原因:{errmsg or '未知'}" - )) + ) return # 转移成功 logger.info(f"{file_path.name} 硬链接成功") if self._notify: - self.chain.post_message(Notification( + self.post_message( mtype=NotificationType.Manual, title=f"{file_path.name} 硬链接完成!", text=f"目标目录:{target}" - )) + ) except Exception as e: logger.error("目录监控发生错误:%s - %s" % (str(e), traceback.format_exc())) diff --git a/plugins/playletcategory/__init__.py b/plugins/playletcategory/__init__.py index fb0c3cd..ac50930 100644 --- a/plugins/playletcategory/__init__.py +++ b/plugins/playletcategory/__init__.py @@ -25,7 +25,7 @@ class PlayletCategory(_PluginBase): # 插件图标 plugin_icon = "Amule_A.png" # 插件版本 - plugin_version = "1.1" + plugin_version = "1.2" # 插件作者 plugin_author = "jxxghp" # 作者主页 @@ -38,6 +38,7 @@ class PlayletCategory(_PluginBase): auth_level = 1 _enabled = False + _notify = True _delay = 0 _category_name = "短剧" _episode_duration = 20 @@ -47,6 +48,7 @@ class PlayletCategory(_PluginBase): if config: self._enabled = config.get("enabled") self._delay = config.get("delay") or 0 + self._notify = config.get("notify") self._category_name = config.get("category_name") self._episode_duration = config.get("episode_duration") @@ -86,6 +88,22 @@ class PlayletCategory(_PluginBase): } } ] + }, + { + 'component': 'VCol', + 'props': { + 'cols': 12, + 'md': 6 + }, + 'content': [ + { + 'component': 'VSwitch', + 'props': { + 'model': 'notify', + 'label': '发送消息', + } + } + ] } ] }, @@ -170,6 +188,7 @@ class PlayletCategory(_PluginBase): } ], { "enabled": False, + "notify": True, "delay": '', "category_name": '短剧', "episode_duration": '20' @@ -267,6 +286,12 @@ class PlayletCategory(_PluginBase): # 移动目录 try: shutil.move(tv_path, new_path) + # 发送消息 + if self._notify: + self.post_message( + title="【短剧自动分类】", + text=f"已将 {tv_path.name} 分类到 {self._category_name} 目录", + ) except Exception as e: logger.error(f"移动文件失败:{e}") diff --git a/plugins/removelink/__init__.py b/plugins/removelink/__init__.py index 4fb474d..799c3c0 100644 --- a/plugins/removelink/__init__.py +++ b/plugins/removelink/__init__.py @@ -349,13 +349,11 @@ class RemoveLink(_PluginBase): logger.info(f"删除硬链接文件:{path}, inode: {inode}") file.unlink() if self._notify: - self.chain.post_message( - Notification( - mtype=NotificationType.SiteMessage, - title=f"【清理硬链接】", - text=f"监控到删除源文件:[{file_path}]\n" - f"同步删除硬链接文件:[{path}]", - ) + self.post_message( + mtype=NotificationType.SiteMessage, + title=f"【清理硬链接】", + text=f"监控到删除源文件:[{file_path}]\n" + f"同步删除硬链接文件:[{path}]", ) except Exception as e: logger.error("删除硬链接文件发生错误:%s - %s" % (str(e), traceback.format_exc()))