mirror of
https://github.com/Mak5er/Downloader-Bot
synced 2026-11-26 09:08:08 +08:00
- Add video_quality, as_document, audio_format, and file_button to user settings schema and Alembic migrations. - Categorize /settings into Media & Quality, Appearance & Buttons, and Chat & Clean-up with dynamic back navigation. - Implement strict document delivery with disable_content_type_detection=True to prevent Telegram video player fallback when as_document is ON. - Add multi-photo ZIP archive packaging for photo carousels in as_document mode. - Differentiate DB media file cache entries between video and document types (url#document vs url#video) to eliminate cache collisions. - Hide redundant Download File inline button when as_document setting is active. - Remove obsolete referral system (/ref command and links).
35 lines
1017 B
Python
35 lines
1017 B
Python
from typing import Dict, List, Literal, Optional
|
|
from pydantic import BaseModel, Field
|
|
|
|
|
|
class MediaItem(BaseModel):
|
|
"""Strongly typed model representing an individual downloadable media asset."""
|
|
|
|
url: str
|
|
media_type: Literal["video", "audio", "photo", "document"] = "video"
|
|
filename: Optional[str] = None
|
|
size_bytes: Optional[int] = None
|
|
supports_range: bool = False
|
|
thumbnail_url: Optional[str] = None
|
|
duration_seconds: Optional[float] = None
|
|
headers: Dict[str, str] = Field(default_factory=dict)
|
|
|
|
|
|
class MediaExtractResult(BaseModel):
|
|
"""Strongly typed extraction payload returned by platform media resolvers."""
|
|
|
|
platform: str
|
|
source_url: str
|
|
title: Optional[str] = None
|
|
author: Optional[str] = None
|
|
caption: Optional[str] = None
|
|
items: List[MediaItem] = Field(default_factory=list)
|
|
|
|
@property
|
|
def is_empty(self) -> bool:
|
|
return len(self.items) == 0
|
|
|
|
@property
|
|
def is_album(self) -> bool:
|
|
return len(self.items) > 1
|