mirror of
https://github.com/Cp0204/quark-auto-save.git
synced 2026-01-16 17:30:43 +08:00
Compare commits
3 Commits
8e27444f0e
...
5809871cf1
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
5809871cf1 | ||
|
|
f6b7ecdc83 | ||
|
|
53a2b04e60 |
@ -315,7 +315,9 @@ def get_share_detail():
|
||||
)
|
||||
for share_file in data["list"]:
|
||||
search_pattern = (
|
||||
task.get("update_subdir", "") if share_file["dir"] else pattern
|
||||
task["update_subdir"]
|
||||
if share_file["dir"] and task.get("update_subdir")
|
||||
else pattern
|
||||
)
|
||||
if re.search(search_pattern, share_file["file_name"]):
|
||||
# 文件名重命名,目录不重命名
|
||||
|
||||
@ -25,7 +25,7 @@ class Alist_sync:
|
||||
default_task_config = {
|
||||
"enable": False, # 当前任务开关,
|
||||
"save_path": "", # 需要同步目录,默认空时路径则会与夸克的保存路径一致,不开启完整路径模式时,默认根目录为保存驱动的根目录
|
||||
"verify_path": "", # 验证目录,主要用于影视库避免重复文件,一般配合alist的别名功能及full_path使用,用于多个网盘的源合并成一个目录
|
||||
"verify_path": "", # 验证目录,主要用于影视库避免重复文件,一般配合alist的别名功能及full_path_mode使用,用于多个网盘的源合并成一个目录
|
||||
"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"]:
|
||||
if not task["addition"]["alist_sync"]["full_path_mode"]:
|
||||
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"]:
|
||||
if not task["addition"]["alist_sync"]["full_path_mode"]:
|
||||
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
|
||||
|
||||
@ -195,6 +195,9 @@ class MagicRename:
|
||||
"八",
|
||||
"九",
|
||||
"十",
|
||||
"百",
|
||||
"千",
|
||||
"万",
|
||||
]
|
||||
|
||||
def __init__(self, magic_regex={}, magic_variable={}):
|
||||
@ -259,14 +262,14 @@ class MagicRename:
|
||||
"""自定义排序键"""
|
||||
for i, keyword in enumerate(self.priority_list):
|
||||
if keyword in name:
|
||||
return name.replace(keyword, f"{i:02d}") # 替换为数字,方便排序
|
||||
name = 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"]
|
||||
]
|
||||
@ -289,7 +292,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(),
|
||||
@ -875,7 +878,9 @@ class Quark:
|
||||
# 添加符合的
|
||||
for share_file in share_file_list:
|
||||
search_pattern = (
|
||||
task.get("update_subdir", "") if share_file["dir"] else pattern
|
||||
task["update_subdir"]
|
||||
if share_file["dir"] and task.get("update_subdir")
|
||||
else pattern
|
||||
)
|
||||
# 正则文件名匹配
|
||||
if re.search(search_pattern, share_file["file_name"]):
|
||||
|
||||
Loading…
Reference in New Issue
Block a user