mirror of
https://github.com/jxxghp/MoviePilot.git
synced 2026-09-05 07:27:15 +08:00
Merge pull request #2911 from thsrite/v2
This commit is contained in:
+6
-3
@@ -149,14 +149,17 @@ class Monitor(metaclass=Singleton):
|
|||||||
if mon_dir.storage == "local":
|
if mon_dir.storage == "local":
|
||||||
# 本地目录监控
|
# 本地目录监控
|
||||||
try:
|
try:
|
||||||
observer = self.__choose_observer()
|
if mon_dir.monitor_mode == "fast":
|
||||||
|
observer = self.__choose_observer()
|
||||||
|
else:
|
||||||
|
observer = PollingObserver()
|
||||||
self._observers.append(observer)
|
self._observers.append(observer)
|
||||||
observer.schedule(FileMonitorHandler(mon_path=mon_path, callback=self),
|
observer.schedule(FileMonitorHandler(mon_path=mon_path, callback=self),
|
||||||
path=mon_path,
|
path=str(mon_path),
|
||||||
recursive=True)
|
recursive=True)
|
||||||
observer.daemon = True
|
observer.daemon = True
|
||||||
observer.start()
|
observer.start()
|
||||||
logger.info(f"已启动 {mon_path} 的目录监控服务")
|
logger.info(f"已启动 {mon_path} 的目录监控服务, 监控模式:{mon_dir.monitor_mode}")
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
err_msg = str(e)
|
err_msg = str(e)
|
||||||
if "inotify" in err_msg and "reached" in err_msg:
|
if "inotify" in err_msg and "reached" in err_msg:
|
||||||
|
|||||||
@@ -113,6 +113,8 @@ class TransferDirectoryConf(BaseModel):
|
|||||||
download_category_folder: Optional[bool] = False
|
download_category_folder: Optional[bool] = False
|
||||||
# 监控方式 downloader/monitor,None为不监控
|
# 监控方式 downloader/monitor,None为不监控
|
||||||
monitor_type: Optional[str] = None
|
monitor_type: Optional[str] = None
|
||||||
|
# 监控模式 fast / compatibility
|
||||||
|
monitor_mode: Optional[str] = 'fast'
|
||||||
# 整理方式 move/copy/link/softlink
|
# 整理方式 move/copy/link/softlink
|
||||||
transfer_type: Optional[str] = None
|
transfer_type: Optional[str] = None
|
||||||
# 文件覆盖模式 always/size/never/latest
|
# 文件覆盖模式 always/size/never/latest
|
||||||
|
|||||||
Reference in New Issue
Block a user