Merge pull request #863 from JackDandy/feature/ChangeImproveMapper

Change improve indexermapper.
This commit is contained in:
JackDandy 2017-02-01 02:32:27 +00:00 committed by GitHub
commit 5f05cf62f0
2 changed files with 19 additions and 11 deletions

View file

@ -194,11 +194,26 @@ def get_imdbid_by_name(name, startyear):
if hasattr(r, 'movieID') and hasattr(r, 'data') and 'kind' in r.data and r.data['kind'] == 'tv series' \
and 'year' in r.data and r.data['year'] == startyear:
ids[INDEXER_IMDB] = tryInt(r.movieID)
break
except (StandardError, Exception):
pass
return {k: v for k, v in ids.iteritems() if v not in (None, '', 0)}
def check_missing_trakt_id(n_ids, show_obj, url_trakt):
if INDEXER_TRAKT not in n_ids:
new_url_trakt = TraktDict()
for k, v in n_ids.iteritems():
if k != show_obj.indexer and k in [INDEXER_TVDB, INDEXER_TVRAGE, INDEXER_IMDB] and 0 < v \
and k not in url_trakt:
new_url_trakt[k] = v
if 0 < len(new_url_trakt):
n_ids.update(get_trakt_ids(new_url_trakt))
return n_ids
def map_indexers_to_show(show_obj, update=False, force=False, recheck=False):
"""
@ -281,18 +296,11 @@ def map_indexers_to_show(show_obj, update=False, force=False, recheck=False):
or k not in new_ids or new_ids.get(k) in (None, 0, '', MapStatus.NOT_FOUND)}
new_ids.update(tvids)
if INDEXER_TRAKT not in new_ids:
new_url_trakt = TraktDict()
for k, v in new_ids.iteritems():
if k != show_obj.indexer and k in [INDEXER_TVDB, INDEXER_TVRAGE, INDEXER_IMDB] and 0 < v \
and k not in url_trakt:
new_url_trakt[k] = v
if 0 < len(new_url_trakt):
new_ids.update(get_trakt_ids(new_url_trakt))
new_ids = check_missing_trakt_id(new_ids, show_obj, url_trakt)
if INDEXER_IMDB not in new_ids:
new_ids.update(get_imdbid_by_name(show_obj.name, show_obj.startyear))
new_ids = check_missing_trakt_id(new_ids, show_obj, url_trakt)
if INDEXER_TMDB in mis_map \
and (None is new_ids.get(INDEXER_TMDB) or MapStatus.NOT_FOUND == new_ids.get(INDEXER_TMDB)) \

View file

@ -41,7 +41,7 @@ indexerConfig = {
icon='tvrage16.png',
),
INDEXER_TVMAZE: dict(
main_url='http://www.tvmaze.com/',
main_url='https://www.tvmaze.com/',
id=INDEXER_TVMAZE,
name='TVmaze',
module=None,
@ -109,7 +109,7 @@ indexerConfig[info_src].update(dict(
info_src = INDEXER_TVMAZE
indexerConfig[info_src].update(dict(
base_url='http://api.tvmaze.com/',
base_url='https://api.tvmaze.com/',
show_url='%sshows/' % indexerConfig[info_src]['main_url'],
finder='%ssearch?q=%s' % (indexerConfig[info_src]['main_url'], '%s'),
))