Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

移植部分CLI逻辑,新增番号解析逻辑,调整UI #2

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
537 changes: 297 additions & 240 deletions AVDC.py

Large diffs are not rendered by default.

2,759 changes: 1,402 additions & 1,357 deletions AVDC.ui

Large diffs are not rendered by default.

29 changes: 17 additions & 12 deletions AVDC_Main.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ def Init_Ui(self):
self.Ui.progressBar_avdc.setValue(0) # 进度条清0
self.progressBarValue.connect(self.set_processbar)
self.Ui.progressBar_avdc.setTextVisible(False) # 不显示进度条文字
self.setWindowFlag(QtCore.Qt.FramelessWindowHint) # 隐藏边框
# self.setWindowFlag(QtCore.Qt.FramelessWindowHint) # 隐藏边框
# self.setWindowOpacity(0.9) # 设置窗口透明度
self.setAttribute(QtCore.Qt.WA_TranslucentBackground) # 设置窗口背景透明
self.Ui.treeWidget_number.expandAll()
Expand All @@ -71,7 +71,7 @@ def Init_Ui(self):
border-radius:15px;
padding:2px 4px;
}

''')
self.Ui.centralwidget.setStyleSheet(
'''
Expand All @@ -81,7 +81,7 @@ def Init_Ui(self):
width:300px;
border-radius:20px;
padding:2px 4px;
}
}
QTextBrowser{
border:1px solid gray;
background:white;
Expand All @@ -95,21 +95,21 @@ def Init_Ui(self):
width:300px;
border-radius:10px;
padding:2px 4px;
}
}
QTextBrowser#textBrowser_about{
background:white;
border:1px solid white;
width:300px;
border-radius:10px;
padding:2px 4px;
}
}
QTextBrowser#textBrowser_warning{
background:gray;
border:1px solid gray;
width:300px;
border-radius:10px;
padding:2px 4px;
}
}
QPushButton#pushButton_start_cap,#pushButton_move_mp4,#pushButton_select_file,#pushButton_select_fanart{
font-size:20px;
background:#F0F8FF;
Expand Down Expand Up @@ -995,18 +995,21 @@ def pasteFileToFolder(self, filepath, path, naming_rule, number, config):
if os.path.exists(path_old + '/' + filename + '.srt'): # 字幕移动
os.rename(path_old + '/' + filename + '.srt', path + '/' + naming_rule + '.srt')
self.add_text_main('[+]Sub moved! ' + naming_rule + '.srt')
return
return True
elif os.path.exists(path_old + '/' + filename + '.ass'): # 字幕移动
os.rename(path_old + '/' + filename + '.ass', path + '/' + naming_rule + '.ass')
self.add_text_main('[+]Sub moved! ' + naming_rule + '.ass')
return
return True
elif os.path.exists(path_old + '/' + filename + '.sub'): # 字幕移动
os.rename(path_old + '/' + filename + '.sub', path + '/' + naming_rule + '.sub')
self.add_text_main('[+]Sub moved! ' + naming_rule + '.sub')
return
return True
except FileExistsError as error_info:
self.add_text_main('[-]File exists in target folder @pasteFileToFolder: ' + str(error_info))
return False
except Exception as error_info:
self.add_text_main('[-]Error in pasteFileToFolder: ' + str(error_info))

return False
# ========================================================================获取分集序号
def get_part(self, filepath, failed_folder):
try:
Expand Down Expand Up @@ -1176,10 +1179,12 @@ def Core_Main(self, file_path, number_th, mode, count):
self.cutImage(option, json_data['imagecut'], path, naming_rule) # 裁剪图
self.copyRenameJpgToBackdrop(option, path, naming_rule)
self.PrintFiles(option, path, naming_rule, cn_sub, json_data, filepath, failed_folder) # 打印文件
self.pasteFileToFolder(filepath, path, naming_rule, number, Config) # 移动文件
ret = self.pasteFileToFolder(filepath, path, naming_rule, number, Config) # 移动文件
# =======================================================================整理模式
elif program_mode == '2':
self.pasteFileToFolder(filepath, path, naming_rule, number, Config) # 移动文件
ret = self.pasteFileToFolder(filepath, path, naming_rule, number, Config) # 移动文件
if not ret:
self.moveFailedFolder(filepath,failed_folder)
# =======================================================================json添加封面项
fanart_path = ''
poster_path = ''
Expand Down
54 changes: 36 additions & 18 deletions AV_Data_Capture.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,35 +29,50 @@ def movie_lists(escape_folder):
total.append(path)
return total


num_cache = {}
def getNumber(filepath):
filepath = filepath.replace('-C.', '.').replace('-c.', '.')
filepath = os.path.splitext(filepath.split('/')[-1])[0]
# filepath = filepath.replace("_", "-")
if filepath in num_cache.keys():
return num_cache[filepath]
filename = filepath.replace('-C.', '.').replace('-c.', '.')
filename = os.path.splitext(filename.split('/')[-1])[0]
part = ''
if re.search('-CD\d+', filepath):
part = re.findall('-CD\d+', filepath)[0]
if re.search('-cd\d+', filepath):
part = re.findall('-cd\d+', filepath)[0]
filepath.strip('22-sht.me').strip('-HD').strip('-hd')
filepath = filepath.replace(part, '')
filename = str(re.sub("-\d{4}-\d{1,2}-\d{1,2}", "", filepath)) # 去除文件名中时间
if re.search('-CD\d+', filename):
part = re.findall('-CD\d+', filename)[0]
if re.search('-cd\d+', filename):
part = re.findall('-cd\d+', filename)[0]

filename = filename.replace(part, '')
filename = filename.lower()
filename = filename.replace('22-sht.me','')
filename = filename.replace('-10mu','')
filename = filename.replace('-1pon','')
filename = filename.replace('-paco','')
filename = filename.replace('-hd','')
filename = filename.replace('_hd','')
filename = filename.replace('-720p','')
filename = filename.replace('_720p','')
filename = filename.replace('-1080p','')
filename = filename.replace('_1080p','')
filename = str(re.sub("-\d{4}-\d{1,2}-\d{1,2}", "", filename)) # 去除文件名中时间
filename = str(re.sub("\d{4}-\d{1,2}-\d{1,2}-", "", filename)) # 去除文件名中时间
if '-' in filename or '_' in filename: # 普通提取番号 主要处理包含减号-和_的番号
if 'FC2' or 'fc2' in filename:
filename = filename.replace('-PPV', '').replace('PPV-', '').replace('-ppv', '').replace('ppv-', '')
if re.search('\w+-\d+', filename): # 提取类似mkbd-120番号
file_number = re.search('\w+-\d+', filename).group()
elif re.search('\w+-\w\d+', filename): # 提取类似mkbd-s120番号
file_number = re.search('\w+-\w\d+', filename).group()
elif re.search('\d+-\w+', filename): # 提取类似 111111-MMMM 番号
file_number = re.search('\d+-\w+', filename).group()
if re.search('[a-zA-Z]+-\d+', filename): # 提取类似mkbd-120番号
file_number = re.search('[a-zA-Z]+-\d+', filename).group()
elif re.search('[a-zA-Z]+-[a-zA-Z]\d+', filename): # 提取类似mkbd-s120番号
file_number = re.search('[a-zA-Z]+-[a-zA-Z]\d+', filename).group()
elif re.search('\d+-\d+', filename): # 提取类似 111111-000 番号
file_number = re.search('\d+-\d+', filename).group()
elif re.search('\d+_\d+', filename): # 提取类似 111111_000 番号
file_number = re.search('\d+_\d+', filename).group()
elif re.search('\d+-[a-zA-Z]+', filename): # 提取类似 111111-MMMM 番号
file_number = re.search('\d+-[a-zA-Z]+', filename).group()
elif 'heyzo' in filename and re.search('\d{4}', filename): # 提取heyzo番号:
file_number = 'heyzo-'+ re.search('\d{4}', filename).group()
else:
file_number = filename
num_cache[filepath] = file_number
return file_number
else: # 提取不含减号-的番号,FANZA CID 保留ssni00644,将MIDE139改成MIDE-139
try:
Expand All @@ -66,6 +81,9 @@ def getNumber(filepath):
find_char = re.findall(r'\D+', file_number)[0]
if len(find_num) <= 4 and len(find_char) > 1:
file_number = find_char + '-' + find_num
num_cache[filepath] = file_number
return file_number
except:
return os.path.splitext(filepath.split('/')[-1])[0]
file_number = os.path.splitext(filepath.split('/')[-1])[0]
num_cache[filepath] = file_number
return file_number
Loading