core.media#

Manages media files and their associated metadata, supporting storage, nested media retrieval, and type validation.

Module Contents#

class core.media.Media#

Represents a media file with associated properties and storage details.

Attributes: - filename: The file path of the media. - key: An optional identifier for the media. - urls: A list of URLs where the media is stored or accessible. - properties: Additional metadata or transformations for the media. - _mimetype: The media’s mimetype (e.g., image/jpeg, video/mp4).

filename: str#
key: str = None#
urls: List[str] = []#
properties: dict#
store(metadata: Any, url: str = 'url-not-available', storages: List[Any] = None) None#
all_inner_media(include_self=False)#

Retrieves all media, including nested media within properties or transformations on original media. This function returns a generator for all the inner media.

is_stored(in_storage) bool#
set(key: str, value: Any) Media#
get(key: str, default: Any = None) Any#
add_url(url: str) None#
property mimetype: str#
is_video() bool#
is_audio() bool#
is_image() bool#
is_valid_video() bool#