mirror of
https://github.com/Cp0204/quark-auto-save.git
synced 2026-01-17 01:40:44 +08:00
Compare commits
4 Commits
f5937002c8
...
cdf826a742
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
cdf826a742 | ||
|
|
c20a31773e | ||
|
|
5aecad7f03 | ||
|
|
5809871cf1 |
@ -164,7 +164,9 @@ class Alist_sync:
|
||||
|
||||
# 获取网盘已有文件
|
||||
source_dir_list = self.get_path_list(self.source_path)
|
||||
|
||||
if not source_dir_list:
|
||||
print("获取夸克文件列表失败,请检查网络或手动刷新alist中的夸克目录")
|
||||
return 0
|
||||
if self.tv_mode == 0 or self.tv_mode == "":
|
||||
self.tv_mode = False
|
||||
else:
|
||||
@ -228,11 +230,11 @@ class Alist_sync:
|
||||
.lower()
|
||||
)
|
||||
for target_list in target_dir_list:
|
||||
if source_list["is_dir"]:
|
||||
# print(f"跳过目录同步")
|
||||
skip = True
|
||||
break
|
||||
if self.tv_mode:
|
||||
if source_list["is_dir"]:
|
||||
# print(f"跳过目录同步")
|
||||
skip = True
|
||||
break
|
||||
target_list_filename = (
|
||||
target_list["name"]
|
||||
.replace(".mp4", "")
|
||||
|
||||
@ -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(),
|
||||
|
||||
Loading…
Reference in New Issue
Block a user