From 88e0f0ac2bd5874256bf7e84fa460965bacdd761 Mon Sep 17 00:00:00 2001 From: luxagraf Date: Wed, 24 Jul 2024 16:37:26 -0500 Subject: general update --- app/media/models.py | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'app/media/models.py') 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) -- cgit v1.2.3-70-g09d2