MCPcopy Create free account
hub / github.com/dbr/tvdb_api / Season

Class Season

tvdb_api.py:415–446  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

413
414
415class Season(dict):
416 def __init__(self, show=None):
417 """The show attribute points to the parent show
418 """
419 self.show = show
420
421 def __repr__(self):
422 return "<Season instance (containing %s episodes)>" % (len(self.keys()))
423
424 def __getitem__(self, episode_number):
425 if episode_number not in self:
426 raise tvdb_episodenotfound("Could not find episode %s" % (repr(episode_number)))
427 else:
428 return dict.__getitem__(self, episode_number)
429
430 def search(self, term=None, key=None):
431 """Search all episodes in season, returns a list of matching Episode
432 instances.
433
434 >>> t = Tvdb()
435 >>> t['scrubs'][1].search('first day')
436 [<Episode 01x01 - u'My First Day'>]
437 >>>
438
439 See Show.search documentation for further information on search
440 """
441 results = []
442 for ep in self.values():
443 searchresult = ep.search(term=term, key=key)
444 if searchresult is not None:
445 results.append(searchresult)
446 return results
447
448
449class Episode(dict):

Callers 1

_setItemMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected