avorg/backend/models.py

20 lines
718 B
Python

from sqlalchemy import Column, Integer, String, DateTime, Boolean
from sqlalchemy.ext.declarative import declarative_base
from datetime import datetime
Base = declarative_base()
class Video(Base):
__tablename__ = "videos"
id = Column(Integer, primary_key=True, index=True)
title = Column(String, index=True)
path = Column(String, unique=True, index=True)
duration = Column(Integer) # in seconds
size = Column(Integer) # in bytes
thumbnail_path = Column(String, nullable=True)
date_added = Column(DateTime, default=datetime.utcnow)
is_processed = Column(Boolean, default=False)
def __repr__(self):
return f"<Video(title='{self.title}', path='{self.path}')>"