Fix some bugs.
This commit is contained in:
15
core.py
15
core.py
@@ -51,7 +51,8 @@ except:
|
||||
def moveFailedFolder():
|
||||
global filepath
|
||||
print('[-]Move to "failed"')
|
||||
shutil.move(filepath, output_dir + '/failed/')
|
||||
print('[-]' + filepath + ' -> ' + output_dir + '/failed/')
|
||||
os.rename(filepath, output_dir + '/failed/')
|
||||
os._exit(0)
|
||||
def argparse_get_file():
|
||||
parser = argparse.ArgumentParser()
|
||||
@@ -377,18 +378,20 @@ def pasteFileToFolder(filepath, path): #文件路径,番号,后缀,要移
|
||||
global houzhui
|
||||
houzhui = str(re.search('[.](AVI|RMVB|WMV|MOV|MP4|MKV|FLV|TS|avi|rmvb|wmv|mov|mp4|mkv|flv|ts)$', filepath).group())
|
||||
try:
|
||||
os.rename(filepath, number + houzhui)
|
||||
print('[*]' + filepath + ' -> ' + output_dir + number + houzhui)
|
||||
os.rename(filepath, output_dir + '/' + number + houzhui)
|
||||
except FileExistsError:
|
||||
print('[-]File Exists! Please check your movie!')
|
||||
print('[-]move to the root folder of the program.')
|
||||
os._exit(0)
|
||||
try:
|
||||
shutil.move(number + houzhui, path)
|
||||
print('[*]' + output_dir + '/' + number + houzhui + ' -> ' + path)
|
||||
os.rename(output_dir + '/' + number + houzhui, path)
|
||||
except:
|
||||
print('[-]File Exists! Please check your movie!')
|
||||
print('[-]move to the root folder of the program.')
|
||||
os._exit(0)
|
||||
def renameJpgToBackdrop_copy():
|
||||
def moveJpgToBackdrop_copy():
|
||||
if option == 'plex':
|
||||
shutil.copy(path + '/fanart.jpg', path + '/Backdrop.jpg')
|
||||
shutil.copy(path + '/poster.png', path + '/thumb.png')
|
||||
@@ -406,7 +409,7 @@ if __name__ == '__main__':
|
||||
number = str(re.findall(r'(.+?)\.',str(re.search('([^<>/\\\\|:""\\*\\?]+)\\.\\w+$',filepath).group()))).strip("['']").replace('_','-')
|
||||
print("[!]Making Data for [" + number + "]")
|
||||
except:
|
||||
print("[-]failed!Please rename the filename again!")
|
||||
print("[-]failed!Please move the filename again!")
|
||||
moveFailedFolder()
|
||||
else:
|
||||
number = argparse_get_file()[1]
|
||||
@@ -418,4 +421,4 @@ if __name__ == '__main__':
|
||||
PrintFiles(filepath) # 打印文件
|
||||
cutImage() # 裁剪图
|
||||
pasteFileToFolder(filepath, path) # 移动文件
|
||||
renameJpgToBackdrop_copy()
|
||||
moveJpgToBackdrop_copy()
|
||||
|
||||
Reference in New Issue
Block a user