Media

Media Models

SQLAlchemy ORM definitions for:

  • Media: metadata for a collection of one or more files.
  • MediaFile: a single audio or video file.

Additionally, Media may be considered at podcast episode if it belongs to a mediadrop.model.podcasts.Podcast.

Mapped Classes

class mediadrop.model.media.Media

Media metadata and a collection of related files.

categories

A list of mediadrop.model.categories.Category.

comments

A query pre-filtered for associated comments. Returns mediadrop.model.comments.CommentQuery.

created_on

The date and time this player was first created.

description

A public-facing XHTML description. Should be a paragraph or more.

description_plain

A public-facing plaintext description. Should be a paragraph or more.

dislikes

The number of users who clicked ‘i DONT like this’.

duration

Play time in seconds.

encoded

A flag to indicate whether this file is encoded in a web-ready state.

files

A list of MediaFile instances.

id

The primary key ID.

increment_views()

Increment the number of views in the database.

We avoid concurrency issues by incrementing JUST the views and not allowing modified_on to be updated automatically.

likes

The number of users who clicked ‘i like this’.

modified_on

The date and time this player was last modified.

notes

Notes for administrative use – never displayed publicly.

podcast_id

The primary key of a podcast to publish this media under.

popularity_dislikes

An integer score of how ‘hot’ disliking this media is.

Newer items with some likes are favoured over older items with more likes. In other words, ordering on this column will always bring the newest most liked items to the top. More info.

popularity_likes

An integer score of how ‘hot’ liking this media is.

Newer items with some likes are favoured over older items with more likes. In other words, ordering on this column will always bring the newest most liked items to the top. More info.

popularity_points

An integer score of how ‘hot’ (likes - dislikes) this media is.

Newer items with some likes are favoured over older items with more likes. In other words, ordering on this column will always bring the newest most liked items to the top. More info.

publish_on

A datetime range during which this object should be published. The range may be open ended by leaving publish_until empty.

publish_until

A datetime range during which this object should be published. The range may be open ended by leaving publish_until empty.

publishable

A flag to indicate if this media should be published in between its publish_on and publish_until dates. If this is false, this is considered to be in draft state and will not appear on the site.

reviewed

A flag to indicate whether this file has passed review by an admin.

set_categories(cats)

Set the related categories of this media.

Parameters:cats – A list of category IDs to set.
set_tags(tags)

Set the tags relations of this media, creating them as needed.

Parameters:tags – A list or comma separated string of tags to use.
slug

A unique URL-friendly permalink string for looking up this object.

Be sure to call mediadrop.model.get_available_slug() to ensure the slug is unique.

subtitle

An optional subtitle intended mostly for podcast episodes. If none is provided, the title is concatenated and used in its place.

tags

A list of mediadrop.model.tags.Tag.

title

Display title.

type

Indicates whether the media is to be considered audio or video.

If this object has no files, the type is None. See Media.update_type() for details on how this is determined.

update_status()

Ensure the type (audio/video) and encoded flag are properly set.

Call this after modifying any files belonging to this item.

views

The number of times the public media page has been viewed.

class mediadrop.model.media.MediaFile

Audio or Video File

get_uris()

Return a list all possible playback URIs for this file.

Return type:list
Returns:mediadrop.lib.storage.StorageURI instances.
mimetype

The best-guess mimetype based on this file’s container format.

Defaults to ‘application/octet-stream’.

Helpers

Er, none here. TODO: finish this page.

You're reading the documentation for MediaDrop 0.11dev (current git master). For the latest stable release please consult the documentation for MediaCore CE 0.10.

Table Of Contents

Current topic


Previous topic

Database Models


Next topic

Podcasts


This Page