fix 云盘Strm生成v4.1支持自定义媒体类型

This commit is contained in:
thsrite
2024-06-07 23:41:10 +08:00
parent ac8ba98f0a
commit e13a190cee
4 changed files with 41 additions and 9 deletions

View File

@@ -26,7 +26,7 @@ class CloudStrm(_PluginBase):
# 插件图标
plugin_icon = "https://raw.githubusercontent.com/thsrite/MoviePilot-Plugins/main/icons/create.png"
# 插件版本
plugin_version = "4.0"
plugin_version = "4.1"
# 插件作者
plugin_author = "thsrite"
# 作者主页
@@ -56,6 +56,7 @@ class CloudStrm(_PluginBase):
_cloudurlconf = {}
_cloudpathconf = {}
__cloud_files = []
_rmt_mediaext = ".mp4, .mkv, .ts, .iso,.rmvb, .avi, .mov, .mpeg,.mpg, .wmv, .3gp, .asf, .m4v, .flv, .m2ts, .strm,.tp, .f4v"
# 定时器
_scheduler: Optional[BackgroundScheduler] = None
@@ -78,6 +79,8 @@ class CloudStrm(_PluginBase):
self._https = config.get("https")
self._copy_files = config.get("copy_files")
self._monitor_confs = config.get("monitor_confs")
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"
# 停止现有任务
self.stop_service()
@@ -233,7 +236,8 @@ class CloudStrm(_PluginBase):
continue
# 不复制非媒体文件时直接过滤掉非媒体文件
if not self._copy_files and Path(file).suffix not in settings.RMT_MEDIAEXT:
if not self._copy_files and Path(file).suffix not in [ext.strip() for ext in
self._rmt_mediaext.split(",")]:
continue
if source_file not in self.__cloud_files:
@@ -280,7 +284,8 @@ class CloudStrm(_PluginBase):
continue
# 不复制非媒体文件时直接过滤掉非媒体文件
if not self._copy_files and Path(file).suffix not in settings.RMT_MEDIAEXT:
if not self._copy_files and Path(file).suffix not in [ext.strip() for ext in
self._rmt_mediaext.split(",")]:
continue
logger.info(f"扫描到新文件 {source_file},正在开始处理")
@@ -343,7 +348,8 @@ class CloudStrm(_PluginBase):
os.makedirs(Path(dest_file).parent)
# 视频文件创建.strm文件
if Path(dest_file).suffix in settings.RMT_MEDIAEXT:
if Path(dest_file).suffix in [ext.strip() for ext in
self._rmt_mediaext.split(",")]:
# 创建.strm文件
self.__create_strm_file(scheme="https" if self._https else "http",
dest_file=dest_file,
@@ -433,7 +439,8 @@ class CloudStrm(_PluginBase):
"copy_files": self._copy_files,
"https": self._https,
"cron": self._cron,
"monitor_confs": self._monitor_confs
"monitor_confs": self._monitor_confs,
"rmt_mediaext": self._rmt_mediaext
})
def get_state(self) -> bool:
@@ -638,6 +645,28 @@ class CloudStrm(_PluginBase):
},
]
},
{
'component': 'VRow',
'content': [
{
'component': 'VCol',
'props': {
'cols': 12
},
'content': [
{
'component': 'VTextarea',
'props': {
'model': 'rmt_mediaext',
'label': '视频格式',
'rows': 2,
'placeholder': ".mp4, .mkv, .ts, .iso,.rmvb, .avi, .mov, .mpeg,.mpg, .wmv, .3gp, .asf, .m4v, .flv, .m2ts, .strm,.tp, .f4v"
}
}
]
}
]
},
{
'component': 'VRow',
'content': [
@@ -737,7 +766,8 @@ class CloudStrm(_PluginBase):
"rebuild": False,
"copy_files": False,
"https": False,
"monitor_confs": ""
"monitor_confs": "",
"rmt_mediaext": ".mp4, .mkv, .ts, .iso,.rmvb, .avi, .mov, .mpeg,.mpg, .wmv, .3gp, .asf, .m4v, .flv, .m2ts, .strm,.tp, .f4v"
}
def get_page(self) -> List[dict]: