Update 3.6 Beta
This commit is contained in:
@@ -23,9 +23,10 @@ def argparse_function() -> [str, str, bool]:
|
||||
parser.add_argument("file", default='', nargs='?', help="Single Movie file path.")
|
||||
parser.add_argument("-c", "--config", default='config.ini', nargs='?', help="The config file Path.")
|
||||
parser.add_argument("-a", "--auto-exit", dest='autoexit', action="store_true", help="Auto exit after program complete")
|
||||
parser.add_argument("-n", "--number", default='', nargs='?',help="Custom file number")
|
||||
args = parser.parse_args()
|
||||
|
||||
return args.file, args.config, args.autoexit
|
||||
return args.file, args.config, args.autoexit, args.number
|
||||
|
||||
def movie_lists(root, escape_folder):
|
||||
for folder in escape_folder:
|
||||
@@ -88,12 +89,31 @@ def create_data_and_move(file_path: str, c: config.Config):
|
||||
except Exception as err:
|
||||
print('[!]', err)
|
||||
|
||||
def create_data_and_move_with_custom_number(file_path: str, c: config.Config, custom_number=None):
|
||||
try:
|
||||
print("[!]Making Data for [{}], the number is [{}]".format(file_path, custom_number))
|
||||
core_main(file_path, custom_number, c)
|
||||
print("[*]======================================================")
|
||||
except Exception as err:
|
||||
print("[-] [{}] ERROR:".format(file_path))
|
||||
print('[-]', err)
|
||||
|
||||
if c.soft_link():
|
||||
print("[-]Link {} to failed folder".format(file_path))
|
||||
os.symlink(file_path, str(os.getcwd()) + "/" + conf.failed_folder() + "/")
|
||||
else:
|
||||
try:
|
||||
print("[-]Move [{}] to failed folder".format(file_path))
|
||||
shutil.move(file_path, str(os.getcwd()) + "/" + conf.failed_folder() + "/")
|
||||
except Exception as err:
|
||||
print('[!]', err)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
version = '3.5.2'
|
||||
version = '3.6'
|
||||
|
||||
# Parse command line args
|
||||
single_file_path, config_file, auto_exit = argparse_function()
|
||||
single_file_path, config_file, auto_exit, custom_number = argparse_function()
|
||||
|
||||
# Read config.ini
|
||||
conf = config.Config(path=config_file)
|
||||
@@ -108,17 +128,19 @@ if __name__ == '__main__':
|
||||
|
||||
create_failed_folder(conf.failed_folder())
|
||||
os.chdir(os.getcwd())
|
||||
movie_list = movie_lists(".", re.split("[,,]", conf.escape_folder()))
|
||||
|
||||
# ========== 野鸡番号拖动 ==========
|
||||
# ========== Single File ==========
|
||||
if not single_file_path == '':
|
||||
create_data_and_move(single_file_path, conf)
|
||||
print('[+]==================== Single File =====================')
|
||||
create_data_and_move_with_custom_number(single_file_path, conf,custom_number)
|
||||
CEF(conf.success_folder())
|
||||
CEF(conf.failed_folder())
|
||||
print("[+]All finished!!!")
|
||||
input("[+][+]Press enter key exit, you can check the error messge before you exit.")
|
||||
exit()
|
||||
# ========== 野鸡番号拖动 ==========
|
||||
# ========== Single File ==========
|
||||
|
||||
movie_list = movie_lists(".", re.split("[,,]", conf.escape_folder()))
|
||||
|
||||
count = 0
|
||||
count_all = str(len(movie_list))
|
||||
|
||||
6
core.py
6
core.py
@@ -331,7 +331,7 @@ def print_files(path, c_word, naming_rule, part, cn_sub, json_data, filepath, fa
|
||||
|
||||
|
||||
def cutImage(imagecut, path, number, c_word):
|
||||
if imagecut == 1:
|
||||
if imagecut == 1: # 剪裁大封面
|
||||
try:
|
||||
img = Image.open(path + '/' + number + c_word + '-fanart.jpg')
|
||||
imgSize = img.size
|
||||
@@ -342,7 +342,7 @@ def cutImage(imagecut, path, number, c_word):
|
||||
print('[+]Image Cutted! ' + path + '/' + number + c_word + '-poster.jpg')
|
||||
except:
|
||||
print('[-]Cover cut failed!')
|
||||
elif imagecut == 0:
|
||||
elif imagecut == 0: # 复制封面
|
||||
shutil.copyfile(path + '/' + number + c_word + '-fanart.jpg',path + '/' + number + c_word + '-poster.jpg')
|
||||
print('[+]Image Copyed! ' + path + '/' + number + c_word + '-poster.jpg')
|
||||
|
||||
@@ -481,7 +481,7 @@ def core_main(file_path, number_th, conf: config.Config):
|
||||
if multi_part == 1:
|
||||
number += part # 这时number会被附加上CD1后缀
|
||||
|
||||
# 检查小封面
|
||||
# 检查小封面, 如果image cut为3,则下载小封面
|
||||
if imagecut == 3:
|
||||
small_cover_check(path, number, json_data['cover_small'], c_word, conf, filepath, conf.failed_folder())
|
||||
|
||||
|
||||
11
javdb.py
11
javdb.py
@@ -115,6 +115,13 @@ def main(number):
|
||||
ids =html.xpath('//*[@id="videos"]/div/div/a/div[contains(@class, "uid")]/text()')
|
||||
correct_url = urls[ids.index(number)]
|
||||
detail_page = get_html('https://javdb.com' + correct_url)
|
||||
|
||||
# If gray image exists ,then replace with normal cover
|
||||
cover_small = getCover_small(query_result, index=ids.index(number))
|
||||
if 'placeholder' in cover_small:
|
||||
cover_small = getCover(detail_page)
|
||||
|
||||
|
||||
dic = {
|
||||
'actor': getActor(detail_page),
|
||||
'title': getTitle(detail_page),
|
||||
@@ -125,7 +132,7 @@ def main(number):
|
||||
'release': getRelease(detail_page),
|
||||
'number': getNum(detail_page),
|
||||
'cover': getCover(detail_page),
|
||||
'cover_small': getCover_small(query_result, index=ids.index(number)),
|
||||
'cover_small': cover_small,
|
||||
'imagecut': 3,
|
||||
'tag': getTag(detail_page),
|
||||
'label': getLabel(detail_page),
|
||||
@@ -144,4 +151,4 @@ def main(number):
|
||||
# main('DV-1562')
|
||||
# input("[+][+]Press enter key exit, you can check the error messge before you exit.\n[+][+]按回车键结束,你可以在结束之前查看和错误信息。")
|
||||
if __name__ == "__main__":
|
||||
print(main('ipx-292'))
|
||||
print(main('snyz-007'))
|
||||
|
||||
@@ -23,7 +23,7 @@ def main(number: str):
|
||||
|
||||
# Scraping
|
||||
result = get_html(
|
||||
"http://www.m45e.com/cn/vl_searchbyid.php?keyword={}".format(number),
|
||||
"http://www.javlibrary.com/cn/vl_searchbyid.php?keyword={}".format(number),
|
||||
cookies=cookies,
|
||||
ua=user_agent,
|
||||
return_type="object"
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
{
|
||||
"version": "3.5.2",
|
||||
"version_show": "3.5.2",
|
||||
"version": "3.6",
|
||||
"version_show": "3.6",
|
||||
"download": "https://github.com/yoshiko2/AV_Data_Capture/releases"
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user