From 4913ee5489eab1dbca2745a0631c7991c3bf8f3b Mon Sep 17 00:00:00 2001 From: JackDandy Date: Wed, 12 Dec 2018 19:28:09 +0000 Subject: [PATCH] Change to public IMDb lists is now handled when adding a list. Change IMDb cards view to feedback when a list has no TV shows. Change IMDb cards view to include TV Mini Series. Change add "list more" to list choices on IMDb cards view. Change IMDb requests to be https. --- CHANGES.md | 11 +++++++- gui/slick/interfaces/default/home_browseShows.tmpl | 6 +++- sickbeard/webserve.py | 32 ++++++++++++++-------- 3 files changed, 36 insertions(+), 13 deletions(-) diff --git a/CHANGES.md b/CHANGES.md index b9d6d7e..2722417 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,4 +1,13 @@ -### 0.18.5 (2018-12-10 12:15:00 UTC) +### 0.18.6 (2018-12-12 19:30:00 UTC) + +* Change to public IMDb lists is now handled when adding a list +* Change IMDb cards view to feedback when a list has no TV shows +* Change IMDb cards view to include TV Mini Series +* Change add "list more" to list choices on IMDb cards view +* Change IMDb requests to be https + + +### 0.18.5 (2018-12-10 12:15:00 UTC) * Change all nzb provider requests to 60s timeout * Fix encode str to unicode for get_UWRatio diff --git a/gui/slick/interfaces/default/home_browseShows.tmpl b/gui/slick/interfaces/default/home_browseShows.tmpl index d4f7a12..65ec011 100644 --- a/gui/slick/interfaces/default/home_browseShows.tmpl +++ b/gui/slick/interfaces/default/home_browseShows.tmpl @@ -181,6 +181,9 @@ $(document).ready(function(){ el$.on('layoutComplete', llUpdate); el$.isotope({ filter: filterValue }); } else { + if (-1 !== filterValue.indexOf('more_imdb')){ + filterValue = $('#showfilter').find('option:not([value="more_imdb"]).selected').val() + '&more=1'; + } #end raw location = '$sg_root/home/addShows/' + filterValue; #raw @@ -286,8 +289,9 @@ $(document).ready(function(){ #for $i, $p in enumerate($periods) #set $period='%s,%s' % ($p[0], $p[1]) - + #end for + #end if #if not hasattr($sickbeard, 'IMDB_ACCOUNTS')##else# diff --git a/sickbeard/webserve.py b/sickbeard/webserve.py index 3744886..3bb84aa 100644 --- a/sickbeard/webserve.py +++ b/sickbeard/webserve.py @@ -3510,14 +3510,19 @@ class NewHomeAddShows(Home): return json.dumps({'result': 'Fail: Invalid IMDb ID'}) acc_id = account_id[0] - url = 'http://www.imdb.com/user/ur%s/watchlist' % acc_id + \ - '/_ajax?sort=date_added,desc&mode=detail&page=1&title_type=tvSeries%2CtvEpisode&ref_=wl_vm_dtl' + url = 'https://www.imdb.com/user/ur%s/watchlist' % acc_id + \ + '?sort=date_added,desc&title_type=tvSeries,tvEpisode,tvMiniSeries&view=detail' html = helpers.getURL(url, nocache=True) + if not html: + return json.dumps({'result': 'Fail: No list found with id: %s' % acc_id}) + if 'id="unavailable"' in html or 'list is not public' in html or 'not enabled public view' in html: + return json.dumps({'result': 'Fail: List is not public with id: %s' % acc_id}) try: - list_name = re.findall('(?i)]+>(.*)\s+Watchlist', html)[0].replace('\'s', '') + list_name = re.findall('(?i)og:title[^>]+?content[^"]+?"([^"]+?)\s+Watchlist\s*"', + html)[0].replace('\'s', '') accounts[acc_id] = list_name or 'noname' - except: + except (Exception, BaseException): return json.dumps({'result': 'Fail: No list found with id: %s' % acc_id}) else: @@ -3621,7 +3626,7 @@ class NewHomeAddShows(Home): overview='No overview yet' if not overview else self.encode_html(overview[:250:]), rating=int(helpers.tryFloat(rating) * 10), title=row.get('primary').get('title'), - url_src_db='http://www.imdb.com/%s/' % row.get('primary').get('href').strip('/'), + url_src_db='https://www.imdb.com/%s/' % row.get('primary').get('href').strip('/'), votes=helpers.tryInt(voting, 'TBA'))) indexer, indexerid = idx_ids.get(ids['imdb'], (None, None)) @@ -3684,7 +3689,7 @@ class NewHomeAddShows(Home): 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]] + (3, 5, 7, 9, 11)]] parts = [match.group(1), match.group(4), match.group(6), match.group(8), match.group(10), match.group(12)] img_uri = img_uri.replace(match.group(), ''.join( @@ -3704,7 +3709,7 @@ class NewHomeAddShows(Home): overview='No overview yet' if not overview else self.encode_html(overview[:250:]), rating=0 if not len(rating) else int(helpers.tryFloat(rating) * 10), title=title.get_text().strip(), - url_src_db='http://www.imdb.com/%s/' % url_path.strip('/'), + url_src_db='https://www.imdb.com/%s/' % url_path.strip('/'), votes=0 if not len(voting) else helpers.tryInt(voting, 'TBA'))) show = filter(lambda x: x.imdbid == ids['imdb'], sickbeard.showList)[0] @@ -3744,8 +3749,9 @@ class NewHomeAddShows(Home): list_name += ('\'s', '')['your' == list_name.replace('(Off) ', '').lower()] - url = 'http://www.imdb.com/user/ur%s/watchlist' % acc_id - url_ui = '?mode=detail&page=1&sort=date_added,desc&title_type=tvSeries%2CtvEpisode&ref_=wl_ref_typ' + url = 'https://www.imdb.com/user/ur%s/watchlist' % acc_id + url_ui = '?mode=detail&page=1&sort=date_added,desc&' \ + 'title_type=tvSeries,tvEpisode,tvMiniSeries&ref_=wl_ref_typ' html = helpers.getURL(url + url_ui, headers={'Accept-Language': 'en-US'}) if html: @@ -3763,7 +3769,7 @@ class NewHomeAddShows(Home): footnote = ('Note; Some images on this page may be cropped at source: ' + '%s watchlist at IMDb' % ( helpers.anon_url(url + url_ui), list_name)) - elif None is not show_list_found: + elif None is not show_list_found or (None is show_list_found and list_name in html): kwargs['show_header'] = True kwargs['error_msg'] = 'No TV titles in the %s watchlist at IMDb' % ( helpers.anon_url(url + url_ui), list_name) @@ -3787,7 +3793,11 @@ class NewHomeAddShows(Home): mode = 'popular-%s,%s' % (start_year, end_year) - url = 'http://www.imdb.com/search/title?at=0&sort=moviemeter&title_type=tv_series&year=%s,%s' % (start_year, end_year) + page = 'more' in kwargs and '51' or '' + if page: + mode += '-more' + url = 'https://www.imdb.com/search/title?at=0&sort=moviemeter&' \ + 'title_type=tvSeries,tvEpisode,tvMiniSeries&year=%s,%s&start=%s' % (start_year, end_year, page) html = helpers.getURL(url, headers={'Accept-Language': 'en-US'}) if html: show_list_found = None