content package
Subpackages
Submodules
content.admin module
- class content.admin.VideoResource(**kwargs)
Bases:
ModelResource
- 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
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
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
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