Add files via upload

This commit is contained in:
suhail-c
2024-04-26 17:20:31 +05:30
committed by GitHub
parent be7edb6aeb
commit b66086ea10
2 changed files with 61 additions and 0 deletions

View 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

View 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))