fix 目录监控判断
This commit is contained in:
@ -138,11 +138,11 @@ class DirMonitor(_PluginBase):
|
|||||||
target_path = Path(paths[1])
|
target_path = Path(paths[1])
|
||||||
self._dirconf[mon_path] = target_path
|
self._dirconf[mon_path] = target_path
|
||||||
|
|
||||||
# 检查目录是不是媒体库目录的子目录
|
# 检查媒体库目录是不是下载目录的子目录
|
||||||
try:
|
try:
|
||||||
if Path(mon_path).is_relative_to(target_path or settings.LIBRARY_PATH):
|
if target_path.is_relative_to(Path(mon_path)):
|
||||||
logger.warn(f"{mon_path} 是媒体库目录/目的目录的子目录,无法监控")
|
logger.warn(f"{target_path} 是下载目录 {mon_path} 的子目录,无法监控")
|
||||||
self.systemmessage.put(f"{mon_path} 是媒体库目录的子目录,无法监控")
|
self.systemmessage.put(f"{target_path} 是下载目录 {mon_path} 的子目录,无法监控")
|
||||||
continue
|
continue
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
pass
|
pass
|
||||||
@ -516,149 +516,149 @@ class DirMonitor(_PluginBase):
|
|||||||
|
|
||||||
def get_form(self) -> Tuple[List[dict], Dict[str, Any]]:
|
def get_form(self) -> Tuple[List[dict], Dict[str, Any]]:
|
||||||
return [
|
return [
|
||||||
{
|
{
|
||||||
'component': 'VForm',
|
'component': 'VForm',
|
||||||
'content': [
|
'content': [
|
||||||
{
|
{
|
||||||
'component': 'VRow',
|
'component': 'VRow',
|
||||||
'content': [
|
'content': [
|
||||||
{
|
{
|
||||||
'component': 'VCol',
|
'component': 'VCol',
|
||||||
'props': {
|
'props': {
|
||||||
'cols': 12,
|
'cols': 12,
|
||||||
'md': 6
|
'md': 6
|
||||||
},
|
},
|
||||||
'content': [
|
'content': [
|
||||||
{
|
{
|
||||||
'component': 'VSwitch',
|
'component': 'VSwitch',
|
||||||
'props': {
|
'props': {
|
||||||
'model': 'enabled',
|
'model': 'enabled',
|
||||||
'label': '启用插件',
|
'label': '启用插件',
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
'component': 'VCol',
|
'component': 'VCol',
|
||||||
'props': {
|
'props': {
|
||||||
'cols': 12,
|
'cols': 12,
|
||||||
'md': 6
|
'md': 6
|
||||||
},
|
},
|
||||||
'content': [
|
'content': [
|
||||||
{
|
{
|
||||||
'component': 'VSwitch',
|
'component': 'VSwitch',
|
||||||
'props': {
|
'props': {
|
||||||
'model': 'notify',
|
'model': 'notify',
|
||||||
'label': '发送通知',
|
'label': '发送通知',
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
'component': 'VRow',
|
'component': 'VRow',
|
||||||
'content': [
|
'content': [
|
||||||
{
|
{
|
||||||
'component': 'VCol',
|
'component': 'VCol',
|
||||||
'props': {
|
'props': {
|
||||||
'cols': 12,
|
'cols': 12,
|
||||||
'md': 6
|
'md': 6
|
||||||
},
|
},
|
||||||
'content': [
|
'content': [
|
||||||
{
|
{
|
||||||
'component': 'VSelect',
|
'component': 'VSelect',
|
||||||
'props': {
|
'props': {
|
||||||
'model': 'mode',
|
'model': 'mode',
|
||||||
'label': '监控模式',
|
'label': '监控模式',
|
||||||
'items': [
|
'items': [
|
||||||
{'title': '兼容模式', 'value': 'compatibility'},
|
{'title': '兼容模式', 'value': 'compatibility'},
|
||||||
{'title': '性能模式', 'value': 'fast'}
|
{'title': '性能模式', 'value': 'fast'}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
'component': 'VCol',
|
'component': 'VCol',
|
||||||
'props': {
|
'props': {
|
||||||
'cols': 12,
|
'cols': 12,
|
||||||
'md': 6
|
'md': 6
|
||||||
},
|
},
|
||||||
'content': [
|
'content': [
|
||||||
{
|
{
|
||||||
'component': 'VSelect',
|
'component': 'VSelect',
|
||||||
'props': {
|
'props': {
|
||||||
'model': 'transfer_type',
|
'model': 'transfer_type',
|
||||||
'label': '转移方式',
|
'label': '转移方式',
|
||||||
'items': [
|
'items': [
|
||||||
{'title': '移动', 'value': 'move'},
|
{'title': '移动', 'value': 'move'},
|
||||||
{'title': '复制', 'value': 'copy'},
|
{'title': '复制', 'value': 'copy'},
|
||||||
{'title': '硬链接', 'value': 'link'},
|
{'title': '硬链接', 'value': 'link'},
|
||||||
{'title': '软链接', 'value': 'softlink'}
|
{'title': '软链接', 'value': 'softlink'}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
'component': 'VRow',
|
'component': 'VRow',
|
||||||
'content': [
|
'content': [
|
||||||
{
|
{
|
||||||
'component': 'VCol',
|
'component': 'VCol',
|
||||||
'props': {
|
'props': {
|
||||||
'cols': 12
|
'cols': 12
|
||||||
},
|
},
|
||||||
'content': [
|
'content': [
|
||||||
{
|
{
|
||||||
'component': 'VTextarea',
|
'component': 'VTextarea',
|
||||||
'props': {
|
'props': {
|
||||||
'model': 'monitor_dirs',
|
'model': 'monitor_dirs',
|
||||||
'label': '监控目录',
|
'label': '监控目录',
|
||||||
'rows': 5,
|
'rows': 5,
|
||||||
'placeholder': '每一行一个目录,支持两种配置方式:\n'
|
'placeholder': '每一行一个目录,支持两种配置方式:\n'
|
||||||
'监控目录\n'
|
'监控目录\n'
|
||||||
'监控目录:转移目的目录'
|
'监控目录:转移目的目录'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
'component': 'VRow',
|
'component': 'VRow',
|
||||||
'content': [
|
'content': [
|
||||||
{
|
{
|
||||||
'component': 'VCol',
|
'component': 'VCol',
|
||||||
'props': {
|
'props': {
|
||||||
'cols': 12
|
'cols': 12
|
||||||
},
|
},
|
||||||
'content': [
|
'content': [
|
||||||
{
|
{
|
||||||
'component': 'VTextarea',
|
'component': 'VTextarea',
|
||||||
'props': {
|
'props': {
|
||||||
'model': 'exclude_keywords',
|
'model': 'exclude_keywords',
|
||||||
'label': '排除关键词',
|
'label': '排除关键词',
|
||||||
'rows': 2,
|
'rows': 2,
|
||||||
'placeholder': '每一行一个关键词'
|
'placeholder': '每一行一个关键词'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
], {
|
], {
|
||||||
"enabled": False,
|
"enabled": False,
|
||||||
"notify": False,
|
"notify": False,
|
||||||
"mode": "fast",
|
"mode": "fast",
|
||||||
"transfer_type": settings.TRANSFER_TYPE,
|
"transfer_type": settings.TRANSFER_TYPE,
|
||||||
"monitor_dirs": "",
|
"monitor_dirs": "",
|
||||||
"exclude_keywords": ""
|
"exclude_keywords": ""
|
||||||
}
|
}
|
||||||
|
|
||||||
def get_page(self) -> List[dict]:
|
def get_page(self) -> List[dict]:
|
||||||
pass
|
pass
|
||||||
|
Reference in New Issue
Block a user