From 9bb9db0bf8e82b5fc2b09b8cf58454a2d6240929 Mon Sep 17 00:00:00 2001 From: luxagraf Date: Sun, 7 May 2023 12:00:07 -0400 Subject: media: added functions to add videos from server files --- app/media/models.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'app/media') diff --git a/app/media/models.py b/app/media/models.py index d9becf4..c93b9fc 100644 --- a/app/media/models.py +++ b/app/media/models.py @@ -26,6 +26,21 @@ from .utils import resize_image from locations.models import Location, CheckIn +def add_mp4(self, filepath, luxvideo): + full_filepath = "/home/lxf/sites/django/luxagraf.net/"+filepath + v = open(filepath, "rb") + django_file = File(v) + video = LuxVideo.objects.get(title=luxvideo) + video.video_mp4.save(filepath, django_file, save=True) + + +def add_webm(self, filepath, luxvideo): + full_filepath = "/home/lxf/sites/django/luxagraf.net/"+filepath + v = open(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