This module contains the classes regarding persons involved in the production of movies, such as directors and cast members.
Every person has a name which must be specified on initialization. The name may not be empty and may not consist only of whitespace.
It is possible -and recommended- to store the IMDb ids of persons. The IMDb id is a 7-digit string and it will be used as the primary value to identify a person. Two persons are considered the same if they have the same IMDb id, regardless of their names:
>>> p1 = Person(u"Farrah Fawcett", imdb_id=u'0000396')
>>> p2 = Person(u"Farrah Fawcett-Majors", imdb_id=u'0000396')
>>> p1 == p2
True
If they have no IMDb ids, their names will be checked. A comparison between a person and a name is also valid:
>>> p = Person(u"Marlon Brando")
>>> p == u"Marlon Brando"
True
Persons can take on directing and acting roles in movies. These roles are represented by classes which wrap person objects. The Director class is for directing roles and the CastMember class is for acting roles.
A role object contains Role.movie and Role.person attributes to provide the connection between the movie and the person. There is also a Role.position attribute which is used for ordering the list of persons having that role.
Role objects must be initialized with the person object they will wrap and can be checked for equality against the person they wrap:
>>> p = Person(u"Marlon Brando")
>>> c = CastMember(p)
>>> c == p
True
The movies in which a person is a director or a cast member can be accessed via the Person.directed and Person.acted attributes, respectively. Both these attributes are lists of CastMember objects:
for role in person.acted:
print role.movie.title
print role.position
Base class for persons in movies.
Set the IMDb id of the person.
| Parameter: | imdb_id (unicode | str | int | long) – New IMDb id value to set. If a number or a string, it will be converted to unicode. |
|---|---|
| Raises ValueError: | |
| If the IMDb id is invalid. | |
Set the name of the person.
| Parameter: | name (unicode) – New name value to set. It will be stripped of leading and trailing whitespace. If empty, it will be regarded as unspecified. |
|---|---|
| Raises ValueError: | |
| If the name of the person is not specified. | |
A director or cast member of a movie.
| Parameter: | person (humphrey.core.person.Person) – Person playing this role. |
|---|
Bases: humphrey.core.person.Role
A director of a movie.
| Parameter: | person (humphrey.core.person.Person) – Person playing this role. |
|---|
Bases: humphrey.core.person.Role
An actor or an actress in a movie.
| Parameter: | person (humphrey.core.person.Person) – Person playing this role. |
|---|