mirror of
https://github.com/Cp0204/quark-auto-save.git
synced 2026-01-20 12:29:37 +08:00
Compare commits
3 Commits
4646e7db78
...
e6b8963069
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e6b8963069 | ||
|
|
e55433c3f8 | ||
|
|
a45663b1f1 |
10
app/run.py
10
app/run.py
@ -310,14 +310,14 @@ def get_share_detail():
|
|||||||
dir_file_list = []
|
dir_file_list = []
|
||||||
dir_filename_list = []
|
dir_filename_list = []
|
||||||
|
|
||||||
for share_file in data["list"]:
|
|
||||||
if share_file["dir"] and task.get("update_subdir", False):
|
|
||||||
pattern, replace = task["update_subdir"], ""
|
|
||||||
else:
|
|
||||||
pattern, replace = mr.magic_regex_conv(
|
pattern, replace = mr.magic_regex_conv(
|
||||||
task.get("pattern", ""), task.get("replace", "")
|
task.get("pattern", ""), task.get("replace", "")
|
||||||
)
|
)
|
||||||
if re.search(pattern, share_file["file_name"]):
|
for share_file in data["list"]:
|
||||||
|
search_pattern = (
|
||||||
|
task.get("update_subdir", "") if share_file["dir"] else pattern
|
||||||
|
)
|
||||||
|
if re.search(search_pattern, share_file["file_name"]):
|
||||||
# 文件名重命名,目录不重命名
|
# 文件名重命名,目录不重命名
|
||||||
file_name_re = (
|
file_name_re = (
|
||||||
share_file["file_name"]
|
share_file["file_name"]
|
||||||
|
|||||||
@ -862,18 +862,19 @@ class Quark:
|
|||||||
mr = MagicRename(CONFIG_DATA.get("magic_regex", {}))
|
mr = MagicRename(CONFIG_DATA.get("magic_regex", {}))
|
||||||
mr.set_taskname(task["taskname"])
|
mr.set_taskname(task["taskname"])
|
||||||
|
|
||||||
|
# 魔法正则转换
|
||||||
|
pattern, replace = mr.magic_regex_conv(
|
||||||
|
task.get("pattern", ""), task.get("replace", "")
|
||||||
|
)
|
||||||
# 需保存的文件清单
|
# 需保存的文件清单
|
||||||
need_save_list = []
|
need_save_list = []
|
||||||
# 添加符合的
|
# 添加符合的
|
||||||
for share_file in share_file_list:
|
for share_file in share_file_list:
|
||||||
if share_file["dir"] and task.get("update_subdir", False):
|
search_pattern = (
|
||||||
pattern, replace = task["update_subdir"], ""
|
task.get("update_subdir", "") if share_file["dir"] else pattern
|
||||||
else:
|
|
||||||
pattern, replace = mr.magic_regex_conv(
|
|
||||||
task.get("pattern", ""), task.get("replace", "")
|
|
||||||
)
|
)
|
||||||
# 正则文件名匹配
|
# 正则文件名匹配
|
||||||
if re.search(pattern, share_file["file_name"]):
|
if re.search(search_pattern, share_file["file_name"]):
|
||||||
# 判断原文件名是否存在,处理忽略扩展名
|
# 判断原文件名是否存在,处理忽略扩展名
|
||||||
if not mr.is_exists(
|
if not mr.is_exists(
|
||||||
share_file["file_name"],
|
share_file["file_name"],
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user