How to use the tekore._model.member.Image function in tekore

To help you get started, we’ve selected a few tekore examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github felix-hilden / spotipy / tekore / _model / episode.py View on Github external
"""Episode resume point."""

    fully_played: bool
    resume_position_ms: int


@dataclass(repr=False)
class Episode(Item):
    """Episode base."""

    audio_preview_url: str
    description: str
    duration_ms: int
    explicit: bool
    external_urls: dict
    images: List[Image]
    is_externally_hosted: bool
    is_playable: bool
    language: str
    languages: List[str]
    name: str
    release_date: str
    release_date_precision: ReleaseDatePrecision

    def __post_init__(self):
        self.images = ModelList(Image(**i) for i in self.images)
        self.languages = ModelList(self.languages)
        self.release_date_precision = ReleaseDatePrecision[
            self.release_date_precision
        ]
github felix-hilden / spotipy / tekore / _model / album / base.py View on Github external
class AlbumType(StrEnum):
    """Type of album."""

    album = 'album'
    compilation = 'compilation'
    single = 'single'


@dataclass(repr=False)
class Album(Item):
    """Album base."""

    album_type: AlbumType
    artists: List[SimpleArtist]
    external_urls: dict
    images: List[Image]
    name: str
    total_tracks: int
    release_date: str
    release_date_precision: ReleaseDatePrecision

    def __post_init__(self):
        self.album_type = AlbumType[self.album_type.lower()]
        self.artists = ModelList(SimpleArtist(**a) for a in self.artists)
        self.images = ModelList(Image(**i) for i in self.images)
        self.release_date_precision = ReleaseDatePrecision[
            self.release_date_precision
        ]
github felix-hilden / spotipy / tekore / _model / playlist.py View on Github external
track_type = {
    'track': FullPlaylistTrack,
    'episode': FullPlaylistEpisode,
}


@dataclass(repr=False)
class PlaylistTrack(Model):
    """Track or episode on a playlist."""

    added_at: Timestamp
    added_by: PublicUser
    is_local: bool
    primary_color: str
    video_thumbnail: Optional[Image]
    track: Union[FullPlaylistTrack, LocalPlaylistTrack, FullPlaylistEpisode, None]

    def __post_init__(self):
        self.added_at = Timestamp.from_string(self.added_at)
        self.added_by = PublicUser(**self.added_by)

        if self.video_thumbnail is not None:
            self.video_thumbnail = Image(**self.video_thumbnail)

        if self.track is not None:
            if self.is_local:
                self.track = LocalPlaylistTrack(**self.track)
            else:
                self.track = track_type[self.track['type']](**self.track)
github felix-hilden / spotipy / tekore / _model / show / base.py View on Github external
def __post_init__(self):
        self.available_markets = ModelList(self.available_markets)
        self.copyrights = ModelList(Copyright(**c) for c in self.copyrights)
        self.images = ModelList(Image(**i) for i in self.images)
        self.languages = ModelList(self.languages)
github felix-hilden / spotipy / tekore / _model / artist.py View on Github external
def __post_init__(self):
        self.followers = Followers(**self.followers)
        self.genres = ModelList(self.genres)
        self.images = ModelList(Image(**i) for i in self.images)
github felix-hilden / spotipy / tekore / _model / playlist.py View on Github external
def __post_init__(self):
        self.added_at = Timestamp.from_string(self.added_at)
        self.added_by = PublicUser(**self.added_by)

        if self.video_thumbnail is not None:
            self.video_thumbnail = Image(**self.video_thumbnail)

        if self.track is not None:
            if self.is_local:
                self.track = LocalPlaylistTrack(**self.track)
            else:
                self.track = track_type[self.track['type']](**self.track)
github felix-hilden / spotipy / tekore / _model / playlist.py View on Github external
def __post_init__(self):
        self.images = ModelList(Image(**i) for i in self.images)
        self.owner = PublicUser(**self.owner)
github felix-hilden / spotipy / tekore / _model / show / base.py View on Github external
from ..base import Item
from ..member import Copyright, Image
from ..serialise import ModelList


@dataclass(repr=False)
class Show(Item):
    """Show base."""

    available_markets: List[str]
    copyrights: List[Copyright]
    description: str
    explicit: bool
    external_urls: dict
    images: List[Image]
    is_externally_hosted: bool
    languages: List[str]
    media_type: str
    name: str
    publisher: str

    def __post_init__(self):
        self.available_markets = ModelList(self.available_markets)
        self.copyrights = ModelList(Copyright(**c) for c in self.copyrights)
        self.images = ModelList(Image(**i) for i in self.images)
        self.languages = ModelList(self.languages)
github felix-hilden / spotipy / tekore / _model / user.py View on Github external
def __post_init__(self):
        if self.followers is not None:
            self.followers = Followers(**self.followers)
        if self.images is not None:
            self.images = ModelList(Image(**i) for i in self.images)
github felix-hilden / spotipy / tekore / _model / episode.py View on Github external
def __post_init__(self):
        self.images = ModelList(Image(**i) for i in self.images)
        self.languages = ModelList(self.languages)
        self.release_date_precision = ReleaseDatePrecision[
            self.release_date_precision
        ]