Compare commits

..

No commits in common. "5809871cf1b0b33aa67156ce0d56ff30417f6bf0" and "8e27444f0ede7653dcbb5c1c4d675376a407aefe" have entirely different histories.

3 changed files with 9 additions and 16 deletions

View File

@ -315,9 +315,7 @@ def get_share_detail():
)
for share_file in data["list"]:
search_pattern = (
task["update_subdir"]
if share_file["dir"] and task.get("update_subdir")
else pattern
task.get("update_subdir", "") if share_file["dir"] else pattern
)
if re.search(search_pattern, share_file["file_name"]):
# 文件名重命名,目录不重命名

View File

@ -25,7 +25,7 @@ class Alist_sync:
default_task_config = {
"enable": False, # 当前任务开关,
"save_path": "", # 需要同步目录,默认空时路径则会与夸克的保存路径一致,不开启完整路径模式时,默认根目录为保存驱动的根目录
"verify_path": "", # 验证目录主要用于影视库避免重复文件一般配合alist的别名功能及full_path_mode使用,用于多个网盘的源合并成一个目录
"verify_path": "", # 验证目录主要用于影视库避免重复文件一般配合alist的别名功能及full_path使用,用于多个网盘的源合并成一个目录
"full_path_mode": False, # 完整路径模式
# 完整路径模式开启后不再限制保存目录的存储驱动将根据填入的路径进行保存需要填写完整的alist目录
}
@ -115,7 +115,7 @@ class Alist_sync:
self.save_path = f"{self.save_mount_path}/{task['savepath']}"
else:
self.save_path = task["addition"]["alist_sync"]["save_path"]
if not task["addition"]["alist_sync"]["full_path_mode"]:
if not task["addition"]["alist_sync"]["full_path"]:
if self.save_path.startswith("/"):
self.save_path = self.save_path[1:]
if self.save_path.endswith("/"):
@ -142,7 +142,7 @@ class Alist_sync:
if task["addition"]["alist_sync"]["verify_path"]:
self.verify_path = task["addition"]["alist_sync"]["verify_path"]
if not task["addition"]["alist_sync"]["full_path_mode"]:
if not task["addition"]["alist_sync"]["full_path"]:
if self.verify_path.startswith("/"):
self.verify_path = self.save_path[1:]
if self.verify_path.endswith("/"):
@ -165,7 +165,7 @@ class Alist_sync:
# 获取网盘已有文件
source_dir_list = self.get_path_list(self.source_path)
if self.tv_mode == 0 or self.tv_mode == "":
if self.TV_mode == 0 or self.TV_mode == "":
self.tv_mode = False
else:
self.tv_mode = True

View File

@ -195,9 +195,6 @@ class MagicRename:
"",
"",
"",
"",
"",
"",
]
def __init__(self, magic_regex={}, magic_variable={}):
@ -262,14 +259,14 @@ class MagicRename:
"""自定义排序键"""
for i, keyword in enumerate(self.priority_list):
if keyword in name:
name = name.replace(keyword, f"_{i:02d}_") # 替换为数字,方便排序
return name.replace(keyword, f"{i:02d}") # 替换为数字,方便排序
return name
def sort_file_list(self, file_list, dir_filename_dict={}):
"""文件列表统一排序,给{I+}赋值"""
filename_list = [
# 强制加入`文件修改时间`字段供排序效果1无可排序字符时则按修改时间排序2和目录已有文件重名时始终在其后
f"{f['file_name_re']}_{f['updated_at']}"
f"{f['file_name_re']}{f['updated_at']}"
for f in file_list
if f.get("file_name_re") and not f["dir"]
]
@ -292,7 +289,7 @@ class MagicRename:
if file.get("file_name_re"):
if match := re.search(r"\{I+\}", file["file_name_re"]):
i = filename_index.get(
f"{file['file_name_re']}_{file['updated_at']}", 0
f"{file['file_name_re']}{file['updated_at']}", 0
)
file["file_name_re"] = re.sub(
match.group(),
@ -878,9 +875,7 @@ class Quark:
# 添加符合的
for share_file in share_file_list:
search_pattern = (
task["update_subdir"]
if share_file["dir"] and task.get("update_subdir")
else pattern
task.get("update_subdir", "") if share_file["dir"] else pattern
)
# 正则文件名匹配
if re.search(search_pattern, share_file["file_name"]):