Lists: Fix for broken person search

pull/105/head
desimaniac 5 years ago
parent 00c78f6c37
commit 56fbb780c9

@ -50,8 +50,8 @@
- [Show (Single Show)](#show-single-show) - [Show (Single Show)](#show-single-show)
- [Shows (Multiple Shows)](#shows-multiple-shows) - [Shows (Multiple Shows)](#shows-multiple-shows)
- [Examples (CLI)](#examples-cli) - [Examples (CLI)](#examples-cli)
- [Movies](#movies) - [Movies](#movies-1)
- [Shows](#shows) - [Shows](#shows-1)
- [Donate](#donate) - [Donate](#donate)
<!-- /TOC --> <!-- /TOC -->

@ -122,7 +122,9 @@ class Trakt:
log.debug("Response Page: %d of %d", current_page, total_pages) log.debug("Response Page: %d of %d", current_page, total_pages)
if req.status_code == 200 and len(resp_data): if req.status_code == 200 and len(resp_data):
if resp_data.startswith("[{") and resp_data.endswith("}]"): if (resp_data.startswith("[{") and resp_data.endswith("}]")) or \
(resp_data.startswith("{") and resp_data.endswith("}")):
resp_json = json.loads(resp_data) resp_json = json.loads(resp_data)
if type_name == 'person' and 'cast' in resp_json: if type_name == 'person' and 'cast' in resp_json:
@ -415,7 +417,7 @@ class Trakt:
@cache(cache_file=cachefile, retry_if_blank=True) @cache(cache_file=cachefile, retry_if_blank=True)
def get_person_shows(self, person, limit=1000, languages=None, genres=None): def get_person_shows(self, person, limit=1000, languages=None, genres=None):
return self._make_items_request( return self._make_items_request(
url='https://api.trakt.tv/people/%s/shows' % person, url='https://api.trakt.tv/people/%s/shows' % person.replace(' ', '-').lower(),
limit=limit, limit=limit,
languages=languages, languages=languages,
object_name='shows', object_name='shows',
@ -527,7 +529,7 @@ class Trakt:
@cache(cache_file=cachefile, retry_if_blank=True) @cache(cache_file=cachefile, retry_if_blank=True)
def get_person_movies(self, person, limit=1000, languages=None, genres=None): def get_person_movies(self, person, limit=1000, languages=None, genres=None):
return self._make_items_request( return self._make_items_request(
url='https://api.trakt.tv/people/%s/movies' % person, url='https://api.trakt.tv/people/%s/movies' % person.replace(' ', '-').lower(),
limit=limit, limit=limit,
languages=languages, languages=languages,
object_name='movies', object_name='movies',

Loading…
Cancel
Save