summaryrefslogtreecommitdiff
path: root/app/media/models.py
diff options
context:
space:
mode:
authorluxagraf <sng@luxagraf.net>2024-07-24 16:37:26 -0500
committerluxagraf <sng@luxagraf.net>2024-07-24 16:37:26 -0500
commit88e0f0ac2bd5874256bf7e84fa460965bacdd761 (patch)
treec79a3cc81a2a85be809605b9042b00ca32db095c /app/media/models.py
parent074ec1e21a7bfa867bbb2c35057c19b5cfc375c4 (diff)
general update
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)