diff --git a/CHANGES.md b/CHANGES.md index 6577cc4d..e6d8e7aa 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -24,6 +24,11 @@ * Fix media process being ignored by Plex extras +### 3.30.7 (2024-01-10 14:20:00 UTC) + +* Fix limit loaded cast (max 30) and crew (max 5) from TVmaze API + + ### 3.30.6 (2024-01-02 11:05:00 UTC) * Fix Shows IMDb cards to new layout at IMDb diff --git a/lib/pytvmaze/tvmaze.py b/lib/pytvmaze/tvmaze.py index 9e87db48..3e4d46dc 100644 --- a/lib/pytvmaze/tvmaze.py +++ b/lib/pytvmaze/tvmaze.py @@ -403,11 +403,12 @@ class Cast(object): self.populate(data) def populate(self, data): - for cast_member in data: - self.people.append(Person(cast_member['person'])) - self.characters.append(Character(cast_member['character'], cast_member)) - self.people[-1].character = self.characters[-1] # add reference to character - self.characters[-1].person = self.people[-1] # add reference to cast member + if isinstance(data, list): + for cast_member in data[:30]: + self.people.append(Person(cast_member['person'])) + self.characters.append(Character(cast_member['character'], cast_member)) + self.people[-1].character = self.characters[-1] # add reference to character + self.characters[-1].person = self.people[-1] # add reference to cast member def __repr__(self): return self.__str__() @@ -1434,7 +1435,7 @@ def get_show_crew(maze_id, raise_error=True): url = endpoints.show_crew.format(maze_id) q = TVmaze.endpoint_standard_get(url) if q: - return [Crew(crew) for crew in q] + return [Crew(crew) for crew in (isinstance(q, list) and q[:5]) or []] elif raise_error: raise CrewNotFound(f'Couldn\'t find crew for TVmaze ID {maze_id}') return []