From 56fbb780c97249abf77cef3ba5214678c9b23fa5 Mon Sep 17 00:00:00 2001 From: desimaniac <5501908+desimaniac@users.noreply.github.com> Date: Tue, 24 Sep 2019 12:38:13 -0500 Subject: [PATCH] Lists: Fix for broken person search --- README.md | 4 ++-- media/trakt.py | 8 +++++--- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index ad5f4e8..5d6f065 100644 --- a/README.md +++ b/README.md @@ -50,8 +50,8 @@ - [Show (Single Show)](#show-single-show) - [Shows (Multiple Shows)](#shows-multiple-shows) - [Examples (CLI)](#examples-cli) - - [Movies](#movies) - - [Shows](#shows) + - [Movies](#movies-1) + - [Shows](#shows-1) - [Donate](#donate) diff --git a/media/trakt.py b/media/trakt.py index f8856fe..4a2dcbf 100644 --- a/media/trakt.py +++ b/media/trakt.py @@ -122,7 +122,9 @@ class Trakt: log.debug("Response Page: %d of %d", current_page, total_pages) 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) if type_name == 'person' and 'cast' in resp_json: @@ -415,7 +417,7 @@ class Trakt: @cache(cache_file=cachefile, retry_if_blank=True) def get_person_shows(self, person, limit=1000, languages=None, genres=None): 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, languages=languages, object_name='shows', @@ -527,7 +529,7 @@ class Trakt: @cache(cache_file=cachefile, retry_if_blank=True) def get_person_movies(self, person, limit=1000, languages=None, genres=None): 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, languages=languages, object_name='movies',