mirror of
https://github.com/zoriya/Kyoo.git
synced 2025-05-31 12:14:46 -04:00
Add models in the autosync module
This commit is contained in:
parent
1f3a985d3a
commit
31d8dcd6a8
10
autosync/autosync/models/episode.py
Normal file
10
autosync/autosync/models/episode.py
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
from typing import Literal
|
||||||
|
from dataclasses import dataclass
|
||||||
|
|
||||||
|
from .metadataid import MetadataID
|
||||||
|
|
||||||
|
|
||||||
|
@dataclass
|
||||||
|
class Episode:
|
||||||
|
external_id: dict[str, MetadataID]
|
||||||
|
kind: Literal["episode"]
|
8
autosync/autosync/models/metadataid.py
Normal file
8
autosync/autosync/models/metadataid.py
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
from dataclasses import dataclass
|
||||||
|
from typing import Optional
|
||||||
|
|
||||||
|
|
||||||
|
@dataclass
|
||||||
|
class MetadataID:
|
||||||
|
data_id: str
|
||||||
|
link: Optional[str]
|
17
autosync/autosync/models/movie.py
Normal file
17
autosync/autosync/models/movie.py
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
from typing import Literal, Optional
|
||||||
|
from datetime import date
|
||||||
|
from dataclasses import dataclass
|
||||||
|
|
||||||
|
from .metadataid import MetadataID
|
||||||
|
|
||||||
|
|
||||||
|
@dataclass
|
||||||
|
class Movie:
|
||||||
|
name: str
|
||||||
|
air_date: Optional[date]
|
||||||
|
external_id: dict[str, MetadataID]
|
||||||
|
kind: Literal["movie"]
|
||||||
|
|
||||||
|
@property
|
||||||
|
def year(self):
|
||||||
|
return self.air_date.year if self.air_date is not None else None
|
17
autosync/autosync/models/show.py
Normal file
17
autosync/autosync/models/show.py
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
from typing import Literal, Optional
|
||||||
|
from datetime import date
|
||||||
|
from dataclasses import dataclass
|
||||||
|
|
||||||
|
from .metadataid import MetadataID
|
||||||
|
|
||||||
|
|
||||||
|
@dataclass
|
||||||
|
class Show:
|
||||||
|
name: str
|
||||||
|
start_air: Optional[date]
|
||||||
|
external_id: dict[str, MetadataID]
|
||||||
|
kind: Literal["show"]
|
||||||
|
|
||||||
|
@property
|
||||||
|
def year(self):
|
||||||
|
return self.start_air.year if self.start_air is not None else None
|
30
autosync/autosync/models/user.py
Normal file
30
autosync/autosync/models/user.py
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
from datetime import datetime, time
|
||||||
|
from dataclasses import dataclass
|
||||||
|
from typing import Optional
|
||||||
|
|
||||||
|
|
||||||
|
@dataclass
|
||||||
|
class JwtToken:
|
||||||
|
token_type: str
|
||||||
|
access_token: str
|
||||||
|
refresh_token: str
|
||||||
|
expire_in: time
|
||||||
|
expire_at: datetime
|
||||||
|
|
||||||
|
|
||||||
|
@dataclass
|
||||||
|
class ExternalToken:
|
||||||
|
id: str
|
||||||
|
username: str
|
||||||
|
profileUrl: Optional[str]
|
||||||
|
token: JwtToken
|
||||||
|
|
||||||
|
|
||||||
|
@dataclass
|
||||||
|
class User:
|
||||||
|
id: str
|
||||||
|
username: str
|
||||||
|
email: str
|
||||||
|
permissions: list[str]
|
||||||
|
settings: dict[str, str]
|
||||||
|
external_id: dict[str, ExternalToken]
|
21
autosync/autosync/models/watch_status.py
Normal file
21
autosync/autosync/models/watch_status.py
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
from datetime import date
|
||||||
|
from dataclasses import dataclass
|
||||||
|
from typing import Optional
|
||||||
|
from enum import Enum
|
||||||
|
|
||||||
|
|
||||||
|
class Status(str, Enum):
|
||||||
|
COMPLETED = "completed"
|
||||||
|
WATCHING = "watching"
|
||||||
|
DROPED = "droped"
|
||||||
|
PLANNED = "planned"
|
||||||
|
DELETED = "deleted"
|
||||||
|
|
||||||
|
|
||||||
|
@dataclass
|
||||||
|
class WatchStatus:
|
||||||
|
added_date: date
|
||||||
|
played_date: date
|
||||||
|
status: Status
|
||||||
|
watched_time: Optional[int]
|
||||||
|
watched_percent: Optional[int]
|
Loading…
x
Reference in New Issue
Block a user