Example #1
0
 def __init__(self, data=None, thetvdb_id=None, thetvdb=None, extras=''):
     if thetvdb is None:
         thetvdb = globalTheTVDB()
     
     if data is None:
         if thetvdb_id is None:
             raise ValueError('data or thetvdb_id must not be None')
         
         try:
             data = thetvdb.lookup(thetvdb_id)
         except KeyError:
             raise ValueError('bad thetvdb_id')
         except Exception:
             logs.warning('ERROR looking up TheTVDB ID: %s\n\n%s\n\n' %
                          (thetvdb_id, traceback.format_exc()))
             raise
     elif thetvdb_id is not None:
         if thetvdb_id != data.sources.thetvdb_id:
             raise ValueError('thetvdb_id does not match data["key"]')
     
     self.__thetvdb = thetvdb
     self.__data    = data
Example #2
0
 def __thetvdb(self):
     return globalTheTVDB()