search fix

pull/15/head
DiMartinoXBMC 2016-12-26 23:36:50 +03:00
parent cb16b0d918
commit 034c1f7c9e
2 changed files with 17 additions and 10 deletions

View File

@ -736,7 +736,7 @@ class Core:
elif keyboard.isConfirmed(): elif keyboard.isConfirmed():
subcategory = query subcategory = query
if subcategory: if subcategory:
apps['subcategory'] = subcategory apps['subcategory'] = subcategory.decode('utf-8')
else: else:
return return
@ -911,7 +911,7 @@ class Core:
progressBar.update(iterator, dialogText, title, scrapers[scraper]) progressBar.update(iterator, dialogText, title, scrapers[scraper])
meta = self.Scraper.scraper(scraper, {'label': title, 'search': search, 'year': year}, self.language) meta = self.Scraper.scraper(scraper, {'label': title, 'search': search, 'year': year}, self.language)
#print 'meta:'+str(meta) log('meta:'+str(meta))
if self.language == 'ru': if self.language == 'ru':
if not meta.get('info').get('title') or \ if not meta.get('info').get('title') or \
not meta.get('properties').get('fanart_image') or not meta.get('icon'): not meta.get('properties').get('fanart_image') or not meta.get('icon'):

View File

@ -104,22 +104,23 @@ class KinoPoisk(Content.Content):
return True return True
def get_contentList(self, category, subcategory=None, apps_property=None): def get_contentList(self, category, subcategory=None, apps_property=None):
#self.debug=self.log
socket.setdefaulttimeout(15) socket.setdefaulttimeout(15)
contentList = [] contentList = []
url = self.get_url(category, subcategory, apps_property) url = self.get_url(category, subcategory, apps_property)
#print url self.debug('get_contentList: url = '+url)
response = self.makeRequest(url, headers=self.headers) response = self.makeRequest(url, headers=self.headers)
if None != response and 0 < len(response): if None != response and 0 < len(response):
#print response self.debug(str(response))
if category in ['hot']: if category in ['hot']:
contentList = self.popmode(response) contentList = self.popmode(response)
elif url.startswith(self.baseurl + '/s/type/film/list/'): elif url.startswith(self.baseurl + '/s/type/film/list/'):
contentList = self.infomode(response) contentList = self.infomode(response)
else: else:
contentList = self.topmode(response) contentList = self.topmode(response)
#print str(contentList) self.debug('get_contentList: contentList = '+str(contentList))
return contentList return contentList
def stripTtl(self, title): def stripTtl(self, title):
@ -132,12 +133,12 @@ class KinoPoisk(Content.Content):
contentList = [] contentList = []
Soup = BeautifulSoup(response) Soup = BeautifulSoup(response)
result = Soup.find('div', 'stat').findAll('div', 'el') result = Soup.find('div', 'stat').findAll('div', 'el')
#print str(result) self.debug('popmode: '+str(result))
for tr in result: for tr in result:
#main #main
a = tr.findAll('a') a = tr.findAll('a')
num = a[0].text num = a[0].text
#print num
info = {} info = {}
year = 0 year = 0
img = '' img = ''
@ -152,12 +153,14 @@ class KinoPoisk(Content.Content):
img = self.id2img(id[0]) img = self.id2img(id[0])
try: try:
title, year = re.compile('(.+?) \((\d\d\d\d)\)', re.DOTALL).findall(a[1].text)[0] title, year = re.compile('(.+?) \((\d\d\d\d)\)', re.DOTALL).findall(a[1].text)[0]
#self.log('popmode 1'+str((title, year)))
except: except:
pass pass
if not year: if not year:
try: try:
title, year = re.compile('(.+?) \(.*(\d\d\d\d)').findall(a[1].text)[0] title, year = re.compile('(.+?) \(.*(\d\d\d\d)').findall(a[1].text)[0]
info['tvshowtitle'] = title info['tvshowtitle'] = title
#self.log('popmode 2' + str((title, year)))
except: except:
pass pass
title = self.stripHtml(self.stripTtl(title)) title = self.stripHtml(self.stripTtl(title))
@ -176,7 +179,7 @@ class KinoPoisk(Content.Content):
contentList = [] contentList = []
Soup = BeautifulSoup(response) Soup = BeautifulSoup(response)
result = Soup.find('table', {'cellpadding': '3'}).findAll('tr')[2:] result = Soup.find('table', {'cellpadding': '3'}).findAll('tr')[2:]
#print str(result) self.debug('topmode: ' + str(result))
for tr in result: for tr in result:
#main #main
td = tr.findAll('td') td = tr.findAll('td')
@ -198,7 +201,11 @@ class KinoPoisk(Content.Content):
year = re.compile('(.+) \((\d\d\d\d)\)').findall(a_all.text) year = re.compile('(.+) \((\d\d\d\d)\)').findall(a_all.text)
if not year: if not year:
try: try:
title, year = re.compile('(.+) \(.*(\d\d\d\d)').findall(a_all.text)[0] match = re.search(r"(.+) \((\d\d\d\d) &ndash;|(.+) \(.*(\d\d\d\d)", a_all.text,
re.IGNORECASE | re.MULTILINE)
if match:
title = match.group(1)
year = match.group(2)
info['tvshowtitle'] = title info['tvshowtitle'] = title
except: except:
title = a_all.text title = a_all.text