This module contains the classes regarding movies.
Every movie has a title which must be specified on initialization. The title may not be empty and may not consist only of whitespace. Other information about a movie includes its year, directors and cast.
It is possible -and recommended- to store the IMDb ids of movies. The IMDb id is a 7-digit string and it will be used as the primary value to identify a movie. Two movies are considered equal if they have the same IMDb id, regardless of their other data:
>>> m1 = Movie(u"The Matrix Reloaded", imdb_id=u'0234215')
>>> m2 = Movie(u"The Matrix 2", imdb_id=u'0234215')
>>> m1 == m2
True
If they have no IMDb ids, their titles will be checked. A comparison between a movie and a title is also valid:
>>> m = Movie(u"The Matrix")
>>> m == u"The Matrix"
True
For every movie, there is also a sortable title which is used for comparing titles. In sortable titles, articles like “The”, “An” will not be considered. This is also the default when comparing two movies:
>>> m1 = Movie(u"The Matrix")
>>> m2 = Movie(u"Suspiria")
>>> m1 < m2
True
If two movies have the same sortable title, the older movie comes first:
>>> m1 = Movie(u"The Shining", year=1980)
>>> m2 = Movie(u"The Shining", year=1997)
>>> m1 < m2
True
Movies can have more than one title and they can have different titles in different countries and languages. An AKA (also known as) represents another title for a movie.
An AKA must be initialized with a title text and can be checked for equality against a title:
>>> a = AKA(u"Deep Red")
>>> a == u"Deep Red"
True
When another title for a movie is obtained from IMDb, it is checked to see whether it is for a country for which titles will be accepted. These countries are kept in Movie.AKA_COUNTRIES. The following helper functions can be used for getting the title and notes from an a.k.a. string as provided by IMDb:
A movie.
Add another title to the movie.
The new title will not be added if it is empty, same as the main title, already present in the list of other titles, or local to a country which has not been selected.
| Parameter: | aka (unicode | humphrey.core.movie.AKA) – New title to add to the movie. |
|---|
Add a cast member to the movie.
| Parameter: | person (humphrey.core.person.CastMember | humphrey.core.person.Person) – Person to add as cast member. |
|---|
Add a director to the movie.
| Parameter: | person (humphrey.core.person.Director | humphrey.core.person.Person) – Person to add as director. |
|---|
Remove a title from the other titles of a movie.
| Parameter: | aka (unicode | humphrey.core.movie.AKA) – Title to remove. |
|---|
Remove a person from the cast members of a movie.
| Parameter: | person (humphrey.core.person.CastMember | humphrey.core.person.Person | unicode) – Person to remove. |
|---|
Remove a person from the directors list of a movie.
| Parameter: | person (humphrey.core.person.Director | humphrey.core.person.Person | unicode) – Person to remove. |
|---|
Set the other titles of the movie.
| Parameter: | akas (list of { unicode | humphrey.core.movie.AKA }) – New list of titles to set. |
|---|
Set the cast members of the movie.
| Parameter: | cast (list of { humphrey.core.person.CastMember | humphrey.core.person.Person }) – New list of cast members to set. |
|---|
Set the directors of the movie.
| Parameter: | directors (list of { humphrey.core.person.Director | humphrey.core.person.Person }) – New list of directors to set. |
|---|
Set the IMDb id of the movie.
| 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 runtime of the movie.
| Parameter: | runtime (int) – New runtime value to set. If 0, it will be regarded as unspecified. |
|---|
Set the sortable title of the movie.
| Parameters: |
|
|---|
Set the title of the movie.
| Parameter: | title (unicode) – New title value to set. It will be stripped of leading and trailing whitespace. If empty, it will be regarded as unspecified. |
|---|---|
| Raises ValueError: | |
| If title is not specified. | |
Set the year of the movie.
| Parameter: | year (int) – New year value to set. If 0, it will be regarded as unspecified. |
|---|
A different title for a movie.
Set the title.
| Parameter: | title (unicode) – New title value to set. It will be stripped of leading and trailing whitespace. If empty, it will be regarded as unspecified. |
|---|---|
| Raises ValueError: | |
| If title is not specified. | |