forked from mvdctop/Movie_Data_Capture
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
190 additions
and
42 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -23,5 +23,5 @@ media_warehouse=emby | |
[escape] | ||
literals=\() | ||
|
||
[movie_location] | ||
path= | ||
[debug_mode] | ||
switch=0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,108 @@ | ||
#!/usr/bin/python | ||
# -*- coding: utf-8 -*- | ||
import re | ||
from lxml import etree | ||
import json | ||
from ADC_function import * | ||
# import sys | ||
# import io | ||
# sys.stdout = io.TextIOWrapper(sys.stdout.buffer, errors = 'replace', line_buffering = True) | ||
|
||
def getTitle(a): | ||
html = etree.fromstring(a, etree.HTMLParser()) | ||
result = html.xpath('//*[@id="title"]/text()')[0] | ||
return result | ||
def getActor(a): #//*[@id="center_column"]/div[2]/div[1]/div/table/tbody/tr[1]/td/text() | ||
html = etree.fromstring(a, etree.HTMLParser()) | ||
result = str(html.xpath("//td[contains(text(),'出演者')]/following-sibling::td/span/a/text()")).strip(" ['']").replace("', '",',') | ||
return result | ||
def getStudio(a): | ||
html = etree.fromstring(a, etree.HTMLParser()) # //table/tr[1]/td[1]/text() | ||
try: | ||
result1 = html.xpath("//td[contains(text(),'メーカー')]/following-sibling::td/a/text()")[0] | ||
except: | ||
result1 = html.xpath("//td[contains(text(),'メーカー')]/following-sibling::td/text()")[0] | ||
return result1 | ||
def getRuntime(a): | ||
html = etree.fromstring(a, etree.HTMLParser()) # //table/tr[1]/td[1]/text() | ||
result1 = html.xpath("//td[contains(text(),'収録時間')]/following-sibling::td/text()")[0] | ||
return re.search('\d+', str(result1)).group() | ||
def getLabel(a): | ||
html = etree.fromstring(a, etree.HTMLParser()) # //table/tr[1]/td[1]/text() | ||
try: | ||
result1 = html.xpath("//td[contains(text(),'シリーズ:')]/following-sibling::td/a/text()")[0] | ||
except: | ||
result1 = html.xpath("//td[contains(text(),'シリーズ:')]/following-sibling::td/text()")[0] | ||
return result1 | ||
def getNum(a): | ||
html = etree.fromstring(a, etree.HTMLParser()) # //table/tr[1]/td[1]/text() | ||
try: | ||
result1 = html.xpath("//td[contains(text(),'品番:')]/following-sibling::td/a/text()")[0] | ||
except: | ||
result1 = html.xpath("//td[contains(text(),'品番:')]/following-sibling::td/text()")[0] | ||
return result1 | ||
def getYear(getRelease): | ||
try: | ||
result = str(re.search('\d{4}',getRelease).group()) | ||
return result | ||
except: | ||
return getRelease | ||
def getRelease(a): | ||
html = etree.fromstring(a, etree.HTMLParser()) # //table/tr[1]/td[1]/text() | ||
try: | ||
result1 = html.xpath("//td[contains(text(),'商品発売日:')]/following-sibling::td/a/text()")[0].lstrip('\n') | ||
except: | ||
result1 = html.xpath("//td[contains(text(),'商品発売日:')]/following-sibling::td/text()")[0].lstrip('\n') | ||
return result1 | ||
def getTag(a): | ||
html = etree.fromstring(a, etree.HTMLParser()) # //table/tr[1]/td[1]/text() | ||
try: | ||
result1 = str(html.xpath("//td[contains(text(),'ジャンル:')]/following-sibling::td/a/text()")).strip(" ['']") | ||
except: | ||
result1 = str(html.xpath("//td[contains(text(),'ジャンル:')]/following-sibling::td/text()")).strip(" ['']") | ||
return result1.replace("', '",",") | ||
def getCover(htmlcode,number): | ||
html = etree.fromstring(htmlcode, etree.HTMLParser()) | ||
result = html.xpath('//*[@id="'+number+'"]/@href')[0] | ||
return result | ||
def getDirector(a): | ||
html = etree.fromstring(a, etree.HTMLParser()) # //table/tr[1]/td[1]/text() | ||
try: | ||
result1 = html.xpath("//td[contains(text(),'監督:')]/following-sibling::td/a/text()")[0] | ||
except: | ||
result1 = html.xpath("//td[contains(text(),'監督:')]/following-sibling::td/text()")[0] | ||
return result1 | ||
def getOutline(htmlcode): | ||
html = etree.fromstring(htmlcode, etree.HTMLParser()) | ||
result = str(html.xpath("//div[@class='mg-b20 lh4']/text()")[0]).replace('\n','') | ||
return result | ||
def main(number): | ||
htmlcode=get_html('https://www.dmm.co.jp/digital/videoa/-/detail/=/cid='+number) | ||
url = 'https://www.dmm.co.jp/digital/videoa/-/detail/=/cid='+number | ||
if '404 Not Found' in htmlcode: | ||
htmlcode=get_html('https://www.dmm.co.jp/mono/dvd/-/detail/=/cid='+number) | ||
url = 'https://www.dmm.co.jp/mono/dvd/-/detail/=/cid='+number | ||
dic = { | ||
'title': getTitle(htmlcode).strip(getActor(htmlcode)), | ||
'studio': getStudio(htmlcode), | ||
'outline': getOutline(htmlcode), | ||
'runtime': getRuntime(htmlcode), | ||
'director': getDirector(htmlcode), | ||
'actor': getActor(htmlcode), | ||
'release': getRelease(htmlcode), | ||
'number': getNum(htmlcode), | ||
'cover': getCover(htmlcode,number), | ||
'imagecut': 1, | ||
'tag': getTag(htmlcode), | ||
'label':getLabel(htmlcode), | ||
'year': getYear(getRelease(htmlcode)), # str(re.search('\d{4}',getRelease(a)).group()), | ||
'actor_photo': '', | ||
'website': url, | ||
'source': 'siro.py', | ||
} | ||
js = json.dumps(dic, ensure_ascii=False, sort_keys=True, indent=4, separators=(',', ':')) # .encode('UTF-8') | ||
return js | ||
|
||
# main('DV-1562') | ||
# input("[+][+]Press enter key exit, you can check the error messge before you exit.\n[+][+]按回车键结束,你可以在结束之前查看和错误信息。") | ||
#print(main('ssni00384')) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
{ | ||
"version": "2.2", | ||
"version_show":"2.2", | ||
"version": "2.3", | ||
"version_show":"2.3", | ||
"download": "https://github.com/yoshiko2/AV_Data_Capture/releases" | ||
} |