mirror of
https://github.com/SickGear/SickGear.git
synced 2024-12-11 21:53:37 +00:00
Merge pull request #863 from JackDandy/feature/ChangeImproveMapper
Change improve indexermapper.
This commit is contained in:
commit
5f05cf62f0
2 changed files with 19 additions and 11 deletions
|
@ -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' \
|
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:
|
and 'year' in r.data and r.data['year'] == startyear:
|
||||||
ids[INDEXER_IMDB] = tryInt(r.movieID)
|
ids[INDEXER_IMDB] = tryInt(r.movieID)
|
||||||
|
break
|
||||||
except (StandardError, Exception):
|
except (StandardError, Exception):
|
||||||
pass
|
pass
|
||||||
return {k: v for k, v in ids.iteritems() if v not in (None, '', 0)}
|
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):
|
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)}
|
or k not in new_ids or new_ids.get(k) in (None, 0, '', MapStatus.NOT_FOUND)}
|
||||||
new_ids.update(tvids)
|
new_ids.update(tvids)
|
||||||
|
|
||||||
if INDEXER_TRAKT not in new_ids:
|
new_ids = check_missing_trakt_id(new_ids, show_obj, url_trakt)
|
||||||
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))
|
|
||||||
|
|
||||||
if INDEXER_IMDB not in new_ids:
|
if INDEXER_IMDB not in new_ids:
|
||||||
new_ids.update(get_imdbid_by_name(show_obj.name, show_obj.startyear))
|
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 \
|
if INDEXER_TMDB in mis_map \
|
||||||
and (None is new_ids.get(INDEXER_TMDB) or MapStatus.NOT_FOUND == new_ids.get(INDEXER_TMDB)) \
|
and (None is new_ids.get(INDEXER_TMDB) or MapStatus.NOT_FOUND == new_ids.get(INDEXER_TMDB)) \
|
||||||
|
|
|
@ -41,7 +41,7 @@ indexerConfig = {
|
||||||
icon='tvrage16.png',
|
icon='tvrage16.png',
|
||||||
),
|
),
|
||||||
INDEXER_TVMAZE: dict(
|
INDEXER_TVMAZE: dict(
|
||||||
main_url='http://www.tvmaze.com/',
|
main_url='https://www.tvmaze.com/',
|
||||||
id=INDEXER_TVMAZE,
|
id=INDEXER_TVMAZE,
|
||||||
name='TVmaze',
|
name='TVmaze',
|
||||||
module=None,
|
module=None,
|
||||||
|
@ -109,7 +109,7 @@ indexerConfig[info_src].update(dict(
|
||||||
|
|
||||||
info_src = INDEXER_TVMAZE
|
info_src = INDEXER_TVMAZE
|
||||||
indexerConfig[info_src].update(dict(
|
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'],
|
show_url='%sshows/' % indexerConfig[info_src]['main_url'],
|
||||||
finder='%ssearch?q=%s' % (indexerConfig[info_src]['main_url'], '%s'),
|
finder='%ssearch?q=%s' % (indexerConfig[info_src]['main_url'], '%s'),
|
||||||
))
|
))
|
||||||
|
|
Loading…
Reference in a new issue