* properly_capitalized argument available for attributes that can be
retrieved from the webservices and replace the given (more likely) miscapitalized ones. Closes Issue #37
This commit is contained in:
parent
0183d8b294
commit
a3649bd1cb
28
pylast.py
28
pylast.py
|
@ -1152,8 +1152,13 @@ class Artist(_BaseObject, _Taggable):
|
|||
def _get_params(self):
|
||||
return {'artist': self.get_name()}
|
||||
|
||||
def get_name(self):
|
||||
"""Returns the name of the artist."""
|
||||
def get_name(self, properly_capitalized=False):
|
||||
"""Returns the name of the artist.
|
||||
If properly_capitalized was asserted then the name would be downloaded
|
||||
overwriting the given one."""
|
||||
|
||||
if properly_capitalized:
|
||||
self.name = _extract(self._request("artist.getInfo", True), "name")
|
||||
|
||||
return self.name
|
||||
|
||||
|
@ -1957,9 +1962,12 @@ class Tag(_BaseObject):
|
|||
def __ne__(self, other):
|
||||
return self.get_name().lower() != other.get_name().lower()
|
||||
|
||||
def get_name(self):
|
||||
def get_name(self, properly_capitalized=False):
|
||||
"""Returns the name of the tag. """
|
||||
|
||||
if properly_capitalized:
|
||||
self.name = _extract(self._request("tag.getInfo", True), "name")
|
||||
|
||||
return self.name
|
||||
|
||||
def get_similar(self):
|
||||
|
@ -2105,15 +2113,18 @@ class Track(_BaseObject, _Taggable):
|
|||
|
||||
return self.artist
|
||||
|
||||
def get_title(self):
|
||||
def get_title(self, properly_capitalized=False):
|
||||
"""Returns the track title."""
|
||||
|
||||
if properly_capitalized:
|
||||
self.title = _extract(self._request("track.getInfo", True), "name")
|
||||
|
||||
return self.title
|
||||
|
||||
def get_name(self):
|
||||
def get_name(self, properly_capitalized=False):
|
||||
"""Returns the track title (alias to Track.get_title)."""
|
||||
|
||||
return self.get_title()
|
||||
return self.get_title(properly_capitalized)
|
||||
|
||||
def get_id(self):
|
||||
"""Returns the track id on the network."""
|
||||
|
@ -2528,9 +2539,12 @@ class User(_BaseObject):
|
|||
def _get_params(self):
|
||||
return {"user": self.get_name()}
|
||||
|
||||
def get_name(self):
|
||||
def get_name(self, properly_capitalized=False):
|
||||
"""Returns the nuser name."""
|
||||
|
||||
if properly_capitalized:
|
||||
self.name = _extract(self._request("user.getInfo", True), "name")
|
||||
|
||||
return self.name
|
||||
|
||||
def get_upcoming_events(self):
|
||||
|
|
Loading…
Reference in a new issue