mirror of
https://github.com/thsrite/MoviePilot-Plugins.git
synced 2026-03-27 10:05:57 +00:00
fix 目录实时监控插件支持联动云盘Strm助手插件
This commit is contained in:
@@ -365,11 +365,12 @@
|
||||
"name": "目录实时监控",
|
||||
"description": "监控云盘目录文件变化,自动转移媒体文件。",
|
||||
"labels": "云盘,工具",
|
||||
"version": "2.5.1",
|
||||
"version": "2.5.2",
|
||||
"icon": "Linkease_A.png",
|
||||
"author": "thsrite",
|
||||
"level": 1,
|
||||
"history": {
|
||||
"v2.5.2": "支持联动[云盘Strm助手]插件",
|
||||
"v2.5.1": "修复媒体刮削",
|
||||
"v2.5": "兼容v2",
|
||||
"v2.4.5": "联动实时软连接插件(近媒体文件)",
|
||||
@@ -397,11 +398,12 @@
|
||||
"name": "云盘Strm助手",
|
||||
"description": "实时监控、定时全量增量生成strm文件。",
|
||||
"labels": "云盘",
|
||||
"version": "1.0.5",
|
||||
"version": "1.0.6",
|
||||
"icon": "https://raw.githubusercontent.com/thsrite/MoviePilot-Plugins/main/icons/cloudcompanion.png",
|
||||
"author": "thsrite",
|
||||
"level": 1,
|
||||
"history": {
|
||||
"v1.0.6": "支持[目录实时监控]插件联动",
|
||||
"v1.0.5": "增加复制非媒体文件选项",
|
||||
"v1.0.4": "修复实时监控,只处理指定类型的文件",
|
||||
"v1.0.3": "修复重建索引缓存",
|
||||
|
||||
@@ -62,7 +62,7 @@ class CloudLinkMonitor(_PluginBase):
|
||||
# 插件图标
|
||||
plugin_icon = "Linkease_A.png"
|
||||
# 插件版本
|
||||
plugin_version = "2.5.1"
|
||||
plugin_version = "2.5.2"
|
||||
# 插件作者
|
||||
plugin_author = "thsrite"
|
||||
# 作者主页
|
||||
@@ -89,6 +89,7 @@ class CloudLinkMonitor(_PluginBase):
|
||||
_scrape = False
|
||||
_refresh = False
|
||||
_softlink = False
|
||||
_strm = False
|
||||
_cron = None
|
||||
filetransfer = None
|
||||
mediaChain = None
|
||||
@@ -136,6 +137,7 @@ class CloudLinkMonitor(_PluginBase):
|
||||
self._cron = config.get("cron")
|
||||
self._size = config.get("size") or 0
|
||||
self._softlink = config.get("softlink")
|
||||
self._strm = config.get("strm")
|
||||
|
||||
# 停止现有任务
|
||||
self.stop_service()
|
||||
@@ -255,6 +257,7 @@ class CloudLinkMonitor(_PluginBase):
|
||||
"interval": self._interval,
|
||||
"history": self._history,
|
||||
"softlink": self._softlink,
|
||||
"strm": self._strm,
|
||||
"scrape": self._scrape,
|
||||
"size": self._size,
|
||||
"refresh": self._refresh,
|
||||
@@ -552,6 +555,13 @@ class CloudLinkMonitor(_PluginBase):
|
||||
'action': 'softlink_file'
|
||||
})
|
||||
|
||||
if self._strm:
|
||||
# 通知Strm助手生成
|
||||
self.eventmanager.send_event(EventType.PluginAction, {
|
||||
'file_path': str(transferinfo.target_item.path),
|
||||
'action': 'strm_file'
|
||||
})
|
||||
|
||||
# 移动模式删除空目录
|
||||
if transfer_type == "move":
|
||||
for file_dir in file_path.parents:
|
||||
@@ -792,12 +802,12 @@ class CloudLinkMonitor(_PluginBase):
|
||||
{
|
||||
'component': 'VSwitch',
|
||||
'props': {
|
||||
'model': 'softlink',
|
||||
'label': '联动实时软连接',
|
||||
'model': 'refresh',
|
||||
'label': '刷新媒体库',
|
||||
},
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
]
|
||||
}
|
||||
]
|
||||
@@ -818,12 +828,28 @@ class CloudLinkMonitor(_PluginBase):
|
||||
{
|
||||
'component': 'VSwitch',
|
||||
'props': {
|
||||
'model': 'refresh',
|
||||
'label': '刷新媒体库',
|
||||
'model': 'softlink',
|
||||
'label': '联动实时软连接',
|
||||
},
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
'component': 'VCol',
|
||||
'props': {
|
||||
'cols': 12,
|
||||
'md': 4
|
||||
},
|
||||
'content': [
|
||||
{
|
||||
'component': 'VSwitch',
|
||||
'props': {
|
||||
'model': 'strm',
|
||||
'label': '联动Strm助手',
|
||||
},
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
@@ -992,6 +1018,7 @@ class CloudLinkMonitor(_PluginBase):
|
||||
"scrape": False,
|
||||
"refresh": True,
|
||||
"softlink": False,
|
||||
"strm": False,
|
||||
"mode": "fast",
|
||||
"transfer_type": "filesoftlink",
|
||||
"monitor_dirs": "",
|
||||
|
||||
@@ -8,26 +8,24 @@ import urllib.parse
|
||||
from datetime import datetime, timedelta
|
||||
from io import BytesIO
|
||||
from pathlib import Path
|
||||
|
||||
import requests
|
||||
from p115client import P115Client
|
||||
from posixpath import join as join_path
|
||||
from re import compile as re_compile
|
||||
from posixpatht import escape
|
||||
import pytz
|
||||
from typing import Any, List, Dict, Tuple, Optional
|
||||
|
||||
import pytz
|
||||
import requests
|
||||
from apscheduler.schedulers.background import BackgroundScheduler
|
||||
from apscheduler.triggers.cron import CronTrigger
|
||||
from p115client import P115Client
|
||||
from posixpatht import escape
|
||||
from watchdog.events import FileSystemEventHandler
|
||||
from watchdog.observers.polling import PollingObserver
|
||||
|
||||
from app.core.config import settings
|
||||
from app.core.event import eventmanager, Event
|
||||
from app.schemas.types import EventType
|
||||
from apscheduler.schedulers.background import BackgroundScheduler
|
||||
from apscheduler.triggers.cron import CronTrigger
|
||||
|
||||
from app.log import logger
|
||||
from app.plugins import _PluginBase
|
||||
from app.core.config import settings
|
||||
from app.schemas.types import EventType
|
||||
|
||||
lock = threading.Lock()
|
||||
|
||||
@@ -59,7 +57,7 @@ class CloudStrmCompanion(_PluginBase):
|
||||
# 插件图标
|
||||
plugin_icon = "https://raw.githubusercontent.com/thsrite/MoviePilot-Plugins/main/icons/cloudcompanion.png"
|
||||
# 插件版本
|
||||
plugin_version = "1.0.5"
|
||||
plugin_version = "1.0.6"
|
||||
# 插件作者
|
||||
plugin_author = "thsrite"
|
||||
# 作者主页
|
||||
@@ -233,6 +231,31 @@ class CloudStrmCompanion(_PluginBase):
|
||||
self._scheduler.print_jobs()
|
||||
self._scheduler.start()
|
||||
|
||||
@eventmanager.register(EventType.PluginAction)
|
||||
def strm_one(self, event: Event = None):
|
||||
if event:
|
||||
event_data = event.event_data
|
||||
if not event_data or event_data.get("action") != "strm_file":
|
||||
return
|
||||
file_path = event_data.get("file_path")
|
||||
if not file_path:
|
||||
logger.error(f"缺少参数:{event_data}")
|
||||
return
|
||||
|
||||
# 遍历所有监控目录
|
||||
mon_path = None
|
||||
for mon in self._strm_dir_conf.keys():
|
||||
if str(file_path).startswith(mon):
|
||||
mon_path = mon
|
||||
break
|
||||
|
||||
if not mon_path:
|
||||
logger.error(f"未找到文件 {file_path} 对应的监控目录")
|
||||
return
|
||||
|
||||
# 处理单文件
|
||||
self.__handle_file(event_path=file_path, mon_path=mon_path)
|
||||
|
||||
@eventmanager.register(EventType.PluginAction)
|
||||
def scan(self, event: Event = None):
|
||||
"""
|
||||
|
||||
Reference in New Issue
Block a user