mirror of
https://github.com/EstrellaXD/Auto_Bangumi.git
synced 2026-04-28 04:21:24 +08:00
refactor: database and rss engine
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
from .bangumi import Bangumi, Episode
|
||||
from .bangumi import Bangumi, Episode, BangumiUpdate
|
||||
from .config import Config
|
||||
from .rss import RSSTorrents
|
||||
from .torrent import EpisodeFile, SubtitleFile, TorrentBase
|
||||
from .rss import RSSItem, RSSUpdate
|
||||
from .torrent import EpisodeFile, SubtitleFile, Torrent, TorrentUpdate
|
||||
from .user import UserLogin
|
||||
|
||||
@@ -34,6 +34,7 @@ class BangumiUpdate(SQLModel):
|
||||
default="official_title", alias="official_title", title="番剧中文名"
|
||||
)
|
||||
year: Optional[str] = Field(alias="year", title="番剧年份")
|
||||
title_raw: str = Field(default="title_raw", alias="title_raw", title="番剧原名")
|
||||
season: int = Field(default=1, alias="season", title="番剧季度")
|
||||
season_raw: Optional[str] = Field(alias="season_raw", title="番剧季度原名")
|
||||
group_name: Optional[str] = Field(alias="group_name", title="字幕组")
|
||||
@@ -44,7 +45,10 @@ class BangumiUpdate(SQLModel):
|
||||
offset: int = Field(default=0, alias="offset", title="番剧偏移量")
|
||||
filter: str = Field(default="720, \\d+-\\d+", alias="filter", title="番剧过滤器")
|
||||
rss_link: str = Field(default="", alias="rss_link", title="番剧RSS链接")
|
||||
poster_link: Optional[str] = Field(alias="poster_link", title="番剧海报链接")
|
||||
added: bool = Field(default=False, alias="added", title="是否已添加")
|
||||
rule_name: Optional[str] = Field(alias="rule_name", title="番剧规则名")
|
||||
save_path: Optional[str] = Field(alias="save_path", title="番剧保存路径")
|
||||
deleted: bool = Field(False, alias="deleted", title="是否已删除")
|
||||
|
||||
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
from os.path import expandvars
|
||||
from pydantic import BaseModel, Field
|
||||
|
||||
# Sub config
|
||||
|
||||
|
||||
class Program(BaseModel):
|
||||
rss_time: int = Field(7200, description="Sleep time")
|
||||
|
||||
@@ -1,17 +1,21 @@
|
||||
from pydantic import BaseModel, Field
|
||||
from sqlmodel import SQLModel, Field
|
||||
from typing import Optional
|
||||
|
||||
|
||||
class RSSItem(BaseModel):
|
||||
id: int = Field(0, alias="id", title="id")
|
||||
class RSSItem(SQLModel, table=True):
|
||||
id: int = Field(default=None, primary_key=True, alias="id")
|
||||
item_path: str = Field("example path", alias="item_path")
|
||||
url: str = Field("https://mikanani.me", alias="url")
|
||||
combine: bool = Field(True, alias="combine")
|
||||
enabled: bool = Field(True, alias="enabled")
|
||||
|
||||
|
||||
class TorrentData(BaseModel):
|
||||
id: int = Field(0, alias="id")
|
||||
rss_id: int = Field(0, alias="rss_id")
|
||||
name: str = Field("", alias="name")
|
||||
url: str = Field("https://example.com/torrent", alias="url")
|
||||
save_path: str = Field("path/to/save", alias="save_path")
|
||||
class RSSUpdate(SQLModel):
|
||||
item_path: Optional[str] = Field("example path", alias="item_path")
|
||||
url: Optional[str] = Field("https://mikanani.me", alias="url")
|
||||
combine: Optional[bool] = Field(True, alias="combine")
|
||||
enabled: Optional[bool] = Field(True, alias="enabled")
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -1,16 +1,19 @@
|
||||
from pydantic import BaseModel, Field
|
||||
from pydantic import BaseModel
|
||||
from sqlmodel import SQLModel, Field
|
||||
from typing import Optional
|
||||
|
||||
|
||||
class TorrentBase(BaseModel):
|
||||
name: str = Field(...)
|
||||
torrent_link: str = Field(...)
|
||||
homepage: str | None = Field(None)
|
||||
class Torrent(SQLModel, table=True):
|
||||
id: int = Field(default=None, primary_key=True, alias="id")
|
||||
refer_id: Optional[int] = Field(None, alias="refer_id")
|
||||
name: str = Field("", alias="name")
|
||||
url: str = Field("https://example.com/torrent", alias="url")
|
||||
homepage: Optional[str] = Field(None, alias="homepage")
|
||||
downloaded: bool = Field(False, alias="downloaded")
|
||||
|
||||
|
||||
class FileSet(BaseModel):
|
||||
media_path: str = Field(...)
|
||||
sc_subtitle: str | None = Field(None)
|
||||
tc_subtitle: str | None = Field(None)
|
||||
class TorrentUpdate(SQLModel):
|
||||
downloaded: bool = Field(False, alias="downloaded")
|
||||
|
||||
|
||||
class EpisodeFile(BaseModel):
|
||||
|
||||
Reference in New Issue
Block a user