本文整理汇总了Python中pytvdbapi.api.TVDB类的典型用法代码示例。如果您正苦于以下问题:Python TVDB类的具体用法?Python TVDB怎么用?Python TVDB使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了TVDB类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_iterate_search
def test_iterate_search(self):
"""It should be possible to iterate over a search result"""
api = TVDB("B43FF87DE395DF56")
search = api.search("house", "en")
for s in search:
self.assertEqual(type(s), pytvdbapi.api.Show)
示例2: test_get
def test_get(self):
"""Provided the show id, you should be able to get the show object"""
api = TVDB("B43FF87DE395DF56")
show = api.get(79349, "en")
self.assertEqual(show.SeriesName, "Dexter")
self.assertEqual(show.id, 79349)
示例3: test_default_order
def test_default_order(self):
"""It should be possible to get an episode using the default sort order"""
api = TVDB("B43FF87DE395DF56")
ep = api.get_episode(0, "en", "default", True, seriesid=79349, seasonnumber=2, episodenumber=5)
self.assertEqual(ep.absolute_number, 17)
示例4: test_episode_id_kwarg
def test_episode_id_kwarg(self):
"""It should be possible to load the episode passing the episode id as a kwarg"""
api = TVDB("B43FF87DE395DF56")
ep = api.get_episode(0, "en", "id", True, episodeid=308834)
self.assertEqual(ep.id, 308834)
self.assertEqual(ep.EpisodeName, 'Crocodile')
示例5: test_missing_id
def test_missing_id(self):
"""It should be possible to call get_episode without passing id as positional argument"""
api = TVDB("B43FF87DE395DF56")
ep = api.get_episode("en", "id", True, episodeid=308834)
self.assertEqual(ep.id, 308834)
self.assertEqual(ep.EpisodeName, 'Crocodile')
示例6: test_valid_show
def test_valid_show(self):
"""Given correct values, the function should return a valid Episode instance"""
api = TVDB("B43FF87DE395DF56")
# Second episode of dexter
ep = api.get_episode_by_air_date(79349, 'en', datetime.date(2006, 10, 8))
self.assertEqual(ep.id, 308834)
self.assertEqual(ep.EpisodeName, 'Crocodile')
示例7: test_zap2it_id
def test_zap2it_id(self):
"""It should be possible to load the show using the zap2it id"""
api = TVDB("B43FF87DE395DF56")
show = api.get_series('EP00859795', 'en', 'zap2it')
self.assertEqual(show.seriesid, 79349) # Dexter
show = api.get_series(859795, 'en', 'zap2it')
self.assertEqual(show.seriesid, 79349) # Dexter
示例8: test_imdb_id
def test_imdb_id(self):
"""It should be possible to use the imdb id to get the series"""
api = TVDB("B43FF87DE395DF56")
show = api.get_series(773262, 'en', 'imdb')
self.assertEqual(show.seriesid, 79349) # Dexter
show = api.get_series('tt0773262', 'en', 'imdb')
self.assertEqual(show.seriesid, 79349) # Dexter
示例9: test_get_series
def test_get_series(self):
"""
It should be possible to use the get_series alias to get a show
given the right show id.
"""
api = TVDB("B43FF87DE395DF56")
show = api.get_series(79349, "en")
self.assertEqual(show.SeriesName, "Dexter")
self.assertEqual(show.id, 79349)
示例10: test_get_episode
def test_get_episode(self):
"""
Provided the episode id, you should be able to
get episode instance.
"""
api = TVDB("B43FF87DE395DF56")
ep = api.get_episode(308834, "en")
self.assertEqual(ep.id, 308834)
self.assertEqual(ep.EpisodeName, 'Crocodile')
示例11: test_get_actors
def test_get_actors(self):
"""
The Show instance should have an actor_objects attribute when the
actor data is loaded.
"""
api = TVDB("B43FF87DE395DF56", actors=True)
show = api.get(79349, "en") # Load the series Dexter
show.update()
self.assertEqual(hasattr(show, "actor_objects"), True)
示例12: test_force_language
def test_force_language(self):
"""
It should be possible to use the "force_lang" keyword when
creating the TVDB instance
"""
api = TVDB("B43FF87DE395DF56", force_lang=True)
search = api.search("dexter", "it")
self.assertEqual(len(search), 2)
示例13: test_no_actors
def test_no_actors(self):
"""
The Show instance should have an empty actor_objects when the
actor data has not been loaded.
"""
api = TVDB("B43FF87DE395DF56", actors=False)
show = api.get(79349, "en") # Load the series Dexter
show.update()
self.assertEqual(len(show.actor_objects), 0)
示例14: test_iterable_actors
def test_iterable_actors(self):
"""
It should be possible to iterate over the actor objects
"""
api = TVDB("B43FF87DE395DF56", actors=True)
show = api.get(79349, "en") # Load the series Dexter
show.update()
for actor in show.actor_objects:
self.assertEqual(type(actor), Actor)
示例15: test_invalid_search_index
def test_invalid_search_index(self):
"""Search should raise TVDBIndexError when trying to access an
invalid index
"""
api = TVDB("B43FF87DE395DF56")
search = api.search("dexter", "en")
self.assertRaises(error.TVDBIndexError, search.__getitem__, 2)
self.assertRaises(error.TVDBIndexError, search.__getitem__, 5)
self.assertRaises(error.TVDBIndexError, search.__getitem__, 100)
self.assertRaises(error.TVDBIndexError, search.__getitem__, "foo")