mirror of
https://github.com/EstrellaXD/Auto_Bangumi.git
synced 2026-04-28 12:30:20 +08:00
38 lines
1.3 KiB
Python
38 lines
1.3 KiB
Python
from pydantic import BaseModel
|
|
from sqlmodel import SQLModel, Field
|
|
from typing import Optional
|
|
|
|
|
|
class Torrent(SQLModel, table=True):
|
|
id: int = Field(default=None, primary_key=True, alias="id")
|
|
bangumi_id: Optional[int] = Field(None, alias="refer_id", foreign_key="bangumi.id")
|
|
rss_id: Optional[int] = Field(None, alias="rss_id", foreign_key="rssitem.id")
|
|
name: str = Field("", alias="name")
|
|
url: str = Field("https://example.com/torrent", alias="url")
|
|
homepage: Optional[str] = Field(None, alias="homepage")
|
|
save_path: Optional[str] = Field(None, alias="saved_path")
|
|
downloaded: bool = Field(False, alias="downloaded")
|
|
|
|
|
|
class TorrentUpdate(SQLModel):
|
|
downloaded: bool = Field(False, alias="downloaded")
|
|
|
|
|
|
class EpisodeFile(BaseModel):
|
|
media_path: str = Field(...)
|
|
group: str | None = Field(None)
|
|
title: str = Field(...)
|
|
season: int = Field(...)
|
|
episode: int = Field(None)
|
|
suffix: str = Field(..., regex=r"\.(mkv|mp4|MKV|MP4)$")
|
|
|
|
|
|
class SubtitleFile(BaseModel):
|
|
media_path: str = Field(...)
|
|
group: str | None = Field(None)
|
|
title: str = Field(...)
|
|
season: int = Field(...)
|
|
episode: int = Field(None)
|
|
language: str = Field(..., regex=r"(zh|zh-tw)")
|
|
suffix: str = Field(..., regex=r"\.(ass|srt|ASS|SRT)$")
|