Merge pull request #348 from thsrite/main

This commit is contained in:
jxxghp
2024-06-01 10:28:35 +08:00
committed by GitHub
2 changed files with 17 additions and 11 deletions

View File

@@ -134,11 +134,12 @@
"name": "媒体文件同步删除",
"description": "同步删除历史记录、源文件和下载任务。",
"labels": "文件整理",
"version": "1.6",
"version": "1.7",
"icon": "mediasyncdel.png",
"author": "thsrite",
"level": 1,
"history": {
"v1.7": "修复重新整理被一并删除问题",
"v1.6": "修复删除辅种",
"v1.5": "支持手动删除订阅历史记录(本次更新之后的历史)"
}

View File

@@ -29,7 +29,7 @@ class MediaSyncDel(_PluginBase):
# 插件图标
plugin_icon = "mediasyncdel.png"
# 插件版本
plugin_version = "1.6"
plugin_version = "1.7"
# 插件作者
plugin_author = "thsrite"
# 作者主页
@@ -754,6 +754,20 @@ class MediaSyncDel(_PluginBase):
logger.error(f"{media_name} 同步删除失败,未获取到媒体类型,请检查媒体是否刮削")
return
# 处理路径映射 (处理同一媒体多分辨率的情况)
if self._library_path:
paths = self._library_path.split("\n")
for path in paths:
sub_paths = path.split(":")
if len(sub_paths) < 2:
continue
media_path = media_path.replace(sub_paths[0], sub_paths[1]).replace('\\', '/')
# 兼容重新整理的场景
if Path(media_path).exists():
logger.warn(f"转移路径 {media_path} 未被删除或重新生成,跳过处理")
return
# 查询转移记录
msg, transfer_history = self.__get_transfer_his(media_type=media_type,
media_name=media_name,
@@ -890,15 +904,6 @@ class MediaSyncDel(_PluginBase):
# 类型
mtype = MediaType.MOVIE if media_type in ["Movie", "MOV"] else MediaType.TV
# 处理路径映射 (处理同一媒体多分辨率的情况)
if self._library_path:
paths = self._library_path.split("\n")
for path in paths:
sub_paths = path.split(":")
if len(sub_paths) < 2:
continue
media_path = media_path.replace(sub_paths[0], sub_paths[1]).replace('\\', '/')
# 删除电影
if mtype == MediaType.MOVIE:
msg = f'电影 {media_name} {tmdb_id}'