Update Test
This commit is contained in:
@@ -59,8 +59,6 @@ def get_html(url, cookies: dict = None, ua: str = None, return_type: str = None)
|
||||
|
||||
if return_type == "object":
|
||||
return result
|
||||
elif return_type == "json":
|
||||
return result.json()
|
||||
else:
|
||||
return result.text
|
||||
|
||||
|
||||
@@ -3,14 +3,15 @@ from core import *
|
||||
import os
|
||||
from number_parser import get_number
|
||||
|
||||
__version__ = '3.7.1'
|
||||
|
||||
def check_update():
|
||||
latest = get_html("https://api.github.com/repos/yoshiko2/AV_Data_Capture/releases/latest",
|
||||
return_type="json")["tag_name"]
|
||||
def check_update(local_version):
|
||||
data = json.loads(get_html("https://api.github.com/repos/yoshiko2/AV_Data_Capture/releases/latest"))
|
||||
|
||||
if __version__ != latest:
|
||||
line1 = "* New update " + str(latest) + " *"
|
||||
remote = data["tag_name"]
|
||||
local = local_version
|
||||
|
||||
if not local == remote:
|
||||
line1 = "* New update " + str(remote) + " *"
|
||||
print("[*]" + line1.center(54))
|
||||
print("[*]" + "↓ Download ↓".center(54))
|
||||
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__':
|
||||
version = '3.7.2'
|
||||
|
||||
# Parse command line args
|
||||
single_file_path, config_file, auto_exit, custom_number = argparse_function()
|
||||
@@ -117,13 +119,13 @@ if __name__ == '__main__':
|
||||
# Read config.ini
|
||||
conf = config.Config(path=config_file)
|
||||
|
||||
version_print = 'Version ' + __version__
|
||||
version_print = 'Version ' + version
|
||||
print('[*]================== AV Data Capture ===================')
|
||||
print('[*]' + version_print.center(54))
|
||||
print('[*]======================================================')
|
||||
|
||||
if conf.update_check():
|
||||
check_update()
|
||||
check_update(version)
|
||||
|
||||
create_failed_folder(conf.failed_folder())
|
||||
os.chdir(os.getcwd())
|
||||
|
||||
9
core.py
9
core.py
@@ -83,9 +83,12 @@ def get_data_from_json(file_number, filepath, conf: config.Config): # 从JSON
|
||||
|
||||
json_data = {}
|
||||
for source in sources:
|
||||
json_data = json.loads(func_mapping[source](file_number))
|
||||
# if any service return a valid return, break
|
||||
if get_data_state(json_data):
|
||||
try:
|
||||
json_data = json.loads(func_mapping[source](file_number))
|
||||
# if any service return a valid return, break
|
||||
if get_data_state(json_data):
|
||||
break
|
||||
except:
|
||||
break
|
||||
|
||||
# Return if data not found in all sources
|
||||
|
||||
6
linux_make.py
Normal file
6
linux_make.py
Normal 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'")
|
||||
@@ -28,19 +28,25 @@ def get_number(filepath: str) -> str:
|
||||
"""
|
||||
filepath = os.path.basename(filepath)
|
||||
|
||||
if '-' in filepath or '_' in filepath: # 普通提取番号 主要处理包含减号-和_的番号
|
||||
filepath = filepath.replace("_", "-")
|
||||
filepath.strip('22-sht.me').strip('-HD').strip('-hd')
|
||||
filename = str(re.sub("\[\d{4}-\d{1,2}-\d{1,2}\] - ", "", filepath)) # 去除文件名中时间
|
||||
if 'FC2' or 'fc2' in filename:
|
||||
filename = filename.replace('PPV','').replace('ppv','').replace('--','-').replace('_','-')
|
||||
file_number = re.search(r'\w+-\w+', filename, re.A).group()
|
||||
return file_number
|
||||
else: # 提取不含减号-的番号,FANZA CID
|
||||
try:
|
||||
return str(re.findall(r'(.+?)\.', str(re.search('([^<>/\\\\|:""\\*\\?]+)\\.\\w+$', filepath).group()))).strip("['']").replace('_', '-')
|
||||
except:
|
||||
return re.search(r'(.+?)\.', filepath)[0]
|
||||
try:
|
||||
if '-' in filepath or '_' in filepath: # 普通提取番号 主要处理包含减号-和_的番号
|
||||
filepath = filepath.replace("_", "-")
|
||||
filepath.strip('22-sht.me').strip('-HD').strip('-hd')
|
||||
filename = str(re.sub("\[\d{4}-\d{1,2}-\d{1,2}\] - ", "", filepath)) # 去除文件名中时间
|
||||
if 'FC2' or 'fc2' in filename:
|
||||
filename = filename.replace('PPV', '').replace('ppv', '').replace('--', '-').replace('_', '-')
|
||||
file_number = re.search(r'\w+-\w+', filename, re.A).group()
|
||||
return file_number
|
||||
else: # 提取不含减号-的番号,FANZA CID
|
||||
try:
|
||||
return str(
|
||||
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__":
|
||||
|
||||
Reference in New Issue
Block a user