fix 修复消息发送 && Strm格式友好化

This commit is contained in:
thsrite
2024-11-18 10:35:51 +08:00
parent 0e4897f184
commit a841a4c8ba
2 changed files with 15 additions and 8 deletions

View File

@@ -404,11 +404,12 @@
"name": "云盘Strm助手",
"description": "实时监控、定时全量增量生成strm文件。",
"labels": "云盘",
"version": "1.1.5",
"version": "1.1.6",
"icon": "https://raw.githubusercontent.com/thsrite/MoviePilot-Plugins/main/icons/cloudcompanion.png",
"author": "thsrite",
"level": 1,
"history": {
"v1.1.6": "修复消息发送 && Strm格式友好化",
"v1.1.5": "生成Strm通知Emby刷新",
"v1.1.4": "消息发送支持媒体图片",
"v1.1.3": "支持消息发送",

View File

@@ -22,6 +22,7 @@ from posixpatht import escape
from watchdog.events import FileSystemEventHandler
from watchdog.observers.polling import PollingObserver
from app.chain.media import MediaChain
from app.core.config import settings
from app.core.event import eventmanager, Event
from app.core.metainfo import MetaInfoPath
@@ -63,7 +64,7 @@ class CloudStrmCompanion(_PluginBase):
# 插件图标
plugin_icon = "https://raw.githubusercontent.com/thsrite/MoviePilot-Plugins/main/icons/cloudcompanion.png"
# 插件版本
plugin_version = "1.1.5"
plugin_version = "1.1.6"
# 插件作者
plugin_author = "thsrite"
# 作者主页
@@ -444,6 +445,11 @@ class CloudStrmCompanion(_PluginBase):
"""
格式化strm内容
"""
# 正则表达式匹配括号内的内容
pattern = r"\((.*?)\)"
# 替换括号及内容url编码
format_str = re.sub(pattern, lambda m: urllib.parse.quote(m.group(1)), format_str)
if "{local_file}" in format_str:
return format_str.replace("{local_file}", local_file)
elif "{cloud_file}" in format_str:
@@ -506,7 +512,7 @@ class CloudStrmCompanion(_PluginBase):
if file_meta.begin_episode:
if episodes:
if int(file_meta.begin_episode) not in episodes:
episodes = episodes.append(int(file_meta.begin_episode))
episodes.append(int(file_meta.begin_episode))
else:
episodes = [int(file_meta.begin_episode)]
media_list = {
@@ -886,7 +892,7 @@ class CloudStrmCompanion(_PluginBase):
file_meta = media_list.get("file_meta")
mtype = media_list.get("type")
episodes = media_list.get("episodes")
if not last_update_time or not episodes:
if not last_update_time:
continue
# 判断剧集最后更新时间距现在是已超过10秒或者电影发送消息
@@ -906,7 +912,7 @@ class CloudStrmCompanion(_PluginBase):
season_episode = f"{medis_title_year_season}"
# 获取封面图片
mediainfo: MediaInfo = self.chain.recognize_by_meta(file_meta)
mediainfo: MediaInfo = MediaChain().recognize_by_meta(file_meta)
# 发送消息
self.send_transfer_message(msg_title=season_episode,
@@ -1336,10 +1342,10 @@ class CloudStrmCompanion(_PluginBase):
'props': {
'type': 'info',
'variant': 'tonal',
'text': 'strm格式化方式自行()替换为alist/cd2上路径url编码格式'
'text': 'strm格式化方式自行()填充alist/cd2上路径'
'1.本地源文件路径:{local_file}'
'2.alist路径http://192.168.31.103:5244/d(){cloud_file}'
'3.cd2路径http://192.168.31.103:19798/static/http/192.168.31.103:19798/False/(){cloud_file}'
'2.alist路径http://192.168.31.103:5244/d(/115){cloud_file}'
'3.cd2路径http://192.168.31.103:19798/static/http/192.168.31.103:19798/False/(/115){cloud_file}'
'4.其他api路径http://192.168.31.103:2001/{cloud_file}'
}
}