def get_imdbCharacterID(self, characterID): """Translate a characterID in an imdbID. Try an Exact Primary Name search on IMDb; return None if it's unable to get the imdbID. """ name = getCharacterName(characterID, '%scharacters.index' % self.__db, '%scharacters.data' % self.__db) if not name: return None return self.character2imdbID(name)
def get_character_main(self, characterID, results=1000): infosets = self.get_character_infoset() name = getCharacterName(characterID, '%scharacters.index' % self.__db, '%scharacters.data' % self.__db) if not name: raise IMDbDataAccessError, \ 'unable to get characterID "%s"' % characterID res = analyze_name(name, canonical=1) filmography = getCharacterFilmography(characterID, '%scharacters.index' % self.__db, '%scharacters.data' % self.__db, '%stitles.index' % self.__db, '%stitles.key' % self.__db, '%snames.index' % self.__db, '%snames.key' % self.__db, limit=results) if filmography: filmography = merge_roles(filmography) filmography.sort() res['filmography'] = filmography return {'data': res, 'info sets': infosets}