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