mirror of
https://github.com/jxxghp/MoviePilot.git
synced 2026-09-08 17:08:35 +08:00
fix #3079
This commit is contained in:
@@ -115,6 +115,8 @@ class StorageChain(ChainBase):
|
|||||||
if not state:
|
if not state:
|
||||||
logger.warn(f"【{fileitem.storage}】{fileitem.path} 删除失败")
|
logger.warn(f"【{fileitem.storage}】{fileitem.path} 删除失败")
|
||||||
return False
|
return False
|
||||||
|
if fileitem.type == "dir":
|
||||||
|
return True
|
||||||
# 上级目录
|
# 上级目录
|
||||||
if mtype and mtype == MediaType.TV:
|
if mtype and mtype == MediaType.TV:
|
||||||
dir_path = Path(fileitem.path).parent.parent
|
dir_path = Path(fileitem.path).parent.parent
|
||||||
|
|||||||
+7
-8
@@ -478,14 +478,13 @@ class Monitor(metaclass=Singleton):
|
|||||||
|
|
||||||
# 移动模式删除空目录
|
# 移动模式删除空目录
|
||||||
if transferinfo.transfer_type in ["move"]:
|
if transferinfo.transfer_type in ["move"]:
|
||||||
logger.info(f"正在删除: {file_item.storage} {file_item.path}")
|
if file_item.type == "dir":
|
||||||
if self.storagechain.delete_file(file_item):
|
folder_item = file_item
|
||||||
# 删除空的父目录
|
else:
|
||||||
dir_item = self.storagechain.get_parent_item(file_item)
|
folder_item = self.storagechain.get_parent_item(file_item)
|
||||||
if dir_item:
|
if folder_item and not self.storagechain.any_files(folder_item, extensions=settings.RMT_MEDIAEXT):
|
||||||
if not self.storagechain.any_files(dir_item, extensions=settings.RMT_MEDIAEXT):
|
logger.warn(f"删除残留空文件夹:【{folder_item.storage}】{folder_item.path}")
|
||||||
logger.warn(f"正在删除空目录: {dir_item.storage} {dir_item.path}")
|
self.storagechain.delete_file(folder_item)
|
||||||
return self.storagechain.delete_file(dir_item)
|
|
||||||
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.error("目录监控发生错误:%s - %s" % (str(e), traceback.format_exc()))
|
logger.error("目录监控发生错误:%s - %s" % (str(e), traceback.format_exc()))
|
||||||
|
|||||||
Reference in New Issue
Block a user