minor changes

This commit is contained in:
Abhinav Sarkar 2009-03-04 11:50:26 +00:00
parent e664888d40
commit 20e3e33e36
3 changed files with 18 additions and 16 deletions

View File

@ -95,8 +95,8 @@ class Api(object):
self._request_headers['User-Agent'] = user_agent
def get_album(self,
artist = None,
album = None,
artist = None,
mbid = None):
if isinstance(artist, Artist):
artist = artist.name
@ -120,8 +120,8 @@ class Api(object):
def get_event(self, event):
return Event.get_info(self, event)
def get_location(self, name):
return Location(self, name = name)
def get_location(self, city):
return Location(self, city = city)
def get_country(self, name):
return Country(self, name = name)

View File

@ -504,7 +504,7 @@ class Country(LastfmBase, Cacheable):
@staticmethod
def _hash_func(*args, **kwds):
try:
return hash(kwds['name'])
return hash(kwds['name'].lower())
except KeyError:
raise InvalidParametersError("name has to be provided for hashing")
@ -512,7 +512,7 @@ class Country(LastfmBase, Cacheable):
return self.__class__._hash_func(name = self.name)
def __eq__(self, other):
return self.name == other.name
return self.name.lower() == other.name.lower()
def __lt__(self, other):
return self.name < other.name

View File

@ -308,8 +308,8 @@ class Track(LastfmBase, Cacheable, Sharable, Searchable, Taggable):
self._mbid = data.findtext('mbid')
self._url = data.findtext('url')
self._duration = int(data.findtext('duration'))
self._streamable = (data.findtext('streamable') == '1'),
self._full_track = (data.find('streamable').attrib['fulltrack'] == '1'),
self._streamable = (data.findtext('streamable') == '1')
self._full_track = (data.find('streamable').attrib['fulltrack'] == '1')
self._image = dict([(i.get('size'), i.text) for i in data.findall('image')])
self._stats = Stats(
@ -323,15 +323,17 @@ class Track(LastfmBase, Cacheable, Sharable, Searchable, Taggable):
mbid = data.findtext('artist/mbid'),
url = data.findtext('artist/url')
)
self._album = Album(
self._api,
artist = self._artist,
name = data.findtext('album/title'),
mbid = data.findtext('album/mbid'),
url = data.findtext('album/url'),
image = dict([(i.get('size'), i.text) for i in data.findall('album/image')])
)
self._position = int(data.find('album').attrib['position'])
if data.find('album') is not None:
self._album = Album(
self._api,
artist = self._artist,
name = data.findtext('album/title'),
mbid = data.findtext('album/mbid'),
url = data.findtext('album/url'),
image = dict([(i.get('size'), i.text) for i in data.findall('album/image')])
)
self._position = data.find('album').attrib['position'].strip() \
and int(data.find('album').attrib['position'])
if data.find('wiki') is not None:
self._wiki = Wiki(
self,