* toStr() is now less crashy.
This commit is contained in:
parent
a131d73735
commit
93378fb3ef
|
@ -1,5 +1,6 @@
|
||||||
0.2.16
|
0.2.16
|
||||||
* All the getTopTags and getTopTagsWithCounts return an empty sequence if failed instead of None.
|
* All the getTopTags and getTopTagsWithCounts return an empty sequence if failed instead of None.
|
||||||
|
* toStr() is now less crashy.
|
||||||
|
|
||||||
0.2.15
|
0.2.15
|
||||||
* API Breakage, changed the design of Asynchronizer.async_call.
|
* API Breakage, changed the design of Asynchronizer.async_call.
|
||||||
|
|
22
pylast.py
22
pylast.py
|
@ -708,7 +708,7 @@ class Album(BaseObject, Cacheable, Taggable):
|
||||||
def toStr(self):
|
def toStr(self):
|
||||||
"""Returns a string representation of the object."""
|
"""Returns a string representation of the object."""
|
||||||
|
|
||||||
return self.getArtist().getName() + u' - ' + self.getTitle()
|
return self.getArtist().getName().encode('utf-8') + ' - ' + self.getTitle().encode('utf-8')
|
||||||
|
|
||||||
class Track(BaseObject, Cacheable, Taggable):
|
class Track(BaseObject, Cacheable, Taggable):
|
||||||
"""A Last.fm track."""
|
"""A Last.fm track."""
|
||||||
|
@ -1028,7 +1028,7 @@ class Track(BaseObject, Cacheable, Taggable):
|
||||||
def toStr(self):
|
def toStr(self):
|
||||||
"""Returns a string representation of the object."""
|
"""Returns a string representation of the object."""
|
||||||
|
|
||||||
return self.getArtist().getName() + u' - ' + self.getTitle()
|
return self.getArtist().getName().encode('utf-8') + ' - ' + self.getTitle().encode('utf-8')
|
||||||
|
|
||||||
class Artist(BaseObject, Cacheable, Taggable):
|
class Artist(BaseObject, Cacheable, Taggable):
|
||||||
"""A Last.fm artist."""
|
"""A Last.fm artist."""
|
||||||
|
@ -1311,7 +1311,7 @@ class Artist(BaseObject, Cacheable, Taggable):
|
||||||
def toStr(self):
|
def toStr(self):
|
||||||
"""Returns a string representation of the object."""
|
"""Returns a string representation of the object."""
|
||||||
|
|
||||||
return self.getName()
|
return self.getName().encode('utf-8')
|
||||||
|
|
||||||
class Event(BaseObject, Cacheable):
|
class Event(BaseObject, Cacheable):
|
||||||
"""A Last.fm event."""
|
"""A Last.fm event."""
|
||||||
|
@ -1521,17 +1521,17 @@ class Event(BaseObject, Cacheable):
|
||||||
artists = self.getArtists()
|
artists = self.getArtists()
|
||||||
for i in range(0, len(artists)):
|
for i in range(0, len(artists)):
|
||||||
if i == 0:
|
if i == 0:
|
||||||
sa = artists[i].getName()
|
sa = artists[i].getName().encode('utf-8')
|
||||||
continue
|
continue
|
||||||
elif i< len(artists)-1:
|
elif i< len(artists)-1:
|
||||||
sa += ', '
|
sa += ', '
|
||||||
sa += artists[i].getName()
|
sa += artists[i].getName().encode('utf-8')
|
||||||
continue
|
continue
|
||||||
elif i == len(artists) - 1:
|
elif i == len(artists) - 1:
|
||||||
sa += ' and '
|
sa += ' and '
|
||||||
sa += artists[i].getName()
|
sa += artists[i].getName().encode('utf-8')
|
||||||
|
|
||||||
return "%(title)s: %(artists)s at %(place)s" %{'title': self.getTitle(), 'artists': sa, 'place': self.getVenueName()}
|
return "%(title)s: %(artists)s at %(place)s" %{'title': self.getTitle().encode('utf-8'), 'artists': sa, 'place': self.getVenueName().encode('utf-8')}
|
||||||
|
|
||||||
class Country(BaseObject):
|
class Country(BaseObject):
|
||||||
"""A country at Last.fm."""
|
"""A country at Last.fm."""
|
||||||
|
@ -1619,7 +1619,7 @@ class Country(BaseObject):
|
||||||
def toStr(self):
|
def toStr(self):
|
||||||
"""Returns a string representation of the object."""
|
"""Returns a string representation of the object."""
|
||||||
|
|
||||||
return self.getName()
|
return self.getName().encode('utf-8')
|
||||||
|
|
||||||
class Group(BaseObject):
|
class Group(BaseObject):
|
||||||
"""A Last.fm group."""
|
"""A Last.fm group."""
|
||||||
|
@ -1750,7 +1750,7 @@ class Group(BaseObject):
|
||||||
def toStr(self):
|
def toStr(self):
|
||||||
"""Returns a string representation of the object."""
|
"""Returns a string representation of the object."""
|
||||||
|
|
||||||
return self.getName()
|
return self.getName().encode('utf-8')
|
||||||
|
|
||||||
class Library(BaseObject):
|
class Library(BaseObject):
|
||||||
"""A user's Last.fm library."""
|
"""A user's Last.fm library."""
|
||||||
|
@ -2227,7 +2227,7 @@ class Tag(BaseObject):
|
||||||
def toStr(self):
|
def toStr(self):
|
||||||
"""Returns a string representation of the object."""
|
"""Returns a string representation of the object."""
|
||||||
|
|
||||||
return self.getName()
|
return self.getName().encode('utf-8')
|
||||||
|
|
||||||
class User(BaseObject, Cacheable):
|
class User(BaseObject, Cacheable):
|
||||||
"""A Last.fm user."""
|
"""A Last.fm user."""
|
||||||
|
@ -2791,7 +2791,7 @@ class User(BaseObject, Cacheable):
|
||||||
def toStr(self):
|
def toStr(self):
|
||||||
"""Returns a string representation of the object."""
|
"""Returns a string representation of the object."""
|
||||||
|
|
||||||
return self.getName()
|
return self.getName().encode('utf-8')
|
||||||
|
|
||||||
class Search(BaseObject):
|
class Search(BaseObject):
|
||||||
"""An abstract search class. Use one of its derivatives."""
|
"""An abstract search class. Use one of its derivatives."""
|
||||||
|
|
Loading…
Reference in a new issue