def person_from_tmdb_id(cls, tmdb_id): """Return a Person object with the specified tmdb_id. As a side effect, create the Person in the database and fill in their name from themoviedb if they don't already exist in the database.""" person, created = cls.objects.get_or_create(tmdb_id=tmdb_id) # if the Person is already in the db, we won't change it at all, the assumption # being that all Persons will be added with this method so info will always correct. if created: result = tmdb_person.getPersonInfo(tmdb_id) person.name = result['name'] person.save() return person
def get_person_thumbnail(tmdb_id): person = tmdb_person.getPersonInfo(tmdb_id) if "thumbnail" in person: return person["thumbnail"]