reordered repr and fixed int casting
This commit is contained in:
parent
5ac24987db
commit
977384729a
@ -27,7 +27,7 @@ class Album(LastFM):
|
|||||||
return f'{self.name} / {self.artist}'
|
return f'{self.name} / {self.artist}'
|
||||||
|
|
||||||
def __repr__(self):
|
def __repr__(self):
|
||||||
return super().__repr__() + Color.DARKCYAN + Color.BOLD + ' Album' + Color.END + f': {self.artist}'
|
return Color.DARKCYAN + Color.BOLD + 'Album' + Color.END + f': {self.artist} ' + super().__repr__()
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def wrap(name: str = None,
|
def wrap(name: str = None,
|
||||||
|
@ -23,4 +23,4 @@ class Artist(LastFM):
|
|||||||
return f'{self.name}'
|
return f'{self.name}'
|
||||||
|
|
||||||
def __repr__(self):
|
def __repr__(self):
|
||||||
return super().__repr__() + Color.PURPLE + Color.BOLD + ' Artist' + Color.END
|
return Color.PURPLE + Color.BOLD + 'Artist ' + Color.END + super().__repr__()
|
||||||
|
@ -9,9 +9,9 @@ class Track(LastFM):
|
|||||||
name: str = None,
|
name: str = None,
|
||||||
url: str = None,
|
url: str = None,
|
||||||
mbid: str = None,
|
mbid: str = None,
|
||||||
listeners: int = None,
|
listeners: int = 0,
|
||||||
play_count: int = None,
|
play_count: int = 0,
|
||||||
user_scrobbles: int = None,
|
user_scrobbles: int = 0,
|
||||||
wiki: Wiki = None,
|
wiki: Wiki = None,
|
||||||
album: Album = None,
|
album: Album = None,
|
||||||
artist: Artist = None,
|
artist: Artist = None,
|
||||||
@ -30,8 +30,8 @@ class Track(LastFM):
|
|||||||
return f'{self.name} / {self.album} / {self.artist}'
|
return f'{self.name} / {self.album} / {self.artist}'
|
||||||
|
|
||||||
def __repr__(self):
|
def __repr__(self):
|
||||||
return super().__repr__() + Color.YELLOW + Color.BOLD + ' Track' + Color.END + \
|
return Color.YELLOW + Color.BOLD + 'Track' + Color.END + \
|
||||||
f': album({repr(self.album)}), artist({repr(self.artist)})'
|
f': album({repr(self.album)}), artist({repr(self.artist)}) ' + super().__repr__()
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def wrap(name: str = None,
|
def wrap(name: str = None,
|
||||||
|
@ -158,18 +158,18 @@ class Network:
|
|||||||
return Artist(name=artist_dict.get('name', 'n/a'),
|
return Artist(name=artist_dict.get('name', 'n/a'),
|
||||||
url=artist_dict.get('url', None),
|
url=artist_dict.get('url', None),
|
||||||
mbid=artist_dict.get('mbid', None),
|
mbid=artist_dict.get('mbid', None),
|
||||||
listeners=artist_dict["stats"].get('listeners', None),
|
listeners=int(artist_dict["stats"].get('listeners', 0)),
|
||||||
play_count=artist_dict["stats"].get('playcount', None),
|
play_count=int(artist_dict["stats"].get('playcount', 0)),
|
||||||
user_scrobbles=artist_dict["stats"].get('userplaycount', None),
|
user_scrobbles=int(artist_dict["stats"].get('userplaycount', 0)),
|
||||||
wiki=self.parse_wiki(artist_dict['wiki']) if artist_dict.get('wiki', None) else None)
|
wiki=self.parse_wiki(artist_dict['wiki']) if artist_dict.get('wiki', None) else None)
|
||||||
|
|
||||||
def parse_album(self, album_dict) -> Album:
|
def parse_album(self, album_dict) -> Album:
|
||||||
return Album(name=album_dict.get('name', 'n/a'),
|
return Album(name=album_dict.get('name', 'n/a'),
|
||||||
url=album_dict.get('url', 'n/a'),
|
url=album_dict.get('url', 'n/a'),
|
||||||
mbid=album_dict.get('mbid', 'n/a'),
|
mbid=album_dict.get('mbid', 'n/a'),
|
||||||
listeners=album_dict.get('listeners', 'n/a'),
|
listeners=int(album_dict.get('listeners', 0)),
|
||||||
play_count=album_dict.get('playcount', 'n/a'),
|
play_count=int(album_dict.get('playcount', 0)),
|
||||||
user_scrobbles=album_dict.get('userplaycount', 'n/a'),
|
user_scrobbles=int(album_dict.get('userplaycount', 0)),
|
||||||
wiki=self.parse_wiki(album_dict['wiki']) if album_dict.get('wiki', None) else None,
|
wiki=self.parse_wiki(album_dict['wiki']) if album_dict.get('wiki', None) else None,
|
||||||
artist=album_dict.get('artist'))
|
artist=album_dict.get('artist'))
|
||||||
|
|
||||||
@ -177,9 +177,9 @@ class Network:
|
|||||||
track = Track(name=track_dict.get('name', 'n/a'),
|
track = Track(name=track_dict.get('name', 'n/a'),
|
||||||
url=track_dict.get('url', 'n/a'),
|
url=track_dict.get('url', 'n/a'),
|
||||||
mbid=track_dict.get('mbid', 'n/a'),
|
mbid=track_dict.get('mbid', 'n/a'),
|
||||||
listeners=track_dict.get('listeners', 'n/a'),
|
listeners=int(track_dict.get('listeners', 0)),
|
||||||
play_count=track_dict.get('playcount', 'n/a'),
|
play_count=int(track_dict.get('playcount', 0)),
|
||||||
user_scrobbles=track_dict.get('userplaycount', 'n/a'),
|
user_scrobbles=int(track_dict.get('userplaycount', 0)),
|
||||||
wiki=self.parse_wiki(track_dict['wiki']) if track_dict.get('wiki', None) else None)
|
wiki=self.parse_wiki(track_dict['wiki']) if track_dict.get('wiki', None) else None)
|
||||||
|
|
||||||
if track_dict.get('album', None):
|
if track_dict.get('album', None):
|
||||||
|
Loading…
Reference in New Issue
Block a user