summaryrefslogtreecommitdiff
path: root/app/media/models.py
diff options
context:
space:
mode:
Diffstat (limited to 'app/media/models.py')
-rw-r--r--app/media/models.py17
1 files changed, 17 insertions, 0 deletions
diff --git a/app/media/models.py b/app/media/models.py
index dcf7ccc..b5b4e06 100644
--- a/app/media/models.py
+++ b/app/media/models.py
@@ -5,6 +5,7 @@ from pathlib import Path
from PIL import Image
from django.core.exceptions import ValidationError
+from django.core.files import File
from django.contrib.gis.db import models
from django.contrib.sitemaps import Sitemap
from django.db.models.signals import post_save
@@ -25,6 +26,22 @@ from .readexif import readexif
from .utils import resize_image
+def add_mp4(filepath, luxvideo):
+ full_filepath = "/home/lxf/sites/django/luxagraf.net/"+filepath
+ v = open(full_filepath, "rb")
+ django_file = File(v)
+ video = LuxVideo.objects.get(title=luxvideo)
+ video.video_mp4.save(filepath, django_file, save=True)
+
+
+def add_webm(filepath, luxvideo):
+ full_filepath = "/home/lxf/sites/django/luxagraf.net/"+filepath
+ v = open(full_filepath, "rb")
+ django_file = File(v)
+ video = LuxVideo.objects.get(title=luxvideo)
+ video.video_webm.save(filepath, django_file, save=True)
+
+
def get_upload_path(self, filename):
return "images/original/%s/%s" % (datetime.datetime.today().strftime("%Y"), filename)