From 3ff8fbe6b39bd6713a7dfb58f315dec87c29377f Mon Sep 17 00:00:00 2001 From: thsrite Date: Wed, 22 Nov 2023 11:21:28 +0800 Subject: [PATCH] =?UTF-8?q?feat=20=E4=BA=91=E7=9B=98strm=E7=94=9F=E6=88=90?= =?UTF-8?q?=E6=8F=92=E4=BB=B6=E8=AF=B4=E6=98=8E?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- plugins/cloudstrm/__init__.py | 433 ++++++++++++++++++---------------- plugins_record/CloudStrm.md | 29 ++- plugins_record/StrmConvert.md | 2 +- 3 files changed, 257 insertions(+), 207 deletions(-) diff --git a/plugins/cloudstrm/__init__.py b/plugins/cloudstrm/__init__.py index 7ffa956..bad6fdf 100644 --- a/plugins/cloudstrm/__init__.py +++ b/plugins/cloudstrm/__init__.py @@ -144,7 +144,8 @@ class CloudStrm(_PluginBase): # 异步开启云盘监控 logger.info(f"异步开启云盘监控 {source_dir} {mode}") self._scheduler.add_job(func=self.start_monitor, trigger='date', - run_date=datetime.now(tz=pytz.timezone(settings.TZ)) + timedelta(seconds=int(self._relay)), + run_date=datetime.now(tz=pytz.timezone(settings.TZ)) + timedelta( + seconds=int(self._relay)), name=f"云盘监控 {source_dir}", kwargs={ "mode": mode, @@ -427,210 +428,232 @@ class CloudStrm(_PluginBase): 拼装插件配置页面,需要返回两块数据:1、页面配置;2、数据结构 """ return [ - { - 'component': 'VForm', - 'content': [ - { - 'component': 'VRow', - 'content': [ - { - 'component': 'VCol', - 'props': { - 'cols': 12, - 'md': 6 - }, - 'content': [ - { - 'component': 'VSwitch', - 'props': { - 'model': 'enabled', - 'label': '启用插件', - } - } - ] - }, - { - 'component': 'VCol', - 'props': { - 'cols': 12, - 'md': 6 - }, - 'content': [ - { - 'component': 'VSwitch', - 'props': { - 'model': 'onlyonce', - 'label': '立即运行一次', - } - } - ] - } - ] - }, - { - 'component': 'VRow', - 'content': [ - { - 'component': 'VCol', - 'props': { - 'cols': 12 - }, - 'content': [ - { - 'component': 'VTextField', - 'props': { - 'model': 'relay', - 'label': '监控延迟', - 'placeholder': '3' - } - } - ] - } - ] - }, - { - 'component': 'VRow', - 'content': [ - { - 'component': 'VCol', - 'props': { - 'cols': 12 - }, - 'content': [ - { - 'component': 'VTextarea', - 'props': { - 'model': 'monitor_confs', - 'label': '监控目录', - 'rows': 5, - 'placeholder': '监控方式#监控目录#目的目录#媒体服务器内路径' - } - } - ] - } - ] - }, - { - 'component': 'VRow', - 'content': [ - { - 'component': 'VCol', - 'props': { - 'cols': 12, - }, - 'content': [ - { - 'component': 'VAlert', - 'props': { - 'type': 'info', - 'variant': 'tonal', - 'text': '目录监控格式:' - '1.监控方式#监控目录#目的目录#媒体服务器内路径;' - '2.监控方式#监控目录#目的目录#cd2#cd2挂载本地跟路径#cd2服务地址;' - '3.监控方式#监控目录#目的目录#alist#alist挂载本地跟路径#alist服务地址。' - } - } - ] - } - ] - }, - { - 'component': 'VRow', - 'content': [ - { - 'component': 'VCol', - 'props': { - 'cols': 12, - }, - 'content': [ - { - 'component': 'VAlert', - 'props': { - 'type': 'info', - 'variant': 'tonal', - 'text': '媒体服务器内路径:' - '网盘映射本地路径挂载进媒体服务器的路径。' - } - } - ] - } - ] - }, - { - 'component': 'VRow', - 'content': [ - { - 'component': 'VCol', - 'props': { - 'cols': 12, - }, - 'content': [ - { - 'component': 'VAlert', - 'props': { - 'type': 'info', - 'variant': 'tonal', - 'text': '监控方式:' - 'fast:性能模式,内部处理系统操作类型选择最优解;' - 'compatibility:兼容模式,目录同步性能降低且NAS不能休眠,但可以兼容挂载的远程共享目录如SMB' - } - } - ] - } - ] - }, - { - 'component': 'VRow', - 'content': [ - { - 'component': 'VCol', - 'props': { - 'cols': 12, - }, - 'content': [ - { - 'component': 'VAlert', - 'props': { - 'type': 'info', - 'variant': 'tonal', - 'text': '立即运行一次:' - '全量运行一次。' - } - } - ] - } - ] - }, - { - 'component': 'VRow', - 'content': [ - { - 'component': 'VCol', - 'props': { - 'cols': 12, - }, - 'content': [ - { - 'component': 'VAlert', - 'props': { - 'type': 'info', - 'variant': 'tonal', - 'text': '由于unraid开启云盘监控很慢,所以采取异步方式开启磁盘监控,' - '具体开启情况可稍等3-5分钟查看日志。' - } - } - ] - } - ] - }, - ] - } - ], { - "enabled": False, - "relay": 3, - "onlyonce": False, - "monitor_confs": "" - } + { + 'component': 'VForm', + 'content': [ + { + 'component': 'VRow', + 'content': [ + { + 'component': 'VCol', + 'props': { + 'cols': 12, + 'md': 6 + }, + 'content': [ + { + 'component': 'VSwitch', + 'props': { + 'model': 'enabled', + 'label': '启用插件', + } + } + ] + }, + { + 'component': 'VCol', + 'props': { + 'cols': 12, + 'md': 6 + }, + 'content': [ + { + 'component': 'VSwitch', + 'props': { + 'model': 'onlyonce', + 'label': '立即运行一次', + } + } + ] + } + ] + }, + { + 'component': 'VRow', + 'content': [ + { + 'component': 'VCol', + 'props': { + 'cols': 12 + }, + 'content': [ + { + 'component': 'VTextField', + 'props': { + 'model': 'relay', + 'label': '监控延迟', + 'placeholder': '3' + } + } + ] + } + ] + }, + { + 'component': 'VRow', + 'content': [ + { + 'component': 'VCol', + 'props': { + 'cols': 12 + }, + 'content': [ + { + 'component': 'VTextarea', + 'props': { + 'model': 'monitor_confs', + 'label': '监控目录', + 'rows': 5, + 'placeholder': '监控方式#监控目录#目的目录#媒体服务器内源文件路径' + } + } + ] + } + ] + }, + { + 'component': 'VRow', + 'content': [ + { + 'component': 'VCol', + 'props': { + 'cols': 12, + }, + 'content': [ + { + 'component': 'VAlert', + 'props': { + 'type': 'info', + 'variant': 'tonal', + 'text': '目录监控格式:' + '1.监控方式#监控目录#目的目录#媒体服务器内源文件路径;' + '2.监控方式#监控目录#目的目录#cd2#cd2挂载本地跟路径#cd2服务地址;' + '3.监控方式#监控目录#目的目录#alist#alist挂载本地跟路径#alist服务地址。' + } + } + ] + } + ] + }, + { + 'component': 'VRow', + 'content': [ + { + 'component': 'VCol', + 'props': { + 'cols': 12, + }, + 'content': [ + { + 'component': 'VAlert', + 'props': { + 'type': 'info', + 'variant': 'tonal', + 'text': '媒体服务器内源文件路径:' + '源文件目录即云盘挂载到媒体服务器的路径。' + } + } + ] + } + ] + }, + { + 'component': 'VRow', + 'content': [ + { + 'component': 'VCol', + 'props': { + 'cols': 12, + }, + 'content': [ + { + 'component': 'VAlert', + 'props': { + 'type': 'info', + 'variant': 'tonal', + 'text': '监控方式:' + 'fast:性能模式(快);' + 'compatibility:兼容模式(稳,推荐)' + } + } + ] + } + ] + }, + { + 'component': 'VRow', + 'content': [ + { + 'component': 'VCol', + 'props': { + 'cols': 12, + }, + 'content': [ + { + 'component': 'VAlert', + 'props': { + 'type': 'info', + 'variant': 'tonal', + 'text': '立即运行一次:' + '全量运行一次。' + } + } + ] + } + ] + }, + { + 'component': 'VRow', + 'content': [ + { + 'component': 'VCol', + 'props': { + 'cols': 12, + }, + 'content': [ + { + 'component': 'VAlert', + 'props': { + 'type': 'info', + 'variant': 'tonal', + 'text': '由于unraid开启云盘监控很慢,所以采取异步方式开启磁盘监控,' + '具体开启情况可稍等3-5分钟查看日志。' + } + } + ] + } + ] + }, + { + 'component': 'VRow', + 'content': [ + { + 'component': 'VCol', + 'props': { + 'cols': 12, + }, + 'content': [ + { + 'component': 'VAlert', + 'props': { + 'type': 'info', + 'variant': 'tonal', + 'text': '配置说明:' + 'https://raw.githubusercontent.com/thsrite/MoviePilot-Plugins/main/plugins_record/CloudStrm.md' + } + } + ] + } + ] + } + ] + } + ], { + "enabled": False, + "relay": 3, + "onlyonce": False, + "monitor_confs": "" + } def get_page(self) -> List[dict]: pass diff --git a/plugins_record/CloudStrm.md b/plugins_record/CloudStrm.md index 4ef4d9d..af2971b 100644 --- a/plugins_record/CloudStrm.md +++ b/plugins_record/CloudStrm.md @@ -10,4 +10,31 @@ - 1.1 支持alist链接模式 - 1.0 监控文件创建,生成strm文件 -### 使用说明 \ No newline at end of file +### 使用说明 + +目录监控格式: + +- 1.监控方式#监控目录#目的目录#媒体服务器内源文件路径 +- 2.监控方式#监控目录#目的目录#cd2#cd2挂载本地跟路径#cd2服务地址 +- 3.监控方式#监控目录#目的目录#alist#alist挂载本地跟路径#alist服务地址 + +监控方式: + +- fast:性能模式,内部处理系统操作类型选择最优解 +- compatibility:兼容模式,目录同步性能降低且NAS不能休眠,但可以兼容挂载的远程共享目录如SMB (建议使用) + +路径: + +- 监控目录:源文件目录即云盘挂载到MoviePilot中的路径 +- 目的路径:MoviePilot中strm生成路径 +- 媒体服务器内源文件路径:源文件目录即云盘挂载到媒体服务器的路径 + +示例: + +- MoviePilot上云盘源文件路径 /mount/cloud/aliyun/emby`/tvshow/爸爸去哪儿/Season 5/14.特别版.mp4` + +- MoviePilot上strm生成路径 /mnt/link/aliyun`/tvshow/爸爸去哪儿/Season 5/14.特别版.strm` + +- 媒体服务器内源文件路径 /mount/cloud/aliyun/emby`/tvshow/爸爸去哪儿/Season 5/14.特别版.mp4` + +- 监控配置为:compatibility#/mount/cloud/aliyun/emby#/mnt/link/aliyun#/mount/cloud/aliyun/emby diff --git a/plugins_record/StrmConvert.md b/plugins_record/StrmConvert.md index cfff58a..79911f0 100644 --- a/plugins_record/StrmConvert.md +++ b/plugins_record/StrmConvert.md @@ -7,7 +7,7 @@ ### 使用说明 #### 本地模式 -- MoviePilot上strm视频根路径 /mnt/link/aliyun`/tvshow/爸爸去哪儿/Season 5/14.特别版.strm` +- MoviePilot上strm视频路径 /mnt/link/aliyun`/tvshow/爸爸去哪儿/Season 5/14.特别版.strm` - 云盘源文件挂载本地后 挂载`进媒体服务器的路径`,与上方对应 /mount/cloud/aliyun/emby`/tvshow/爸爸去哪儿/Season 5/14.特别版.mp4` - 转换配置为:`/mnt/link/aliyun#/mount/cloud/aliyun/emby`