diff options
author | luxagraf <sng@luxagraf.net> | 2023-05-07 12:00:07 -0400 |
---|---|---|
committer | luxagraf <sng@luxagraf.net> | 2023-05-07 12:00:07 -0400 |
commit | 9bb9db0bf8e82b5fc2b09b8cf58454a2d6240929 (patch) | |
tree | a163081116bd06be0e331c5e65fa2e539da9cbfa /app/media | |
parent | c80d34f99c97563a520f9bee8acf00b56107afc5 (diff) |
media: added functions to add videos from server files
Diffstat (limited to 'app/media')
-rw-r--r-- | app/media/models.py | 15 |
1 files changed, 15 insertions, 0 deletions
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) |