Merge pull request #602 from lededev/javdbjson-fix

javdb.py:javdbx.json bugfix, find path before check days
This commit is contained in:
Yoshiko2
2021-09-30 23:20:37 +08:00
committed by GitHub
3 changed files with 16 additions and 11 deletions

View File

@@ -182,18 +182,21 @@ def movie_lists(root, conf, regexstr):
success_folder = conf.success_folder() success_folder = conf.success_folder()
for current_dir, subdirs, files in os.walk(success_folder, topdown=False): for current_dir, subdirs, files in os.walk(success_folder, topdown=False):
for f in files: for f in files:
if not os.path.splitext(f)[1].upper() in file_type: f_obj = Path(f)
if f_obj.suffix.lower() != '.nfo':
continue continue
nfo_file = os.path.join(current_dir, str(Path(f).with_suffix('.nfo'))) if file_modification_days(Path(current_dir) / f_obj) > nfo_skip_days:
if file_modification_days(nfo_file) > nfo_skip_days:
continue continue
number = get_number(False, os.path.basename(f)) number = get_number(False, f_obj.stem)
if number: if number:
skip_numbers.add(number.upper()) skip_numbers.add(number.upper())
rm_list = []
for f in total: for f in total:
n_number = get_number(False, os.path.basename(f)) n_number = get_number(False, os.path.basename(f))
if n_number and n_number.upper() in skip_numbers: if n_number and n_number.upper() in skip_numbers:
total.pop(total.index(f)) rm_list.append(f)
for f in rm_list:
total.remove(f)
return total return total

View File

@@ -218,11 +218,13 @@ def main(number):
cookie_json = './' + javdb_site + '.json' cookie_json = './' + javdb_site + '.json'
javdb_cookies = {'over18':'1', 'theme':'auto', 'locale':'zh'} javdb_cookies = {'over18':'1', 'theme':'auto', 'locale':'zh'}
# 不加载过期的cookiejavdb登录界面显示为7天免登录故假定cookie有效期为7天 # 不加载过期的cookiejavdb登录界面显示为7天免登录故假定cookie有效期为7天
cdays = file_modification_days(cookie_json) cookies_dict, cookies_filepath = load_cookies(cookie_json)
if cdays < 7: if isinstance(cookies_dict, dict) and isinstance(cookies_filepath, str):
javdb_cookies, cookies_filepath = load_cookies(cookie_json) cdays = file_modification_days(cookies_filepath)
elif cdays != 9999: if cdays < 7:
print( javdb_cookies = cookies_dict
elif cdays != 9999:
print(
f'[!]Cookies file {cookies_filepath} was updated {cdays} days ago, it will not be used for HTTP requests.') f'[!]Cookies file {cookies_filepath} was updated {cdays} days ago, it will not be used for HTTP requests.')
try: try:

View File

@@ -4,7 +4,7 @@ from core import *
G_spat = re.compile( G_spat = re.compile(
"(^22-sht\.me|-fhd|_fhd|^fhd_|^fhd-|-hd|_hd|^hd_|^hd-|-sd|_sd|-1080p|_1080p|-720p|_720p)", "^22-sht\.me|-fhd|_fhd|^fhd_|^fhd-|-hd|_hd|^hd_|^hd-|-sd|_sd|-1080p|_1080p|-720p|_720p|^hhd800\.com@",
re.IGNORECASE) re.IGNORECASE)