下载演员头像到.actors目录,KODI用;不联网的Jellyfin封面图文件名
This commit is contained in:
@@ -30,13 +30,9 @@ def getActor(html):
|
||||
return r
|
||||
|
||||
def getaphoto(url, session):
|
||||
html_page = session.get(url).text if session is not None else get_html(url)
|
||||
img_prether = re.compile(r'<span class\=\"avatar\" style\=\"background\-image\: url\((.*?)\)')
|
||||
img_url = img_prether.findall(html_page)
|
||||
if img_url:
|
||||
return img_url[0]
|
||||
else:
|
||||
return ''
|
||||
html_page = session.get(url).text
|
||||
img_url = re.findall(r'<span class\=\"avatar\" style\=\"background\-image\: url\((.*?)\)', html_page)
|
||||
return img_url[0] if img_url else ''
|
||||
|
||||
def getActorPhoto(html, javdb_site, session):
|
||||
actorall = html.xpath('//strong[contains(text(),"演員:")]/../span/a[starts-with(@href,"/actors/")]')
|
||||
@@ -44,9 +40,18 @@ def getActorPhoto(html, javdb_site, session):
|
||||
return {}
|
||||
a = getActor(html)
|
||||
actor_photo = {}
|
||||
if not session:
|
||||
session = get_html_session()
|
||||
for i in actorall:
|
||||
if i.text in a:
|
||||
actor_photo[i.text] = getaphoto(urljoin(f'https://{javdb_site}.com', i.attrib['href']), session)
|
||||
x = re.findall(r'/actors/(.*)', i.attrib['href'], re.A)
|
||||
if not len(x) or not len(x[0]) or i.text not in a:
|
||||
continue
|
||||
actor_id = x[0]
|
||||
pic_url = f"https://c1.jdbstatic.com/avatars/{actor_id[:2].lower()}/{actor_id}.jpg"
|
||||
if not session.head(pic_url).ok:
|
||||
pic_url = getaphoto(urljoin(f'https://{javdb_site}.com', i.attrib['href']), session)
|
||||
if len(pic_url):
|
||||
actor_photo[i.text] = pic_url
|
||||
return actor_photo
|
||||
|
||||
def getStudio(a, html):
|
||||
@@ -300,7 +305,6 @@ def main(number):
|
||||
'tag': getTag(lx),
|
||||
'label': getLabel(lx),
|
||||
'year': getYear(detail_page), # str(re.search('\d{4}',getRelease(a)).group()),
|
||||
# 'actor_photo': getActorPhoto(lx, javdb_site, session),
|
||||
'website': urljoin('https://javdb.com', correct_url),
|
||||
'source': 'javdb.py',
|
||||
'series': getSeries(lx),
|
||||
@@ -316,6 +320,8 @@ def main(number):
|
||||
dic['series'] = dic['studio']
|
||||
if not dic['label']:
|
||||
dic['label'] = dic['studio']
|
||||
if config.getInstance().download_actor_photo_for_kodi():
|
||||
dic['actor_photo'] = getActorPhoto(lx, javdb_site, session)
|
||||
|
||||
|
||||
except Exception as e:
|
||||
@@ -328,19 +334,21 @@ def main(number):
|
||||
# main('DV-1562')
|
||||
# input("[+][+]Press enter key exit, you can check the error messge before you exit.\n[+][+]按回车键结束,你可以在结束之前查看和错误信息。")
|
||||
if __name__ == "__main__":
|
||||
config.getInstance().set_override("storyline:switch=0")
|
||||
config.getInstance().set_override("actor_photo:download_for_kodi=1")
|
||||
config.getInstance().set_override("debug_mode:switch=1")
|
||||
# print(main('blacked.20.05.30'))
|
||||
# print(main('AGAV-042'))
|
||||
# print(main('BANK-022'))
|
||||
print(main('AGAV-042'))
|
||||
print(main('BANK-022'))
|
||||
print(main('070116-197'))
|
||||
# print(main('093021_539')) # 没有剧照 片商pacopacomama
|
||||
print(main('093021_539')) # 没有剧照 片商pacopacomama
|
||||
#print(main('FC2-2278260'))
|
||||
# print(main('FC2-735670'))
|
||||
# print(main('FC2-1174949')) # not found
|
||||
#print(main('MVSD-439'))
|
||||
print(main('MVSD-439'))
|
||||
# print(main('EHM0001')) # not found
|
||||
#print(main('FC2-2314275'))
|
||||
# print(main('EBOD-646'))
|
||||
# print(main('LOVE-262'))
|
||||
print(main('EBOD-646'))
|
||||
print(main('LOVE-262'))
|
||||
print(main('ABP-890'))
|
||||
print(main('blacked.14.12.08'))
|
||||
|
||||
Reference in New Issue
Block a user