From 6f684e67e22dba3218bfeb1af6c728a80d8fb7fc Mon Sep 17 00:00:00 2001 From: wenead99 <42309414+wenead99@users.noreply.github.com> Date: Sat, 22 Jun 2019 00:34:36 +0800 Subject: [PATCH] =?UTF-8?q?Beta=200.15=20=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- AV_Data_Capture.py | 4 ++-- core.py | 17 +++++++++++------ proxy.ini | 2 +- 3 files changed, 14 insertions(+), 9 deletions(-) diff --git a/AV_Data_Capture.py b/AV_Data_Capture.py index d23d49b..0cb1c0f 100644 --- a/AV_Data_Capture.py +++ b/AV_Data_Capture.py @@ -71,8 +71,8 @@ if __name__ =='__main__': if '_' in i: os.rename(re.search(r'[^\\/:*?"<>|\r\n]+$', i).group(), rreplace(re.search(r'[^\\/:*?"<>|\r\n]+$', i).group(), '_', '-', 1)) i = rreplace(re.search(r'[^\\/:*?"<>|\r\n]+$', i).group(), '_', '-', 1) - #os.system('python core.py' + ' "' + i + '"') #选择从py文件启动 (用于源码py) - os.system('core.exe' + ' "' + i + '"') #选择从exe文件启动(用于EXE版程序) + os.system('python core.py' + ' "' + i + '"') #选择从py文件启动 (用于源码py) + #os.system('core.exe' + ' "' + i + '"') #选择从exe文件启动(用于EXE版程序) print("[*]=====================================") print("[!]Cleaning empty folders") diff --git a/core.py b/core.py index 31f77c8..882079f 100644 --- a/core.py +++ b/core.py @@ -136,6 +136,10 @@ def getNumberFromFilename(filepath): tag = str(json_data['tag']).strip("[ ]").replace("'",'').replace(" ",'').split(',') #字符串转列表 actor = str(actor_list).strip("[ ]").replace("'",'').replace(" ",'') + #====================处理异常字符====================== #\/:*?"<>| + #if "\\" in title or "/" in title or ":" in title or "*" in title or "?" in title or '"' in title or '<' in title or ">" in title or "|" in title or len(title) > 200: + # title = title. + naming_rule = eval(config['Name_Rule']['naming_rule']) location_rule =eval(config['Name_Rule']['location_rule']) except IOError as e: @@ -205,10 +209,11 @@ def DownloadFileWithFilename(url,filename,path): #path = examle:photo , video.in time.sleep(3) os._exit(0) def PrintFiles(path,naming_rule): + global title try: if not os.path.exists(path): os.makedirs(path) - with open(path + "/" + naming_rule + ".nfo", "wt", encoding='UTF-8') as code: + with open(path + "/" + number + ".nfo", "wt", encoding='UTF-8') as code: print("", file=code) print(" " + naming_rule + "", file=code) print(" ", file=code) @@ -247,7 +252,7 @@ def PrintFiles(path,naming_rule): print(" "+cover+"", file=code) print(" " + "https://www.javbus.com/"+number + "", file=code) print("", file=code) - print("[+]Writeed! "+path + "/" + naming_rule + ".nfo") + print("[+]Writeed! "+path + "/" + number + ".nfo") except IOError as e: print("[-]Write Failed!") print(e) @@ -268,18 +273,18 @@ def cutImage(): w = img.width h = img.height img2 = img.crop((w / 1.9, 0, w, h)) - img2.save(path + '/' + naming_rule + '.png') + img2.save(path + '/' + number + '.png') except: print('[-]Cover cut failed!') else: img = Image.open(path + '/' + 'Backdrop' + '.jpg') w = img.width h = img.height - img.save(path + '/' + naming_rule + '.png') + img.save(path + '/' + number + '.png') def pasteFileToFolder(filepath, path): #文件路径,番号,后缀,要移动至的位置 houzhui = str(re.search('[.](AVI|RMVB|WMV|MOV|MP4|MKV|FLV|TS|avi|rmvb|wmv|mov|mp4|mkv|flv|ts)$', filepath).group()) - os.rename(filepath, naming_rule + houzhui) - shutil.move(naming_rule + houzhui, path) + os.rename(filepath, number + houzhui) + shutil.move(number + houzhui, path) if __name__ == '__main__': filepath=argparse_get_file() #影片的路径 diff --git a/proxy.ini b/proxy.ini index 03c07be..39d6f79 100644 --- a/proxy.ini +++ b/proxy.ini @@ -2,5 +2,5 @@ proxy=127.0.0.1:1080 [Name_Rule] -location_rule='JAV_output/'+actor+'/'+'['+number+']-'+title +location_rule='JAV_output/'+actor+'/'+number+'-'+title naming_rule=number+'-'+title \ No newline at end of file