summaryrefslogtreecommitdiff
path: root/fossee_manim/models.py
diff options
context:
space:
mode:
Diffstat (limited to 'fossee_manim/models.py')
-rw-r--r--fossee_manim/models.py16
1 files changed, 15 insertions, 1 deletions
diff --git a/fossee_manim/models.py b/fossee_manim/models.py
index 9a85c4d..a3b3537 100644
--- a/fossee_manim/models.py
+++ b/fossee_manim/models.py
@@ -209,4 +209,18 @@ class AnimationStats(models.Model):
# Converting to Python file object with
# some Django-specific additions
django_file = File(que_file)
- self.thumbnail.save(file_name, django_file, save=True) \ No newline at end of file
+ self.thumbnail.save(file_name, django_file, save=True)
+
+ def _create_ogv(self):
+ video_input = self.video_path.path
+ vid_output = path.join(
+ tempfile.mkdtemp(), "{0}.ogv".format(self.animation.title)
+ )
+ file_name = "{0}.ogv".format(self.animation.title)
+ subprocess.call(['ffmpeg', '-i', video_input, '-r', '24', vid_output])
+ if path.exists(vid_output):
+ que_file = open(vid_output, 'rb')
+ # Converting to Python file object with
+ # some Django-specific additions
+ django_file = File(que_file)
+ self.video_path.save(file_name, django_file, save=True) \ No newline at end of file