mirror of
https://github.com/SickGear/SickGear.git
synced 2025-01-07 10:33:38 +00:00
Merge branch 'master' into develop
This commit is contained in:
commit
1bfda9844e
3 changed files with 22 additions and 11 deletions
|
@ -21,6 +21,11 @@
|
||||||
* Update Six compatibility library 1.9.0 (r400) to 1.10.0 (r405)
|
* Update Six compatibility library 1.9.0 (r400) to 1.10.0 (r405)
|
||||||
|
|
||||||
|
|
||||||
|
### 0.11.1 (2016-01-12 22:20:00 UTC)
|
||||||
|
|
||||||
|
* Fix handling non-numeric IMDb popular ratings
|
||||||
|
|
||||||
|
|
||||||
### 0.11.0 (2016-01-10 22:30:00 UTC)
|
### 0.11.0 (2016-01-10 22:30:00 UTC)
|
||||||
|
|
||||||
* Change to only refresh scene exception data for shows that need it
|
* Change to only refresh scene exception data for shows that need it
|
||||||
|
|
|
@ -737,6 +737,14 @@ def tryInt(s, s_default=0):
|
||||||
return s_default
|
return s_default
|
||||||
|
|
||||||
|
|
||||||
|
# try to convert to float, return default on failure
|
||||||
|
def tryFloat(s, s_default=0.0):
|
||||||
|
try:
|
||||||
|
return float(s)
|
||||||
|
except:
|
||||||
|
return float(s_default)
|
||||||
|
|
||||||
|
|
||||||
# generates a md5 hash of a file
|
# generates a md5 hash of a file
|
||||||
def md5_for_file(filename, block_size=2 ** 16):
|
def md5_for_file(filename, block_size=2 ** 16):
|
||||||
try:
|
try:
|
||||||
|
|
|
@ -2464,11 +2464,11 @@ class NewHomeAddShows(Home):
|
||||||
imdb_id = re.compile(r'(?i).*(tt\d+)$')
|
imdb_id = re.compile(r'(?i).*(tt\d+)$')
|
||||||
|
|
||||||
with BS4Parser(html, features=['html5lib', 'permissive']) as soup:
|
with BS4Parser(html, features=['html5lib', 'permissive']) as soup:
|
||||||
torrent_table = soup.find('table', {'class': 'results'})
|
show_list = soup.find('table', {'class': 'results'})
|
||||||
torrent_rows = [] if not torrent_table else torrent_table.find_all('tr')
|
shows = [] if not show_list else show_list.find_all('tr')
|
||||||
oldest, newest, oldest_dt, newest_dt = None, None, 9999999, 0
|
oldest, newest, oldest_dt, newest_dt = None, None, 9999999, 0
|
||||||
|
|
||||||
for tr in torrent_rows[1:]:
|
for tr in shows[1:]:
|
||||||
try:
|
try:
|
||||||
url_path = tr.select('td.title a[href*=title]')[0]['href'].strip('/')
|
url_path = tr.select('td.title a[href*=title]')[0]['href'].strip('/')
|
||||||
ids = dict(imdb=imdb_id.sub(r'\1', url_path))
|
ids = dict(imdb=imdb_id.sub(r'\1', url_path))
|
||||||
|
@ -2486,15 +2486,15 @@ class NewHomeAddShows(Home):
|
||||||
newest = year
|
newest = year
|
||||||
|
|
||||||
genres = tr.select('td.title span.genre')
|
genres = tr.select('td.title span.genre')
|
||||||
images = tr.select('td.image img')
|
images = {}
|
||||||
|
img = tr.select('td.image img')
|
||||||
overview = tr.select('td.title span.outline')
|
overview = tr.select('td.title span.outline')
|
||||||
rating = tr.select('td.title span.rating-rating span.value')
|
rating = tr.select('td.title span.rating-rating span.value')
|
||||||
voting = tr.select('td.title div.rating-list')
|
voting = tr.select('td.title div.rating-list')
|
||||||
if len(images) and 'tv_series.gif' not in images[0].get('src'):
|
if len(img):
|
||||||
img_uri = images[0].get('src')
|
img_uri = img[0].get('src')
|
||||||
images = {}
|
|
||||||
match = img_size.search(img_uri)
|
match = img_size.search(img_uri)
|
||||||
if match:
|
if match and 'tv_series.gif' not in img_uri:
|
||||||
scale = lambda low1, high1: int((float(450) / high1) * low1)
|
scale = lambda low1, high1: int((float(450) / high1) * low1)
|
||||||
high = int(max([match.group(9), match.group(11)]))
|
high = int(max([match.group(9), match.group(11)]))
|
||||||
scaled = [scale(x, high) for x in [(int(match.group(n)), high)[high == int(match.group(n))] for n in 3, 5, 7, 9, 11]]
|
scaled = [scale(x, high) for x in [(int(match.group(n)), high)[high == int(match.group(n))] for n in 3, 5, 7, 9, 11]]
|
||||||
|
@ -2507,8 +2507,6 @@ class NewHomeAddShows(Home):
|
||||||
if not ek.ek(os.path.isfile, cached_name):
|
if not ek.ek(os.path.isfile, cached_name):
|
||||||
helpers.download_file(img_uri, cached_name)
|
helpers.download_file(img_uri, cached_name)
|
||||||
images = dict(poster=dict(thumb='cache/images/imdb/%s' % file_name))
|
images = dict(poster=dict(thumb='cache/images/imdb/%s' % file_name))
|
||||||
else:
|
|
||||||
images = {}
|
|
||||||
|
|
||||||
filtered.append(dict(
|
filtered.append(dict(
|
||||||
premiered=dt_ordinal,
|
premiered=dt_ordinal,
|
||||||
|
@ -2520,7 +2518,7 @@ class NewHomeAddShows(Home):
|
||||||
images=images,
|
images=images,
|
||||||
overview=('No overview yet' if not len(overview) else
|
overview=('No overview yet' if not len(overview) else
|
||||||
self.encode_html(overview[0].get_text()[:250:].strip())),
|
self.encode_html(overview[0].get_text()[:250:].strip())),
|
||||||
rating=0 if not len(rating) else int(float(rating[0].get_text()) * 10),
|
rating=0 if not len(rating) else int(helpers.tryFloat(rating[0].get_text()) * 10),
|
||||||
title=tr.select('td.title a')[0].get_text().strip(),
|
title=tr.select('td.title a')[0].get_text().strip(),
|
||||||
url_src_db='http://www.imdb.com/%s/' % url_path,
|
url_src_db='http://www.imdb.com/%s/' % url_path,
|
||||||
votes=0 if not len(voting) else vote_value.sub(r'\1\2', voting[0].get('title'))))
|
votes=0 if not len(voting) else vote_value.sub(r'\1\2', voting[0].get('title'))))
|
||||||
|
|
Loading…
Reference in a new issue