mirror of
https://github.com/d0zingcat/MoviePilot-Plugins.git
synced 2026-05-13 15:09:12 +00:00
fix PlayletCategory
This commit is contained in:
@@ -591,10 +591,13 @@
|
||||
"name": "短剧自动分类",
|
||||
"description": "网络短剧自动整理到独立的分类目录。",
|
||||
"labels": "文件整理",
|
||||
"version": "1.4",
|
||||
"version": "2.0",
|
||||
"icon": "Amule_A.png",
|
||||
"author": "jxxghp",
|
||||
"level": 1
|
||||
"level": 1,
|
||||
"history": {
|
||||
"v2.0": "适配新的目录结构变化,短剧分类名称调整为配置目录路径,升级后需要重新调整设置后才能使用。"
|
||||
}
|
||||
},
|
||||
"DiagParamAdjust": {
|
||||
"name": "诊断参数调整",
|
||||
|
||||
@@ -21,11 +21,11 @@ class PlayletCategory(_PluginBase):
|
||||
# 插件名称
|
||||
plugin_name = "短剧自动分类"
|
||||
# 插件描述
|
||||
plugin_desc = "网络短剧自动分类到独立的二级目录。"
|
||||
plugin_desc = "网络短剧自动分类到独立目录。"
|
||||
# 插件图标
|
||||
plugin_icon = "Amule_A.png"
|
||||
# 插件版本
|
||||
plugin_version = "1.4"
|
||||
plugin_version = "2.0"
|
||||
# 插件作者
|
||||
plugin_author = "jxxghp"
|
||||
# 作者主页
|
||||
@@ -40,8 +40,8 @@ class PlayletCategory(_PluginBase):
|
||||
_enabled = False
|
||||
_notify = True
|
||||
_delay = 0
|
||||
_category_name = "短剧"
|
||||
_episode_duration = 20
|
||||
_category_dir = ""
|
||||
_episode_duration = 8
|
||||
|
||||
def init_plugin(self, config: dict = None):
|
||||
|
||||
@@ -49,11 +49,11 @@ class PlayletCategory(_PluginBase):
|
||||
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._category_dir = config.get("category_dir")
|
||||
self._episode_duration = config.get("episode_duration")
|
||||
|
||||
def get_state(self) -> bool:
|
||||
return True if self._enabled and self._category_name and self._episode_duration else False
|
||||
return True if self._enabled and self._category_dir and self._episode_duration else False
|
||||
|
||||
@staticmethod
|
||||
def get_command() -> List[Dict[str, Any]]:
|
||||
@@ -120,9 +120,9 @@ class PlayletCategory(_PluginBase):
|
||||
{
|
||||
'component': 'VTextField',
|
||||
'props': {
|
||||
'model': 'category_name',
|
||||
'label': '分类名称',
|
||||
'placeholder': '短剧'
|
||||
'model': 'category_dir',
|
||||
'label': '分类目录路径',
|
||||
'placeholder': '/media/短剧'
|
||||
}
|
||||
}
|
||||
]
|
||||
@@ -139,7 +139,7 @@ class PlayletCategory(_PluginBase):
|
||||
'props': {
|
||||
'model': 'episode_duration',
|
||||
'label': '单集时长(分钟)',
|
||||
'placeholder': '20'
|
||||
'placeholder': '8'
|
||||
}
|
||||
}
|
||||
]
|
||||
@@ -177,7 +177,7 @@ class PlayletCategory(_PluginBase):
|
||||
'props': {
|
||||
'type': 'info',
|
||||
'variant': 'tonal',
|
||||
'text': '小于单集时长的剧集视频文件将会移动到分类名称对应的二级目录,入库延迟适用于网盘等需要延后处理的场景,需要安装FFmpeg。'
|
||||
'text': '小于单集时长的剧集视频文件将会移动到分类目录,入库延迟适用于网盘等需要延后处理的场景,需要安装FFmpeg。'
|
||||
}
|
||||
}
|
||||
]
|
||||
@@ -190,8 +190,8 @@ class PlayletCategory(_PluginBase):
|
||||
"enabled": False,
|
||||
"notify": True,
|
||||
"delay": '',
|
||||
"category_name": '短剧',
|
||||
"episode_duration": '20'
|
||||
"category_dir": '短剧',
|
||||
"episode_duration": '8'
|
||||
}
|
||||
|
||||
def get_page(self) -> List[dict]:
|
||||
@@ -285,7 +285,7 @@ class PlayletCategory(_PluginBase):
|
||||
# 剧集的根目录
|
||||
tv_path = target_path.parent
|
||||
# 新的文件目录
|
||||
new_path = tv_path.parent.parent / self._category_name / tv_path.name
|
||||
new_path = Path(self._category_dir) / tv_path.name
|
||||
if not new_path.exists():
|
||||
# 移动目录
|
||||
try:
|
||||
@@ -316,7 +316,7 @@ class PlayletCategory(_PluginBase):
|
||||
self.post_message(
|
||||
mtype=NotificationType.Organize,
|
||||
title="【短剧自动分类】",
|
||||
text=f"已将 {tv_path.name} 分类到 {self._category_name} 目录",
|
||||
text=f"已将 {tv_path.name} 分类到 {self._category_dir} 目录",
|
||||
)
|
||||
|
||||
def stop_service(self):
|
||||
|
||||
Reference in New Issue
Block a user