mirror of
https://github.com/oskvr37/tiddl.git
synced 2026-06-13 04:05:08 +03:00
🏷️ models update
This commit is contained in:
@@ -39,7 +39,7 @@ class Video(BaseModel):
|
||||
type: str
|
||||
adsUrl: Optional[str] = None
|
||||
adsPrePaywallOnly: bool
|
||||
artist: Arist
|
||||
artist: Optional[Arist] = None
|
||||
artists: List[Arist]
|
||||
album: Optional[Album] = None
|
||||
|
||||
@@ -50,11 +50,18 @@ class Album(BaseModel):
|
||||
id: int
|
||||
name: str
|
||||
type: Literal["MAIN", "FEATURED"]
|
||||
picture: Optional[str] = None
|
||||
|
||||
class MediaMetadata(BaseModel):
|
||||
tags: List[Literal['LOSSLESS', 'HIRES_LOSSLESS']]
|
||||
|
||||
id: int
|
||||
title: str
|
||||
duration: int
|
||||
streamReady: bool
|
||||
adSupportedStreamReady: bool
|
||||
djReady: bool
|
||||
stemReady: bool
|
||||
streamStartDate: Optional[datetime] = None
|
||||
allowStreaming: bool
|
||||
premiumStreamingOnly: bool
|
||||
@@ -67,12 +74,14 @@ class Album(BaseModel):
|
||||
version: Optional[str] = None
|
||||
url: str
|
||||
cover: Optional[str] = None
|
||||
vibrantColor: Optional[str] = None
|
||||
videoCover: Optional[str] = None
|
||||
explicit: bool
|
||||
upc: str
|
||||
popularity: int
|
||||
audioQuality: str
|
||||
audioModes: List[str]
|
||||
mediaMetadata: MediaMetadata
|
||||
artist: Artist
|
||||
artists: List[Artist]
|
||||
|
||||
|
||||
+46
-109
@@ -2,30 +2,32 @@ from pydantic import BaseModel
|
||||
from typing import Optional, List, Literal, Dict, Union
|
||||
|
||||
from .track import Track
|
||||
from .resource import Playlist
|
||||
from .resource import Playlist, Album, Video
|
||||
from .api import Items
|
||||
|
||||
# TODO: cleanup this mess
|
||||
|
||||
|
||||
class _ArtistRole(BaseModel):
|
||||
categoryId: int
|
||||
category: Literal[
|
||||
"Artist",
|
||||
"Songwriter",
|
||||
"Performer",
|
||||
"Producer",
|
||||
"Engineer",
|
||||
"Production team",
|
||||
"Misc",
|
||||
]
|
||||
|
||||
|
||||
class _ArtistMix(BaseModel):
|
||||
ARTIST_MIX: str
|
||||
class SearchAlbum(Album):
|
||||
# TODO: remove the artist field instead of making it None
|
||||
artist: None = None
|
||||
|
||||
|
||||
class Artist(BaseModel):
|
||||
|
||||
class Role(BaseModel):
|
||||
categoryId: int
|
||||
category: Literal[
|
||||
"Artist",
|
||||
"Songwriter",
|
||||
"Performer",
|
||||
"Producer",
|
||||
"Engineer",
|
||||
"Production team",
|
||||
"Misc",
|
||||
]
|
||||
|
||||
class Mix(BaseModel):
|
||||
ARTIST_MIX: str
|
||||
|
||||
id: int
|
||||
name: str
|
||||
artistTypes: Optional[List[Literal["ARTIST", "CONTRIBUTOR"]]] = None
|
||||
@@ -33,98 +35,33 @@ class Artist(BaseModel):
|
||||
picture: Optional[str] = None
|
||||
selectedAlbumCoverFallback: Optional[str] = None
|
||||
popularity: Optional[int] = None
|
||||
artistRoles: Optional[List[_ArtistRole]] = None
|
||||
mixes: Optional[_ArtistMix | Dict] = None
|
||||
|
||||
|
||||
class SearchAritsts(Items):
|
||||
items: List[Artist]
|
||||
|
||||
|
||||
class ArtistSearchAlbum(BaseModel):
|
||||
id: int
|
||||
name: str
|
||||
type: Literal["MAIN", "FEATURED"]
|
||||
picture: str
|
||||
|
||||
|
||||
class SearchAlbum(BaseModel):
|
||||
id: int
|
||||
title: str
|
||||
duration: int
|
||||
streamReady: bool
|
||||
streamStartDate: Optional[str] = None
|
||||
allowStreaming: bool
|
||||
premiumStreamingOnly: bool
|
||||
numberOfTracks: int
|
||||
numberOfVideos: int
|
||||
numberOfVolumes: int
|
||||
releaseDate: str
|
||||
copyright: str
|
||||
type: str
|
||||
version: Optional[str] = None
|
||||
url: str
|
||||
cover: Optional[str] = None
|
||||
videoCover: Optional[str] = None
|
||||
explicit: bool
|
||||
upc: str
|
||||
popularity: int
|
||||
audioQuality: str
|
||||
audioModes: List[str]
|
||||
artists: List[ArtistSearchAlbum | Dict]
|
||||
|
||||
|
||||
class SearchAlbums(Items):
|
||||
items: List[SearchAlbum]
|
||||
|
||||
|
||||
class SearchPlaylists(Items):
|
||||
items: List[Playlist]
|
||||
|
||||
|
||||
class SearchTracks(Items):
|
||||
items: List[Track]
|
||||
|
||||
|
||||
class Video(BaseModel):
|
||||
id: int
|
||||
title: str
|
||||
volumeNumber: int
|
||||
trackNumber: int
|
||||
releaseDate: str
|
||||
imagePath: Optional[str] = None
|
||||
imageId: str
|
||||
vibrantColor: str
|
||||
duration: int
|
||||
quality: str
|
||||
streamReady: bool
|
||||
adSupportedStreamReady: bool
|
||||
djReady: bool
|
||||
stemReady: bool
|
||||
streamStartDate: str
|
||||
allowStreaming: bool
|
||||
explicit: bool
|
||||
popularity: int
|
||||
type: str
|
||||
adsUrl: Optional[str] = None
|
||||
adsPrePaywallOnly: bool
|
||||
artists: List[Artist]
|
||||
album: Optional[str] = None
|
||||
|
||||
|
||||
class SearchVideo(Items):
|
||||
items: List[Video]
|
||||
|
||||
|
||||
class TopHit(BaseModel):
|
||||
value: Union[Artist, Track, Playlist, SearchAlbum]
|
||||
type: Literal["ARTISTS", "TRACKS", "PLAYLISTS", "ALBUMS"]
|
||||
artistRoles: Optional[List[Role]] = None
|
||||
mixes: Optional[Mix | Dict] = None
|
||||
|
||||
|
||||
class Search(BaseModel):
|
||||
artists: SearchAritsts
|
||||
albums: SearchAlbums
|
||||
playlists: SearchPlaylists
|
||||
tracks: SearchTracks
|
||||
videos: SearchVideo
|
||||
class Artists(Items):
|
||||
items: List[Artist]
|
||||
|
||||
class Albums(Items):
|
||||
items: List[SearchAlbum]
|
||||
|
||||
class Playlists(Items):
|
||||
items: List[Playlist]
|
||||
|
||||
class Tracks(Items):
|
||||
items: List[Track]
|
||||
|
||||
class Videos(Items):
|
||||
items: List[Video]
|
||||
|
||||
class TopHit(BaseModel):
|
||||
value: Union[Artist, Track, Playlist, Album]
|
||||
type: Literal["ARTISTS", "TRACKS", "PLAYLISTS", "ALBUMS"]
|
||||
|
||||
artists: Artists
|
||||
albums: Albums
|
||||
playlists: Playlists
|
||||
tracks: Tracks
|
||||
videos: Videos
|
||||
topHit: TopHit
|
||||
|
||||
Reference in New Issue
Block a user