Update Test

This commit is contained in:
Yoshiko2
2020-09-07 20:18:36 +08:00
committed by GitHub
parent 38ffc56a1a
commit 3db36d0499
5 changed files with 41 additions and 26 deletions

View File

@@ -59,8 +59,6 @@ def get_html(url, cookies: dict = None, ua: str = None, return_type: str = None)
if return_type == "object": if return_type == "object":
return result return result
elif return_type == "json":
return result.json()
else: else:
return result.text return result.text

View File

@@ -3,14 +3,15 @@ from core import *
import os import os
from number_parser import get_number from number_parser import get_number
__version__ = '3.7.1'
def check_update(): def check_update(local_version):
latest = get_html("https://api.github.com/repos/yoshiko2/AV_Data_Capture/releases/latest", data = json.loads(get_html("https://api.github.com/repos/yoshiko2/AV_Data_Capture/releases/latest"))
return_type="json")["tag_name"]
if __version__ != latest: remote = data["tag_name"]
line1 = "* New update " + str(latest) + " *" local = local_version
if not local == remote:
line1 = "* New update " + str(remote) + " *"
print("[*]" + line1.center(54)) print("[*]" + line1.center(54))
print("[*]" + "↓ Download ↓".center(54)) print("[*]" + "↓ Download ↓".center(54))
print("[*] https://github.com/yoshiko2/AV_Data_Capture/releases") print("[*] https://github.com/yoshiko2/AV_Data_Capture/releases")
@@ -110,6 +111,7 @@ def create_data_and_move_with_custom_number(file_path: str, c: config.Config, cu
if __name__ == '__main__': if __name__ == '__main__':
version = '3.7.2'
# Parse command line args # Parse command line args
single_file_path, config_file, auto_exit, custom_number = argparse_function() single_file_path, config_file, auto_exit, custom_number = argparse_function()
@@ -117,13 +119,13 @@ if __name__ == '__main__':
# Read config.ini # Read config.ini
conf = config.Config(path=config_file) conf = config.Config(path=config_file)
version_print = 'Version ' + __version__ version_print = 'Version ' + version
print('[*]================== AV Data Capture ===================') print('[*]================== AV Data Capture ===================')
print('[*]' + version_print.center(54)) print('[*]' + version_print.center(54))
print('[*]======================================================') print('[*]======================================================')
if conf.update_check(): if conf.update_check():
check_update() check_update(version)
create_failed_folder(conf.failed_folder()) create_failed_folder(conf.failed_folder())
os.chdir(os.getcwd()) os.chdir(os.getcwd())

View File

@@ -83,9 +83,12 @@ def get_data_from_json(file_number, filepath, conf: config.Config): # 从JSON
json_data = {} json_data = {}
for source in sources: for source in sources:
json_data = json.loads(func_mapping[source](file_number)) try:
# if any service return a valid return, break json_data = json.loads(func_mapping[source](file_number))
if get_data_state(json_data): # if any service return a valid return, break
if get_data_state(json_data):
break
except:
break break
# Return if data not found in all sources # Return if data not found in all sources

6
linux_make.py Normal file
View File

@@ -0,0 +1,6 @@
import os
os.system("pyinstaller --onefile AV_Data_Capture.py --hidden-import ADC_function.py --hidden-import core.py")
os.system("rm -rf ./build")
os.system("rm -rf ./__pycache__")
os.system("rm -rf AV_Data_Capture.spec")
os.system("echo '[Make]Finish'")

View File

@@ -28,19 +28,25 @@ def get_number(filepath: str) -> str:
""" """
filepath = os.path.basename(filepath) filepath = os.path.basename(filepath)
if '-' in filepath or '_' in filepath: # 普通提取番号 主要处理包含减号-和_的番号 try:
filepath = filepath.replace("_", "-") if '-' in filepath or '_' in filepath: # 普通提取番号 主要处理包含减号-和_的番号
filepath.strip('22-sht.me').strip('-HD').strip('-hd') filepath = filepath.replace("_", "-")
filename = str(re.sub("\[\d{4}-\d{1,2}-\d{1,2}\] - ", "", filepath)) # 去除文件名中时间 filepath.strip('22-sht.me').strip('-HD').strip('-hd')
if 'FC2' or 'fc2' in filename: filename = str(re.sub("\[\d{4}-\d{1,2}-\d{1,2}\] - ", "", filepath)) # 去除文件名中时间
filename = filename.replace('PPV','').replace('ppv','').replace('--','-').replace('_','-') if 'FC2' or 'fc2' in filename:
file_number = re.search(r'\w+-\w+', filename, re.A).group() filename = filename.replace('PPV', '').replace('ppv', '').replace('--', '-').replace('_', '-')
return file_number file_number = re.search(r'\w+-\w+', filename, re.A).group()
else: # 提取不含减号-的番号FANZA CID return file_number
try: else: # 提取不含减号-的番号FANZA CID
return str(re.findall(r'(.+?)\.', str(re.search('([^<>/\\\\|:""\\*\\?]+)\\.\\w+$', filepath).group()))).strip("['']").replace('_', '-') try:
except: return str(
return re.search(r'(.+?)\.', filepath)[0] re.findall(r'(.+?)\.', str(re.search('([^<>/\\\\|:""\\*\\?]+)\\.\\w+$', filepath).group()))).strip(
"['']").replace('_', '-')
except:
return re.search(r'(.+?)\.', filepath)[0]
except Exception as e:
print('[-]' + str(e))
return
if __name__ == "__main__": if __name__ == "__main__":