fix 目录监控判断

This commit is contained in:
thsrite
2023-08-25 21:04:18 +08:00
parent bb93919707
commit 624365542c

View File

@ -138,11 +138,11 @@ class DirMonitor(_PluginBase):
target_path = Path(paths[1])
self._dirconf[mon_path] = target_path
# 检查目录是不是媒体库目录的子目录
# 检查媒体库目录是不是下载目录的子目录
try:
if Path(mon_path).is_relative_to(target_path or settings.LIBRARY_PATH):
logger.warn(f"{mon_path} 是媒体库目录/目的目录的子目录,无法监控")
self.systemmessage.put(f"{mon_path}媒体库目录的子目录,无法监控")
if target_path.is_relative_to(Path(mon_path)):
logger.warn(f"{target_path} 是下载目录 {mon_path} 的子目录,无法监控")
self.systemmessage.put(f"{target_path}下载目录 {mon_path} 的子目录,无法监控")
continue
except Exception as e:
pass