Models¶
Models.
-
class
MediaFile
(*args, **kwargs)¶ Model for media files.
-
class
Encoder
(*args, **kwargs)¶ Encoder model for tool like FFmpeg or ImageMagick.
-
class
EncodingProfile
(*args, **kwargs)¶ Job data for encoding a file.
-
class
MediaBase
(*args, **kwargs)¶ Base model for media objects.
-
ready
¶ Indicates if all output files have completed encoding.
Returns: Boolean indicating if all output files have completed encoding. Return type: boolean
-
encodable
¶ Indicates if the input file has not completed encoding yet.
Returns: Boolean indicating if the input file has not completed encoding yet. Return type: boolean
-
input_path
¶ The path to the input file uploaded by the user.
Returns: For example: [MEDIA_ROOT]/user/video/IMG001.MPEG
.Return type: str or None
-
output_path
(profile)¶ The path of the encoded output file.
Parameters: profile ( EncodingProfile
) – TheEncodingProfile
instance that contains the encoding data.Returns: For example: [ENCODE_MEDIA_ROOT]/[ENCODE_MEDIA_PATH_NAME]/audio/51.mp3
.Return type: str
-
get_media
()¶ The media type. Either
VIDEO
,SNAPSHOT
, orAUDIO
.Return type: MediaBase
subclass.Returns: The media subclass.
-
store_file
(profile)¶ Add the encoded input file to the
output_files
field.Parameters: profile ( EncodingProfile
) – TheEncodingProfile
instance that contains the encoding data.Raises: UploadError
: Something went wrong while uploading the file or the file does not exist.
-
remove_file
(profile)¶ Remove the input (and possible local encoded) file.
Parameters: profile ( EncodingProfile
) – TheEncodingProfile
instance that contains the encoding data.
-
save
(profiles=[], *args, **kwargs)¶ Set the
encoding
status toTrue
and save the model.Parameters: profiles (list) – List of primary keys of encoding profiles.
-
-
class
Video
(*args, **kwargs)¶ Model for video files.
-
save
(*args, **kwargs)¶ Encode and upload the video.
-