Automatic Movie Generation

Subpackages

Models

Models for storing data about a movie

class movie.models.Movie(*args, **kwargs)

Bases: Model

An automatically-generated Movie showing the interaction.

exception DoesNotExist

Bases: ObjectDoesNotExist

exception MultipleObjectsReturned

Bases: MultipleObjectsReturned

generatedOnApplicationVersion

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

gifFile

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)
id

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

movieFile

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)
objects = <django.db.models.manager.Manager object>
resolutionHeight

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

resolutionWidth

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

save(*args, **kwargs)

Save the current instance. Override this in a subclass if you want to control the saving process.

The ‘force_insert’ and ‘force_update’ parameters can be used to insist that the “save” must be an SQL insert or update (or equivalent for non-SQL backends), respectively. Normally, they should not be set.

titleImage

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

class movie.models.SpeechSynthStorage

Bases: DefaultStorage

Speech synth is stored in a separate bucket. No-op when using offline mode.

bucket_name = None
class movie.models.TextToSpeechCachedFile(*args, **kwargs)

Bases: Model

A mapping from a text to an audio file of the text-to-speech mp3

exception DoesNotExist

Bases: ObjectDoesNotExist

exception MultipleObjectsReturned

Bases: MultipleObjectsReturned

audioFile

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)
get_next_by_lastUsed(*, field=<django.db.models.fields.DateTimeField: lastUsed>, is_next=True, **kwargs)
get_previous_by_lastUsed(*, field=<django.db.models.fields.DateTimeField: lastUsed>, is_next=False, **kwargs)
lastUsed

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>
text

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

Tasks

Tasks fail to generate docs on readthedocs.io, skipping…

Tests

Unit and integration tests for automatic movie creation

class movie.tests.MovieCreationTestsIntegration(methodName='runTest')

Bases: StaticLiveServerTestCase

Integration tests - no mocking here to test everything above that was mocked, but with short text

test_caching_polly()

Make sure that TextToSpeechCachedFile reads and writes properly

class movie.tests.MovieCreationTestsMocked(methodName='runTest')

Bases: StaticLiveServerTestCase

Tests for the Movie Creation module. Currently, these do not test the celery connection.

setUp()

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

tearDown()

Hook method for deconstructing the test fixture after testing it.

test_avoid_upload_collision()

Ensure that a unique filename is created for each upload. Regression for the vertical upload immediately overriding the horizontal.

test_captions_all_as_expected(mockSpawnAudio, mockGenerateImage, mockWriteVideoFile)

Integration test to verify the end-to-end script

test_failure_status(mockTraceback)

Test that the failure status is accurately set

test_long_text_doesnt_fail()

Make sure that very long text requests don’t crash, but don’t save a cache either.

test_movie_task_by_url(mockCreateMovie)

Test create_movie_task() is called with .delay() when accessing /createMovie

test_movie_task_without_celery(mockGetNumRounds)

Test that the movie gets created when calling create_movie_task() directly

URLs

URLs for movie generation and viewing

Views

Views for movie generation and viewing

class movie.views.CreateMovie(**kwargs)

Bases: LoginRequiredMixin, RedirectView

Create a movie. Admin access required for this long-running process.

get_redirect_url(*args, **kwargs)

Return the URL redirect to. Keyword arguments from the URL pattern match generating the redirect request are provided as kwargs to this method.

login_url = '/admin/login/'
permanent = False
query_string = False
class movie.views.MovieGenerationView(**kwargs)

Bases: DetailView

The view used by movie generation - not intended to be user-facing, but no harm done by exposing it either.

dispatch(request, *args, **kwargs)
get_context_data(**kwargs)

Insert the single object into the context dict.

model

alias of JsonConfig

template_name = 'movie/movie-generation.html'
class movie.views.VisualizeMovie(**kwargs)

Bases: DetailView

Temporary view to see just the movie visualization. Delete once it’s integrated into a share button.

dispatch(request, *args, **kwargs)
get_context_data(**kwargs)

Insert the single object into the context dict.

model

alias of JsonConfig

template_name = 'movie/only-movie.html'