Example #1
0
    def testTVSearch(self):
        id = 1396
        name = 'UFC'
        tmdb = TMDB(TMDB_API_KEY)

        # get TMDB configuration info
        config = tmdb.Configuration()
        response = config.info()
        base_url = response['images']['base_url']
        sizes = response['images']['poster_sizes']

        def size_str_to_int(x):
            return float("inf") if x == 'original' else int(x[1:])

        max_size = max(sizes, key=size_str_to_int)

        # get show ID on TMDB
        search = tmdb.Search()
        response = search.collection({'query': name})
        for result in response['results']:
            id = result['id']

        # get show images
        collection = tmdb.Collections(id)
        response = collection.images()
        rel_path = response['posters'][0]['file_path']
        url = "{0}{1}{2}".format(base_url, max_size, rel_path)
        self.assertTrue(hasattr(response, name))
Example #2
0
 def testTVExternalIds(self):
     id = 1396
     imdb_id = 'tt0903747'
     tmdb = TMDB(TMDB_API_KEY)
     tv = tmdb.TV(id)
     response = tv.external_ids()
     self.assertEqual(tv.imdb_id, imdb_id)
Example #3
0
 def testTVSeasonsImages(self):
     id = 3572
     season_number = 1
     tmdb = TMDB(TMDB_API_KEY)
     tv_seasons = tmdb.TV_Seasons(id, season_number)
     response = tv_seasons.images()
     self.assertTrue(hasattr(tv_seasons, 'posters'))
Example #4
0
 def testTVSeasonsCredits(self):
     id = 3572
     season_number = 1
     tmdb = TMDB(TMDB_API_KEY)
     tv_seasons = tmdb.TV_Seasons(id, season_number)
     response = tv_seasons.credits()
     self.assertTrue(hasattr(tv_seasons, 'crew'))
Example #5
0
 def testTVInfo(self):
     id = 1396
     name = 'UFC'
     tmdb = TMDB(TMDB_API_KEY)
     find = tmdb.Find(23281)
     response = find.info({'external_source': 'tvrage_id'})
     self.assertTrue(hasattr(response, name))
Example #6
0
 def testTVEpisodesCredits(self):
     id = 1396
     season_number = 1
     episode_number = 1
     tmdb = TMDB(TMDB_API_KEY)
     tv_episodes = tmdb.TV_Episodes(id, season_number, episode_number)
     response = tv_episodes.credits()
     self.assertTrue(hasattr(tv_episodes, 'guest_stars'))
Example #7
0
 def testTVSeasonsExternalIds(self):
     id = 3572
     season_number = 1
     tvdb_id = 2547
     tmdb = TMDB(TMDB_API_KEY)
     tv_seasons = tmdb.TV_Seasons(id, season_number)
     response = tv_seasons.external_ids()
     self.assertEqual(tv_seasons.tvdb_id, tvdb_id)
Example #8
0
 def testTVSeasonsInfo(self):
     id = 3572
     season_number = 1
     name = 'Season 1'
     tmdb = TMDB(TMDB_API_KEY)
     tv_seasons = tmdb.TV_Seasons(id, season_number)
     response = tv_seasons.info()
     self.assertEqual(tv_seasons.name, name)
Example #9
0
 def testTVEpisodesImages(self):
     id = 1396
     season_number = 1
     episode_number = 1
     tmdb = TMDB(TMDB_API_KEY)
     tv_episodes = tmdb.TV_Episodes(id, season_number, episode_number)
     response = tv_episodes.images()
     self.assertTrue(hasattr(tv_episodes, 'stills'))
Example #10
0
 def testTVEpisodesInfo(self):
     id = 1396
     season_number = 1
     episode_number = 1
     name = 'Pilot'
     tmdb = TMDB(TMDB_API_KEY)
     tv_episodes = tmdb.TV_Episodes(id, season_number, episode_number)
     response = tv_episodes.info()
     self.assertEqual(tv_episodes.name, name)
Example #11
0
 def testTVEpisodesExternalIds(self):
     id = 1396
     season_number = 1
     episode_number = 1
     imdb_id = 'tt0959621'
     tmdb = TMDB(TMDB_API_KEY)
     tv_episodes = tmdb.TV_Episodes(id, season_number, episode_number)
     response = tv_episodes.external_ids()
     self.assertEqual(tv_episodes.imdb_id, imdb_id)
Example #12
0
 def testTVPopular(self):
     tmdb = TMDB(TMDB_API_KEY)
     tv = tmdb.TV()
     response = tv.popular()
     self.assertTrue(hasattr(tv, 'results'))
Example #13
0
 def testTVTopRated(self):
     tmdb = TMDB(TMDB_API_KEY)
     tv = tmdb.TV()
     response = tv.top_rated()
     self.assertTrue(hasattr(tv, 'results'))
Example #14
0
 def testTVTranslations(self):
     id = 1396
     tmdb = TMDB(TMDB_API_KEY)
     tv = tmdb.TV(id)
     response = tv.translations()
     self.assertTrue(hasattr(tv, 'translations'))
Example #15
0
 def testTVImages(self):
     id = 1396
     tmdb = TMDB(TMDB_API_KEY)
     tv = tmdb.TV(id)
     response = tv.images()
     self.assertTrue(hasattr(tv, 'backdrops'))
Example #16
0
 def testTVCredits(self):
     id = 1396
     tmdb = TMDB(TMDB_API_KEY)
     tv = tmdb.TV(id)
     response = tv.credits()
     self.assertTrue(hasattr(tv, 'cast'))
Example #17
0
 def testTVInfo(self):
     name = u'Game of Thrones'
     tmdb = TMDB(TMDB_API_KEY)
     find = tmdb.Find(121361)
     response = find.info({'external_source': 'tvdb_id'})
     self.assertEqual(response['tv_results'][0]['name'], name)