forked from Firehawk52-backup/Telegram-Odesli-Bot
Add files via upload
This commit is contained in:
36
TelegramBot/helpers/odesli/entity/album/Album.py
Normal file
36
TelegramBot/helpers/odesli/entity/album/Album.py
Normal file
@@ -0,0 +1,36 @@
|
||||
from __future__ import annotations
|
||||
|
||||
from ..Entity import Entity
|
||||
|
||||
"""
|
||||
Represents a album for one provider.
|
||||
|
||||
id: Id of the album that's used by the provider.
|
||||
provider: The provider.
|
||||
title: The title of the album.
|
||||
artistName: The name of the artistName of this album.
|
||||
thumbnailUrl: The thumbnail url of the album.
|
||||
thumbnailWidth: The width of the thumbnail of the album.
|
||||
thumbnailHeight: The height of the thumbnail of the album.
|
||||
linksByPlatform: Dictionary, mapping platforms to links to this album.
|
||||
Note that Platform != Provider. There is the provider youtube
|
||||
with the two platforms youtube and youtubeMusic.
|
||||
|
||||
"""
|
||||
class Album(Entity):
|
||||
def __init__(self, id, provider, title, artistName, thumbnailUrl, thumbnailWidth,
|
||||
thumbnailHeight, linksByPlatform):
|
||||
super().__init__(id, provider, title, artistName, thumbnailUrl, thumbnailWidth,
|
||||
thumbnailHeight, linksByPlatform)
|
||||
|
||||
def getType(self):
|
||||
return 'album'
|
||||
|
||||
@staticmethod
|
||||
def parse(rawAlbumEntity, linksByPlatform) -> Album:
|
||||
return Album(*Entity.parse(rawAlbumEntity, linksByPlatform))
|
||||
|
||||
def __eq__(self, o):
|
||||
if isinstance(o, Album):
|
||||
return super().__eq__(o)
|
||||
return False
|
||||
25
TelegramBot/helpers/odesli/entity/album/AlbumResult.py
Normal file
25
TelegramBot/helpers/odesli/entity/album/AlbumResult.py
Normal file
@@ -0,0 +1,25 @@
|
||||
from __future__ import annotations
|
||||
|
||||
from ..EntityResult import EntityResult
|
||||
from .Album import Album
|
||||
|
||||
"""
|
||||
Represents the result when a album was requested.
|
||||
|
||||
albumLink: Odesli album page url.
|
||||
album: Instance of Album. Provides title, artist, etc.
|
||||
Represents the album corresponding to the provider
|
||||
that was used for querying.
|
||||
albumsByProvider: Dictionary, mapping providers to the corresponding
|
||||
albums (The attribute album is included in this dictionary).
|
||||
"""
|
||||
class AlbumResult(EntityResult):
|
||||
def __init__(self, albumLink, album, albumsByProvider):
|
||||
self.albumLink = albumLink
|
||||
self.album = album
|
||||
self.albumsByProvider = albumsByProvider
|
||||
|
||||
@staticmethod
|
||||
def parse(result) -> AlbumResult:
|
||||
return AlbumResult(*super(AlbumResult, AlbumResult).parse(result, Album))
|
||||
|
||||
Reference in New Issue
Block a user