hz
This commit is contained in:
1 parent
bef19d8c90
commit
c7bcd9c450
6 files changed
+1234
-903
No files matched your search
@@ -99,27 +99,28 @@ class IMDB(Content.Content):
|
||||
return True
|
||||
|
||||
def get_contentList(self, category, subcategory=None, apps_property=None):
|
||||
self.debug = self.log
|
||||
contentList = []
|
||||
url = self.get_url(category, subcategory, apps_property)
|
||||
|
||||
response = self.makeRequest(url, headers=self.headers)
|
||||
|
||||
if None != response and 0 < len(response):
|
||||
#print response
|
||||
self.debug(response)
|
||||
if category in ['top']:
|
||||
contentList = self.topmode(response)
|
||||
elif category == 'search':
|
||||
contentList = self.searchmode(response)
|
||||
else: #if category in ['genre']:
|
||||
contentList = self.genremode(response)
|
||||
#print str(contentList)
|
||||
self.debug(str(contentList))
|
||||
return contentList
|
||||
|
||||
def searchmode(self, response):
|
||||
contentList = []
|
||||
pars = HTMLParser.HTMLParser()
|
||||
Soup = BeautifulSoup(response)
|
||||
result = Soup.findAll('tr', {'class': ['findResult odd', 'findResult even']})
|
||||
result = Soup.findAll('tr', {'class': 'lister-item mode-advanced'})
|
||||
num = 250
|
||||
for tr in result:
|
||||
#main
|
||||
@@ -147,7 +148,7 @@ class IMDB(Content.Content):
|
||||
int(int(self.sourceWeight) * (251 - int(num))),
|
||||
originaltitle, title, int(year), img, info,
|
||||
))
|
||||
#print result
|
||||
self.debug(str(result))
|
||||
return contentList
|
||||
|
||||
def genremode(self, response):
|
||||
@@ -181,7 +182,7 @@ class IMDB(Content.Content):
|
||||
int(int(self.sourceWeight) * (251 - int(num))),
|
||||
originaltitle, title, int(year), img, info,
|
||||
))
|
||||
#print result
|
||||
self.debug(str(result))
|
||||
return contentList
|
||||
|
||||
def biggerImg(self, img):
|
||||
|
||||
File renamed without changes.
Whitespace-only changes.
@@ -21,20 +21,23 @@ def shelf(filename, ttl=0):
|
||||
with LOCKS.get(filename, threading.RLock()):
|
||||
# with closing(shelve.open(filename, writeback=True)) as d:
|
||||
d = shelve.open(filename, writeback=True)
|
||||
try:
|
||||
#try:
|
||||
if True:
|
||||
import time
|
||||
if not dict(d):
|
||||
log('xxx')
|
||||
d.update({
|
||||
"created_at": time.time(),
|
||||
"data": {},
|
||||
})
|
||||
elif ttl > 0 and (time.time() - d["created_at"]) > ttl:
|
||||
log('xxx')
|
||||
d["created_at"] = time.time()
|
||||
d["data"] = {}
|
||||
return d
|
||||
except:
|
||||
d.close()
|
||||
raise
|
||||
#except:
|
||||
# d.close()
|
||||
# raise
|
||||
|
||||
_config = {}
|
||||
|
||||
|
||||
Reference in new issue
Block a user