This commit is contained in:
thsrite
2024-07-31 21:08:07 +08:00
parent dfeb5afc39
commit 8a8ddb19a2
4 changed files with 71 additions and 6 deletions

View File

@@ -33,7 +33,7 @@ MoviePilot三方插件市场https://github.com/thsrite/MoviePilot-Plugins/
- [自定义命令 v1.7](docs%2FCustomCommand.md)
- docker自定义任务 v1.3
- 插件彻底卸载 v1.0
- 实时软连接 v2.0
- 实时软连接 v2.0.1
- 订阅规则自动填充 v2.7
- Emby元数据刷新 v1.3
- Emby媒体标签 v1.2
@@ -44,7 +44,7 @@ MoviePilot三方插件市场https://github.com/thsrite/MoviePilot-Plugins/
- 命令执行器 v1.2
- CloudDrive2助手 v1.6
- 软连接重定向 v1.1
- 云盘同步删除 v1.5
- 云盘同步删除 v1.5.1
- 媒体库重复媒体检测 v1.9
- 演员作品订阅 v1.0
- 文件复制 v1.0

View File

@@ -393,11 +393,12 @@
"name": "实时软连接",
"description": "监控目录文件变化,媒体文件软连接,其他文件可选复制。",
"labels": "文件管理",
"version": "2.0",
"version": "2.0.1",
"icon": "https://raw.githubusercontent.com/thsrite/MoviePilot-Plugins/main/icons/softlink.png",
"author": "thsrite",
"level": 1,
"history": {
"v2.0.1": "不重要的更新",
"v2.0": "修复交互命令",
"v1.9.9": "交互命令更多玩法",
"v1.9.8": "新增模糊匹配交互命令",
@@ -617,11 +618,12 @@
"name": "云盘同步删除",
"description": "媒体库删除软连接文件后,同步删除云盘文件。",
"labels": "云盘",
"version": "1.5",
"version": "1.5.1",
"icon": "clouddisk.png",
"author": "thsrite",
"level": 2,
"history": {
"v1.5.1": "不重要的更新",
"v1.5": "支持软连接指向本地路径的同步删除",
"v1.4": "插件删除历史",
"v1.3.1": "添加log",

View File

@@ -11,6 +11,7 @@ from app.plugins import _PluginBase
from typing import Any, List, Dict, Tuple
from app.schemas.types import EventType, MediaImageType, NotificationType, MediaType
from app.utils.http import RequestUtils
from app.utils.system import SystemUtils
@@ -22,7 +23,7 @@ class CloudSyncDel(_PluginBase):
# 插件图标
plugin_icon = "clouddisk.png"
# 插件版本
plugin_version = "1.5"
plugin_version = "1.5.1"
# 插件作者
plugin_author = "thsrite"
# 作者主页
@@ -41,6 +42,7 @@ class CloudSyncDel(_PluginBase):
_cloud_paths = {}
_local_paths = {}
_notify = False
_url = None
_del_history = False
_video_formats = ('.mp4', '.avi', '.rmvb', '.wmv', '.mov', '.mkv', '.flv', '.ts', '.webm', '.iso', '.mpg')
@@ -49,6 +51,7 @@ class CloudSyncDel(_PluginBase):
if config:
self._enabled = config.get("enabled")
self._notify = config.get("notify")
self._url = config.get("url")
self._del_history = config.get("del_history")
if config.get("path"):
for path in str(config.get("path")).split("\n"):
@@ -67,6 +70,7 @@ class CloudSyncDel(_PluginBase):
"enabled": self._enabled,
"notify": self._notify,
"path": config.get("path"),
"url": self._url,
"del_history": False
})
@@ -165,6 +169,12 @@ class CloudSyncDel(_PluginBase):
media_type = MediaType.MOVIE if media_type in ["Movie", "MOV"] else MediaType.TV
if cloud_file_flag and self._notify:
if self._url:
RequestUtils().post(url=self._url, json={
"path": str(media_path),
"type": "del"
})
backrop_image = self.chain.obtain_specific_image(
mediaid=tmdb_id,
mtype=media_type,
@@ -382,6 +392,27 @@ class CloudSyncDel(_PluginBase):
}
]
},
{
'component': 'VRow',
'content': [
{
'component': 'VCol',
'props': {
'cols': 12,
},
'content': [
{
'component': 'VTextField',
'props': {
'model': 'url',
'label': '任务推送url',
'placeholder': 'post请求json方式推送path和type(del)字段'
}
}
]
},
]
},
{
'component': 'VRow',
'content': [
@@ -433,6 +464,7 @@ class CloudSyncDel(_PluginBase):
], {
"enabled": False,
"path": "",
"url": "",
"local_path": "",
"notify": False,
"del_history": False

View File

@@ -20,6 +20,7 @@ from app.core.event import eventmanager, Event
from app.log import logger
from app.plugins import _PluginBase
from app.schemas.types import EventType, SystemConfigKey
from app.utils.http import RequestUtils
from app.utils.system import SystemUtils
lock = threading.Lock()
@@ -52,7 +53,7 @@ class FileSoftLink(_PluginBase):
# 插件图标
plugin_icon = "https://raw.githubusercontent.com/thsrite/MoviePilot-Plugins/main/icons/softlink.png"
# 插件版本
plugin_version = "2.0"
plugin_version = "2.0.1"
# 插件作者
plugin_author = "thsrite"
# 作者主页
@@ -71,6 +72,7 @@ class FileSoftLink(_PluginBase):
_onlyonce = False
_copy_files = False
_cron = None
_url = None
_size = 0
# 模式 compatibility/fast
_mode = "compatibility"
@@ -99,6 +101,7 @@ class FileSoftLink(_PluginBase):
self._monitor_dirs = config.get("monitor_dirs") or ""
self._exclude_keywords = config.get("exclude_keywords") or ""
self._cron = config.get("cron")
self._url = config.get("url")
self._size = config.get("size") or 0
self._rmt_mediaext = config.get(
"rmt_mediaext") or ".mp4, .mkv, .ts, .iso,.rmvb, .avi, .mov, .mpeg,.mpg, .wmv, .3gp, .asf, .m4v, .flv, .m2ts, .strm,.tp, .f4v"
@@ -234,6 +237,7 @@ class FileSoftLink(_PluginBase):
"monitor_dirs": self._monitor_dirs,
"exclude_keywords": self._exclude_keywords,
"cron": self._cron,
"url": self._url,
"size": self._size,
"rmt_mediaext": self._rmt_mediaext
})
@@ -555,6 +559,11 @@ class FileSoftLink(_PluginBase):
self._rmt_mediaext.split(",")]:
retcode, retmsg = SystemUtils.softlink(file_path, Path(target_file))
logger.info(f"创建媒体文件软连接 {str(file_path)}{target_file} {retcode} {retmsg}")
if self._url:
RequestUtils().post(url=self._url, json={
"path": str(file_path),
"type": "add"
})
else:
if self._copy_files:
# 其他nfo、jpg等复制文件
@@ -823,6 +832,27 @@ class FileSoftLink(_PluginBase):
}
]
},
{
'component': 'VRow',
'content': [
{
'component': 'VCol',
'props': {
'cols': 12,
},
'content': [
{
'component': 'VTextField',
'props': {
'model': 'url',
'label': '任务推送url',
'placeholder': 'post请求json方式推送path和type(add)字段'
}
}
]
},
]
},
{
'component': 'VRow',
'content': [
@@ -855,6 +885,7 @@ class FileSoftLink(_PluginBase):
"exclude_keywords": "",
"cron": "",
"size": 0,
"url": "",
"rmt_mediaext": ".mp4, .mkv, .ts, .iso,.rmvb, .avi, .mov, .mpeg,.mpg, .wmv, .3gp, .asf, .m4v, .flv, .m2ts, .strm,.tp, .f4v"
}