pull/15/head
DiMartinoXBMC 2016-11-04 16:34:40 +03:00
parent bef19d8c90
commit c7bcd9c450
6 changed files with 1234 additions and 903 deletions

File diff suppressed because it is too large Load Diff

View File

@ -991,7 +991,7 @@ class Core:
title = title.encode('utf-8', 'ignore') title = title.encode('utf-8', 'ignore')
except: except:
continue continue
label = info.get('label').encode('utf-8', 'ignore') log(str(info))
if info.get('link'): if info.get('link'):
if isinstance(info.get('link'), tuple): if isinstance(info.get('link'), tuple):
@ -1112,7 +1112,7 @@ class Core:
images = {'icon':image, 'thumb':image} images = {'icon':image, 'thumb':image}
images = {'icon': image, 'thumb': image, images = {'icon': image, 'thumb': image,
'poster': image, 'banner': image, 'poster': image, 'banner': image,
'fanart': image, 'landscape': image, #'fanart': image, 'landscape': image,
#'clearart': image, 'clearlogo': image, #'clearart': image, 'clearlogo': image,
} }
listitem.setArt(images) listitem.setArt(images)

View File

@ -99,27 +99,28 @@ class IMDB(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
contentList = [] contentList = []
url = self.get_url(category, subcategory, apps_property) url = self.get_url(category, subcategory, apps_property)
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(response)
if category in ['top']: if category in ['top']:
contentList = self.topmode(response) contentList = self.topmode(response)
elif category == 'search': elif category == 'search':
contentList = self.searchmode(response) contentList = self.searchmode(response)
else: #if category in ['genre']: else: #if category in ['genre']:
contentList = self.genremode(response) contentList = self.genremode(response)
#print str(contentList) self.debug(str(contentList))
return contentList return contentList
def searchmode(self, response): def searchmode(self, response):
contentList = [] contentList = []
pars = HTMLParser.HTMLParser() pars = HTMLParser.HTMLParser()
Soup = BeautifulSoup(response) Soup = BeautifulSoup(response)
result = Soup.findAll('tr', {'class': ['findResult odd', 'findResult even']}) result = Soup.findAll('tr', {'class': 'lister-item mode-advanced'})
num = 250 num = 250
for tr in result: for tr in result:
#main #main
@ -147,7 +148,7 @@ class IMDB(Content.Content):
int(int(self.sourceWeight) * (251 - int(num))), int(int(self.sourceWeight) * (251 - int(num))),
originaltitle, title, int(year), img, info, originaltitle, title, int(year), img, info,
)) ))
#print result self.debug(str(result))
return contentList return contentList
def genremode(self, response): def genremode(self, response):
@ -181,7 +182,7 @@ class IMDB(Content.Content):
int(int(self.sourceWeight) * (251 - int(num))), int(int(self.sourceWeight) * (251 - int(num))),
originaltitle, title, int(year), img, info, originaltitle, title, int(year), img, info,
)) ))
#print result self.debug(str(result))
return contentList return contentList
def biggerImg(self, img): def biggerImg(self, img):

View File

@ -21,20 +21,23 @@ def shelf(filename, ttl=0):
with LOCKS.get(filename, threading.RLock()): with LOCKS.get(filename, threading.RLock()):
# with closing(shelve.open(filename, writeback=True)) as d: # with closing(shelve.open(filename, writeback=True)) as d:
d = shelve.open(filename, writeback=True) d = shelve.open(filename, writeback=True)
try: #try:
if True:
import time import time
if not dict(d): if not dict(d):
log('xxx')
d.update({ d.update({
"created_at": time.time(), "created_at": time.time(),
"data": {}, "data": {},
}) })
elif ttl > 0 and (time.time() - d["created_at"]) > ttl: elif ttl > 0 and (time.time() - d["created_at"]) > ttl:
log('xxx')
d["created_at"] = time.time() d["created_at"] = time.time()
d["data"] = {} d["data"] = {}
return d return d
except: #except:
d.close() # d.close()
raise # raise
_config = {} _config = {}