republisher/repub/items.py

74 lines
1.5 KiB
Python
Raw Normal View History

from dataclasses import dataclass, field
from typing import Any, List, TypedDict
class MediaVariant(TypedDict, total=False):
url: str
path: str
type: str
medium: str
isDefault: str
fileSize: int | str
bitrate: int | float | str
samplingrate: int | str
channels: int | str
duration: str
width: int | str
height: int | str
framerate: str
expression: str
lang: str
class TranscodedMediaFile(TypedDict):
url: str
path: str
checksum: str | None
status: str
published_url: str
variants: List[MediaVariant]
2024-04-18 11:57:24 +02:00
class ThumbnailVariant(TypedDict, total=False):
url: str
path: str
width: int | str
height: int | str
slot: str
type: str
class TranscodedImageFile(TypedDict):
url: str
path: str
checksum: str | None
status: str
published_url: str
source_path: str
variants: List[MediaVariant]
thumbnails: List[ThumbnailVariant]
2024-04-18 11:57:24 +02:00
@dataclass
class ElementItem:
feed_name: str
2024-04-18 11:57:24 +02:00
el: Any
image_urls: List[str]
images: List[TranscodedImageFile]
file_urls: List[str]
files: List[Any]
audio_urls: List[str]
audios: List[TranscodedMediaFile]
video_urls: List[str]
videos: List[TranscodedMediaFile]
media_image_urls: List[str] = field(default_factory=list)
2024-04-18 11:57:24 +02:00
@dataclass
class ChannelElementItem:
feed_name: str
2024-04-18 11:57:24 +02:00
el: Any
image_urls: List[str]
images: List[TranscodedImageFile]
media_image_urls: List[str] = field(default_factory=list)