mirror of
https://github.com/Cp0204/quark-auto-save.git
synced 2026-01-18 19:00:44 +08:00
优化重命名和打印信息逻辑
This commit is contained in:
parent
a11a264b82
commit
56855a8f8f
24
app/run.py
24
app/run.py
@ -285,6 +285,10 @@ def get_share_detail():
|
|||||||
current_sequence = 1
|
current_sequence = 1
|
||||||
|
|
||||||
# 构建顺序命名的正则表达式
|
# 构建顺序命名的正则表达式
|
||||||
|
if sequence_pattern == "{}":
|
||||||
|
# 对于单独的{},使用特殊匹配
|
||||||
|
regex_pattern = "(\\d+)"
|
||||||
|
else:
|
||||||
regex_pattern = re.escape(sequence_pattern).replace('\\{\\}', '(\\d+)')
|
regex_pattern = re.escape(sequence_pattern).replace('\\{\\}', '(\\d+)')
|
||||||
|
|
||||||
# 实现高级排序算法
|
# 实现高级排序算法
|
||||||
@ -401,10 +405,22 @@ def get_share_detail():
|
|||||||
return 0
|
return 0
|
||||||
|
|
||||||
# 过滤出非目录文件,并且排除已经符合命名规则的文件
|
# 过滤出非目录文件,并且排除已经符合命名规则的文件
|
||||||
files_to_process = [
|
files_to_process = []
|
||||||
f for f in share_detail["list"]
|
for f in share_detail["list"]:
|
||||||
if not f["dir"] and not re.match(regex_pattern, f["file_name"])
|
if f["dir"]:
|
||||||
]
|
continue # 跳过文件夹
|
||||||
|
|
||||||
|
# 检查文件是否已符合命名规则
|
||||||
|
if sequence_pattern == "{}":
|
||||||
|
# 对于单独的{},检查文件名是否为纯数字
|
||||||
|
file_name_without_ext = os.path.splitext(f["file_name"])[0]
|
||||||
|
if file_name_without_ext.isdigit():
|
||||||
|
continue # 跳过已符合命名规则的文件
|
||||||
|
elif re.match(regex_pattern, f["file_name"]):
|
||||||
|
continue # 跳过已符合命名规则的文件
|
||||||
|
|
||||||
|
# 添加到待处理文件列表
|
||||||
|
files_to_process.append(f)
|
||||||
|
|
||||||
# 根据提取的排序值进行排序
|
# 根据提取的排序值进行排序
|
||||||
sorted_files = sorted(files_to_process, key=extract_sorting_value)
|
sorted_files = sorted(files_to_process, key=extract_sorting_value)
|
||||||
|
|||||||
@ -636,6 +636,13 @@
|
|||||||
mounted() {
|
mounted() {
|
||||||
this.fetchData();
|
this.fetchData();
|
||||||
this.checkNewVersion();
|
this.checkNewVersion();
|
||||||
|
|
||||||
|
// 从本地存储中恢复之前的标签页状态
|
||||||
|
const savedTab = localStorage.getItem('quarkAutoSave_activeTab');
|
||||||
|
if (savedTab) {
|
||||||
|
this.activeTab = savedTab;
|
||||||
|
}
|
||||||
|
|
||||||
$('[data-toggle="tooltip"]').tooltip();
|
$('[data-toggle="tooltip"]').tooltip();
|
||||||
document.addEventListener('keydown', this.handleKeyDown);
|
document.addEventListener('keydown', this.handleKeyDown);
|
||||||
document.addEventListener('click', (e) => {
|
document.addEventListener('click', (e) => {
|
||||||
@ -693,6 +700,8 @@
|
|||||||
methods: {
|
methods: {
|
||||||
changeTab(tab) {
|
changeTab(tab) {
|
||||||
this.activeTab = tab;
|
this.activeTab = tab;
|
||||||
|
// 在本地存储中保存当前标签页状态
|
||||||
|
localStorage.setItem('quarkAutoSave_activeTab', tab);
|
||||||
if (window.innerWidth <= 768) {
|
if (window.innerWidth <= 768) {
|
||||||
$('#sidebarMenu').collapse('toggle')
|
$('#sidebarMenu').collapse('toggle')
|
||||||
}
|
}
|
||||||
@ -1211,8 +1220,8 @@
|
|||||||
},
|
},
|
||||||
detectNamingMode(task) {
|
detectNamingMode(task) {
|
||||||
// 检测是否为顺序命名模式或剧集命名模式
|
// 检测是否为顺序命名模式或剧集命名模式
|
||||||
const sequencePatterns = ['E{}', 'EP{}', 'S\\d+E{}', '第{}集', '第{}话', '第{}期'];
|
const sequencePatterns = ['{}', 'E{}', 'EP{}', 'S\\d+E{}', '第{}集', '第{}话', '第{}期'];
|
||||||
const episodePatterns = ['E[]', 'EP[]', 'S\\d+E[]', '第[]集', '第[]话', '第[]期', '[]'];
|
const episodePatterns = ['[]', 'E[]', 'EP[]', 'S\\d+E[]', '第[]集', '第[]话', '第[]期'];
|
||||||
|
|
||||||
let isSequenceNaming = false;
|
let isSequenceNaming = false;
|
||||||
let isEpisodeNaming = false;
|
let isEpisodeNaming = false;
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user