pyfmframework/fmframework/model/album.py

50 lines
1.7 KiB
Python
Raw Normal View History

2019-10-08 18:57:42 +01:00
from typing import List
from fmframework.model.fm import LastFM, Wiki, Image
2019-10-03 19:06:44 +01:00
from fmframework.model.artist import Artist
from fmframework.util.console import Color
class Album(LastFM):
def __init__(self,
name: str = None,
url: str = None,
mbid: str = None,
listeners: int = None,
play_count: int = None,
user_scrobbles: int = None,
wiki: Wiki = None,
artist: Artist = None,
2019-10-08 18:57:42 +01:00
images: List[Image] = None):
2019-10-03 19:06:44 +01:00
super().__init__(name=name,
url=url,
mbid=mbid,
listeners=listeners,
play_count=play_count,
user_scrobbles=user_scrobbles,
2019-10-08 18:57:42 +01:00
wiki=wiki,
images=images)
2019-10-03 19:06:44 +01:00
self.artist = artist
def __str__(self):
return f'{self.name} / {self.artist}'
def __repr__(self):
return Color.DARKCYAN + Color.BOLD + 'Album' + Color.END + f': {self.name} artist({repr(self.artist)}) ' \
+ super().__repr__()
2019-10-03 19:06:44 +01:00
@staticmethod
def wrap(name: str = None,
artist: str = None,
url: str = None,
mbid: str = None,
listeners: int = None,
play_count: int = None,
user_scrobbles: int = None):
return Album(name=name,
artist=Artist(name=artist),
url=url,
mbid=mbid,
listeners=listeners,
play_count=play_count,
user_scrobbles=user_scrobbles)