WTV2D/core/models.py

38 lines
1.1 KiB
Python
Raw Normal View History

2022-06-09 14:39:12 +02:00
from django.db import models
2022-06-09 15:11:48 +02:00
from enum import Enum
2022-06-09 14:39:12 +02:00
# Create your models here.
2022-06-09 15:11:48 +02:00
class VideoFile(models.Model):
"""
A class for uploading video to the server.
"""
def forDjango(cls):
cls.do_not_call_in_templates = True
return cls
@forDjango
class VideoFileStatus(Enum):
NEW = 1
PROCESSING = 4
READY = 7
file = models.FileField(upload_to="", max_length=1024) # If upload_to=="" then file will be uploaded to the MEDIA_ROOT path set in settings.
uploaded_at = models.DateTimeField(auto_now_add=True)
fps = models.IntegerField(default=25)
video_width = models.IntegerField(default=0, blank=True)
video_height = models.IntegerField(default=0, blank=True)
status = models.IntegerField(default=VideoFileStatus.NEW.value)
2022-10-30 00:26:33 +02:00
output_file = models.FileField(upload_to="", max_length=1024, blank=True)
csv_file = models.FileField(upload_to="", max_length=1024, blank=True)
2022-06-09 15:11:48 +02:00
@property
def url(self):
return self.file.url
2022-10-30 00:26:33 +02:00
class WTV2D_data(models.Model):
processing = models.BooleanField(default=False, blank=False)