mirror of
https://github.com/thsrite/MoviePilot-Plugins.git
synced 2026-03-27 10:05:57 +00:00
fix 云盘同步删除 v1.5.3
修复删除文件夹包含本地+云盘的场景
This commit is contained in:
@@ -44,7 +44,7 @@ MoviePilot三方插件市场:https://github.com/thsrite/MoviePilot-Plugins/
|
||||
- 命令执行器 v1.2
|
||||
- [CloudDrive2助手v1.8.1](docs%2FCd2Assistant.md)
|
||||
- 软连接重定向 v1.1
|
||||
- 云盘同步删除 v1.5.2
|
||||
- 云盘同步删除 v1.5.3
|
||||
- 媒体库重复媒体检测 v1.9
|
||||
- 演员作品订阅 v1.0
|
||||
- 文件复制 v1.0
|
||||
|
||||
@@ -622,11 +622,12 @@
|
||||
"name": "云盘同步删除",
|
||||
"description": "媒体库删除软连接文件后,同步删除云盘文件。",
|
||||
"labels": "云盘",
|
||||
"version": "1.5.2",
|
||||
"version": "1.5.3",
|
||||
"icon": "clouddisk.png",
|
||||
"author": "thsrite",
|
||||
"level": 2,
|
||||
"history": {
|
||||
"v1.5.3": "修复删除文件夹包含本地+云盘的场景",
|
||||
"v1.5.2": "修复直接删除本地文件夹的场景",
|
||||
"v1.5.1": "不重要的更新",
|
||||
"v1.5": "支持软连接指向本地路径的同步删除",
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import os
|
||||
import shutil
|
||||
import time
|
||||
from pathlib import Path
|
||||
@@ -22,7 +23,7 @@ class CloudSyncDel(_PluginBase):
|
||||
# 插件图标
|
||||
plugin_icon = "clouddisk.png"
|
||||
# 插件版本
|
||||
plugin_version = "1.5.2"
|
||||
plugin_version = "1.5.3"
|
||||
# 插件作者
|
||||
plugin_author = "thsrite"
|
||||
# 作者主页
|
||||
@@ -74,7 +75,7 @@ class CloudSyncDel(_PluginBase):
|
||||
})
|
||||
|
||||
@eventmanager.register(EventType.PluginAction)
|
||||
def clouddisk_del(self, event: Event):
|
||||
def clouddisk_del(self, event: Event = None):
|
||||
if not self._enabled:
|
||||
return
|
||||
if not event:
|
||||
@@ -102,7 +103,11 @@ class CloudSyncDel(_PluginBase):
|
||||
logger.info(f"获取到本地文件路径 {local_path}")
|
||||
if Path(local_path).exists() and (
|
||||
Path(local_path).is_dir() or (Path(local_path).is_file() and not Path(local_path).is_symlink())):
|
||||
Path(local_path).unlink()
|
||||
if Path(local_path).is_dir():
|
||||
shutil.rmtree(local_path)
|
||||
elif Path(local_path).is_file():
|
||||
Path(local_path).unlink() # 删除文件
|
||||
|
||||
logger.info(f"获取到本地路径 {local_path}, 通知媒体库同步删除插件删除")
|
||||
eventItem = schemas.WebhookEventInfo(event="media_del", channel="emby")
|
||||
eventItem.item_type = media_type
|
||||
|
||||
Reference in New Issue
Block a user