Files
ohm_streaming/app/models/download.py
T
root 87f245d3fc
CI / Test (Python 3.11) (pull_request) Has been cancelled
CI / Test (Python 3.12) (pull_request) Has been cancelled
CI / Lint (pull_request) Has been cancelled
CI / Type Check (pull_request) Has been cancelled
CI / Summary (pull_request) Has been cancelled
feat: flat design Sunset Glitch + download manager + settings + recommendations overhaul
- Sunset Glitch color palette applied to all templates
- Font Awesome icons throughout UI
- Download manager with parallel queue and progress tracking
- Settings page with dynamic configuration
- Recommendations router enhanced with scoring
- Local vendor libs (Alpine.js, HTMX) for offline support
- Auto test suite with screenshots
- Series releases list component
- New download model
2026-04-11 19:30:32 +00:00

41 lines
1.4 KiB
Python

"""Models for download task persistence with SQLModel support"""
import uuid
from typing import Optional
from datetime import datetime
from sqlmodel import SQLModel, Field, Column, String
from enum import Enum
class DownloadStatus(str, Enum):
PENDING = "pending"
DOWNLOADING = "downloading"
PAUSED = "paused"
COMPLETED = "completed"
FAILED = "failed"
CANCELLED = "cancelled"
class DownloadTaskTable(SQLModel, table=True):
"""Database table for persisting download tasks across server restarts."""
__tablename__ = "download_tasks"
id: str = Field(
default_factory=lambda: str(uuid.uuid4()),
primary_key=True,
index=True,
nullable=False,
)
url: str = Field(default="", sa_column=Column(String))
filename: str = Field(sa_column=Column(String))
host: str = Field(default="other", sa_column=Column(String))
status: str = Field(default="pending", sa_column=Column(String))
progress: float = Field(default=0.0)
downloaded_bytes: int = Field(default=0)
total_bytes: Optional[int] = Field(default=None)
speed: float = Field(default=0.0)
error: Optional[str] = Field(default=None, sa_column=Column(String))
created_at: datetime = Field(default_factory=datetime.now)
started_at: Optional[datetime] = Field(default=None)
completed_at: Optional[datetime] = Field(default=None)
file_path: Optional[str] = Field(default=None, sa_column=Column(String))