content package

Subpackages

Submodules

content.admin module

class content.admin.VideoAdmin(*args, **kwargs)

Bases: ImportExportModelAdmin

property media
class content.admin.VideoResource(**kwargs)

Bases: ModelResource

class Meta

Bases: object

model

alias of Video

fields = {'category': <import_export.fields.Field: category>, 'created_at': <import_export.fields.Field: created_at>, 'description': <import_export.fields.Field: description>, 'hls_playlist': <import_export.fields.Field: hls_playlist>, 'id': <import_export.fields.Field: id>, 'thumbnail': <import_export.fields.Field: thumbnail>, 'title': <import_export.fields.Field: title>, 'video_file': <import_export.fields.Field: video_file>}

content.apps module

class content.apps.ContentConfig(app_name, app_module)

Bases: AppConfig

default_auto_field = 'django.db.models.BigAutoField'
name = 'content'
ready()

Override this method in subclasses to run code when Django starts.

content.models module

class content.models.Video(id, created_at, title, description, video_file, category, thumbnail, hls_playlist)

Bases: Model

exception DoesNotExist

Bases: ObjectDoesNotExist

exception MultipleObjectsReturned

Bases: MultipleObjectsReturned

categories = [('New on Videoflix', 'New on Videoflix'), ('Dcoumentary', 'Documentary'), ('Drama', 'Drama'), ('Romance', 'Romance')]
category

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

created_at

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

description

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

get_category_display(*, field=<django.db.models.fields.CharField: category>)
get_next_by_created_at(*, field=<django.db.models.fields.DateField: created_at>, is_next=True, **kwargs)
get_previous_by_created_at(*, field=<django.db.models.fields.DateField: created_at>, is_next=False, **kwargs)
hls_playlist

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

id

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

objects = <django.db.models.manager.Manager object>
thumbnail

Just like the FileDescriptor, but for ImageFields. The only difference is assigning the width/height to the width_field/height_field, if appropriate.

title

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

video_file

The descriptor for the file attribute on the model instance. Return a FieldFile when accessed so you can write code like:

>>> from myapp.models import MyModel
>>> instance = MyModel.objects.get(pk=1)
>>> instance.file.size

Assign a file object on assignment so you can do:

>>> with open('/path/to/hello.world') as f:
...     instance.file = File(f)

content.serializers module

class content.serializers.VideoSerializer(*args, **kwargs)

Bases: ModelSerializer

class Meta

Bases: object

fields = '__all__'
model

alias of Video

content.signals module

content.signals.delete_file_on_delete(sender, instance, **kwargs)

Deletes file from database when Video is deleted

content.signals.video_post_save(sender, instance, created, **kwargs)

Sends variables to tasks.py to format through RQ Worker

content.tasks module

content.tasks.convert_to_hls(source, video_id)

Converts source file to HLS with multiple quality levels and saves files in corresponding folder.

content.tasks.exportJson()
content.tasks.rerun_converter(cmd)

Runs the ffmpeg command and restarts if terminated by SIGKILL.

content.tests module

class content.tests.VideoViewTests(methodName='runTest')

Bases: TestCase

setUp()

Hook method for setting up the test fixture before exercising it.

test_convert_to_hls()
test_get_all_videos()
test_get_single_video()

content.views module

class content.views.VideoView(**kwargs)

Bases: APIView

dispatch(request, *args, **kwargs)

.dispatch() is pretty much the same as Django’s regular dispatch, but with extra hooks for startup, finalize, and exception handling.

get(request, pk=None, format=None)
permission_classes = [<class 'rest_framework.permissions.AllowAny'>]
post(request, *args, **kwargs)
queryset = <QuerySet []>
serializer_class

alias of VideoSerializer

Module contents