Skip to content

Commit bdfa410

Browse files
celiaoclaude
andcommitted
Add aggregate_credits to TV and TV_Seasons; add translations and watch_providers to TV_Seasons
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent 46c9422 commit bdfa410

2 files changed

Lines changed: 100 additions & 0 deletions

File tree

tests/test_tv.py

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,13 @@ def test_tv_alternative_titles(self):
6666
tv.alternative_titles()
6767
self.assertTrue(hasattr(tv, 'results'))
6868

69+
def test_tv_aggregate_credits(self):
70+
id = TV_ID
71+
tv = tmdb.TV(id)
72+
response = tv.aggregate_credits()
73+
self.assertTrue(hasattr(tv, 'cast'))
74+
self.assertIsNotNone(response)
75+
6976
def test_tv_content_ratings(self):
7077
id = TV_ID
7178
tv = tmdb.TV(id)
@@ -222,13 +229,36 @@ def test_tv_seasons_images(self):
222229
tv_seasons.images()
223230
self.assertTrue(hasattr(tv_seasons, 'posters'))
224231

232+
def test_tv_seasons_aggregate_credits(self):
233+
series_id = TV_SEASON_ID
234+
season_number = TV_SEASON_NUMBER
235+
tv_seasons = tmdb.TV_Seasons(series_id, season_number)
236+
response = tv_seasons.aggregate_credits()
237+
self.assertTrue(hasattr(tv_seasons, 'cast'))
238+
self.assertIsNotNone(response)
239+
240+
def test_tv_seasons_translations(self):
241+
series_id = TV_SEASON_ID
242+
season_number = TV_SEASON_NUMBER
243+
tv_seasons = tmdb.TV_Seasons(series_id, season_number)
244+
response = tv_seasons.translations()
245+
self.assertTrue(hasattr(tv_seasons, 'translations'))
246+
self.assertIsNotNone(response)
247+
225248
def test_tv_seasons_videos(self):
226249
series_id = TV_SEASON_ID
227250
season_number = TV_SEASON_NUMBER
228251
tv_seasons = tmdb.TV_Seasons(series_id, season_number)
229252
tv_seasons.videos()
230253
self.assertTrue(hasattr(tv_seasons, 'results'))
231254

255+
def test_tv_seasons_watch_providers(self):
256+
series_id = TV_SEASON_ID
257+
season_number = TV_SEASON_NUMBER
258+
tv_seasons = tmdb.TV_Seasons(series_id, season_number)
259+
response = tv_seasons.watch_providers()
260+
self.assertIsNotNone(response)
261+
232262

233263
class TVEpisodesTestCase(unittest.TestCase):
234264
def test_tv_episodes_info(self):

tmdbsimple/tv.py

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ class TV(TMDB):
2727
'account_states': '/{id}/account_states',
2828
'alternative_titles': '/{id}/alternative_titles',
2929
'content_ratings': '/{id}/content_ratings',
30+
'aggregate_credits': '/{id}/aggregate_credits',
3031
'credits': '/{id}/credits',
3132
'episode_groups': '/{id}/episode_groups',
3233
'external_ids': '/{id}/external_ids',
@@ -126,6 +127,23 @@ def content_ratings(self, **kwargs):
126127
self._set_attrs_to_values(response)
127128
return response
128129

130+
def aggregate_credits(self, **kwargs):
131+
"""
132+
Get the aggregate credits (cast and crew) that have been added to a
133+
TV show.
134+
135+
Args:
136+
language: (optional) ISO 639 code.
137+
138+
Returns:
139+
A dict respresentation of the JSON returned from the API.
140+
"""
141+
path = self._get_id_path('aggregate_credits')
142+
143+
response = self._GET(path, kwargs)
144+
self._set_attrs_to_values(response)
145+
return response
146+
129147
def credits(self, **kwargs):
130148
"""
131149
Get the credits (cast and crew) that have been added to a TV show.
@@ -494,10 +512,13 @@ class TV_Seasons(TMDB):
494512
URLS = {
495513
'info': '',
496514
'account_states': '/account_states',
515+
'aggregate_credits': '/aggregate_credits',
497516
'credits': '/credits',
498517
'external_ids': '/external_ids',
499518
'images': '/images',
519+
'translations': '/translations',
500520
'videos': '/videos',
521+
'watch_providers': '/watch/providers',
501522
}
502523

503524
def __init__(self, tv_id, season_number):
@@ -544,6 +565,23 @@ def account_states(self, **kwargs):
544565
self._set_attrs_to_values(response)
545566
return response
546567

568+
def aggregate_credits(self, **kwargs):
569+
"""
570+
Get the aggregate credits (cast and crew) that have been added to a
571+
TV season.
572+
573+
Args:
574+
language: (optional) ISO 639 code.
575+
576+
Returns:
577+
A dict respresentation of the JSON returned from the API.
578+
"""
579+
path = self._get_tv_id_season_number_path('aggregate_credits')
580+
581+
response = self._GET(path, kwargs)
582+
self._set_attrs_to_values(response)
583+
return response
584+
547585
def credits(self, **kwargs):
548586
"""
549587
Get the credits for TV season.
@@ -603,6 +641,22 @@ def images(self, **kwargs):
603641
self._set_attrs_to_values(response)
604642
return response
605643

644+
def translations(self, **kwargs):
645+
"""
646+
Get the translations for a TV season.
647+
648+
Args:
649+
None
650+
651+
Returns:
652+
A dict respresentation of the JSON returned from the API.
653+
"""
654+
path = self._get_tv_id_season_number_path('translations')
655+
656+
response = self._GET(path, kwargs)
657+
self._set_attrs_to_values(response)
658+
return response
659+
606660
def videos(self, **kwargs):
607661
"""
608662
Get the videos that have been added to a TV season.
@@ -619,6 +673,22 @@ def videos(self, **kwargs):
619673
self._set_attrs_to_values(response)
620674
return response
621675

676+
def watch_providers(self, **kwargs):
677+
"""
678+
Get the list of streaming providers we have for a TV season.
679+
680+
Args:
681+
language: (optional) ISO 639 code.
682+
683+
Returns:
684+
A dict respresentation of the JSON returned from the API.
685+
"""
686+
path = self._get_tv_id_season_number_path('watch_providers')
687+
688+
response = self._GET(path, kwargs)
689+
self._set_attrs_to_values(response)
690+
return response
691+
622692

623693
class TV_Episodes(TMDB):
624694
"""

0 commit comments

Comments
 (0)