Beispiel #1
0
    def __getitem__(self, key):
        if key in self:
            # Key is an episode, return it
            return dict.__getitem__(self, key)

        if key in self.data:
            # Non-numeric request is for season-data
            return dict.__getitem__(self.data, key)

        if isinstance(key, int) or key.isdigit():
            raise tvdb_episodenotfound("Could not find episode {}".format(repr(key)))
        else:
            raise tvdb_attributenotfound("Cannot find season attribute {}".format(repr(key)))
Beispiel #2
0
    def __getitem__(self, key):
        if key in self:
            # Key is an episode, return it
            return dict.__getitem__(self, key)

        if key in self.data:
            # Non-numeric request is for season-data
            return dict.__getitem__(self.data, key)

        if isinstance(key, int) or key.isdigit():
            raise tvdb_episodenotfound("Could not find episode {}".format(repr(key)))
        else:
            raise tvdb_attributenotfound("Cannot find season attribute {}".format(repr(key)))
Beispiel #3
0
    def __getitem__(self, key):
        if key in self:
            # Key is an episode, return it
            return dict.__getitem__(self, key)

        if key in self.data:
            # Non-numeric request is for show-data
            return dict.__getitem__(self.data, key)

        # Data wasn't found, raise appropriate error
        if isinstance(key, int) or key.isdigit():
            # Season number x was not found
            raise tvdb_seasonnotfound("Could not find season {}".format(repr(key)))
        else:
            # If it's not numeric, it must be an attribute name, which
            # doesn't exist, so attribute error.
            raise tvdb_attributenotfound("Cannot find show attribute {}".format(repr(key)))
Beispiel #4
0
    def __getitem__(self, key):
        if key in self:
            # Key is an episode, return it
            return dict.__getitem__(self, key)

        if key in self.data:
            # Non-numeric request is for show-data
            return dict.__getitem__(self.data, key)

        # Data wasn't found, raise appropriate error
        if isinstance(key, int) or key.isdigit():
            # Season number x was not found
            raise tvdb_seasonnotfound("Could not find season {}".format(repr(key)))
        else:
            # If it's not numeric, it must be an attribute name, which
            # doesn't exist, so attribute error.
            raise tvdb_attributenotfound("Cannot find show attribute {}".format(repr(key)))
Beispiel #5
0
 def __getitem__(self, key):
     try:
         return dict.__getitem__(self, key)
     except KeyError:
         raise tvdb_attributenotfound("Cannot find episode attribute {}".format(repr(key)))
Beispiel #6
0
 def __getitem__(self, key):
     try:
         return dict.__getitem__(self, key)
     except KeyError:
         raise tvdb_attributenotfound("Cannot find episode attribute {}".format(repr(key)))