mirror of
https://github.com/thsrite/MoviePilot-Plugins.git
synced 2026-06-06 23:16:47 +00:00
fix
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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"
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user