upsies.utils.webdbs.common
Classes and functions that are used by all WebDbApiBase
subclasses
Classes
- class upsies.utils.webdbs.common.Person(name, *, url='', role='')[source]
Bases:
strstrsubclass with an url attributeThe optional role should only be used for actors and be the name of the character they portray.
- class upsies.utils.webdbs.common.Query(title='', **kwargs)[source]
Bases:
objectSearch query for databases like IMDb
- Parameters:
- Raises:
ValueError – if an invalid argument is passed
- property type
ReleaseTypevalue
- property title
Name of the movie or TV series
- property year
Year of release
- property id
Known ID for a specific DB
- property feeling_lucky
Whether an only search result should be autoselected
- copy(**updates)[source]
Return new
Queryinstance with updated attributes- Parameters:
updates – Updated attributes
- classmethod from_string(query)[source]
Create instance from string
The returned
Queryis case-insensitive and has any superfluous whitespace removed.Keyword arguments are extracted by looking for
"year:YEAR","type:TYPE"and"id:ID"in query whereYEARis a four-digit number,TYPEis something like “movie”, “film”, “tv”, etc andIDis a known ID for the DB this query is meant for.
- classmethod from_release(info)[source]
Create instance from
ReleaseInfoorReleaseNameinstance
- classmethod from_path(path)[source]
Create instance from file or directory name
path is passed to
ReleaseInfoto get the arguments for instantiation.
- class upsies.utils.webdbs.common.SearchResult(*, id, type, url, year, cast=(), countries=(), directors='', genres=(), poster=None, summary='', title, title_english='', title_original='')[source]
Bases:
objectInformation about a search result
Keyword arguments are available as attributes.
Normal attributes:
- Parameters:
These attributes are coroutine functions that return the value when called with no arguments:
- Parameters:
cast (sequence of
str) – Short list of actor namescountries (str) – List of country names of origin
genres (sequence of
str) – Short sequence of genres, e.g. [“horror”, “comedy”]directors (sequence of
str) – Sequence of directorssummary – Short text that describes the movie or series
title_english (str) – English title of the movie or series
title_original (str) – Original title of the movie or series
The values of coroutine functions can be supplied via a coroutine function or as a plain object (
str,list, etc).