* fixed: some unicode problems.
 * fix: a typo in the function name Exceptionable.clear_errors()
 * fixed: User.fetchPlaylist (#3)
 * api change: User.getPlaylistsIDs is now User.getPlaylistsData, and User.getPlaylistsIDs returns a list of IDs now.
This commit is contained in:
Amr Hassan 2008-10-16 13:14:36 +00:00
parent ea21ee0b7f
commit ae41e1a641
3 changed files with 26 additions and 11 deletions

View file

@ -1,5 +1,8 @@
0.2b11
0.2b12
* fixed: some unicode problems.
* fix: a typo in the function name Exceptionable.clear_errors()
* fixed: User.fetchPlaylist (#3)
* api change: User.getPlaylistsIDs is now User.getPlaylistsData, and User.getPlaylistsIDs returns a list of IDs now.
0.2b10
* fixed: getURL now returns the link with it's parameters double quoted as it should.

View file

@ -21,9 +21,10 @@
# http://code.google.com/p/pylast/
__name__ = 'pyLast'
__version__ = '0.2b11'
__version__ = '0.2b12'
__doc__ = 'A Python interface to the Last.fm API.'
__author__ = 'Amr Hassan'
__mail__ = 'amr.hassan@gmail.com'
__email__ = 'amr.hassan@gmail.com'
API_SERVER = 'ws.audioscrobbler.com'
API_SUBDIR = '/2.0/'
@ -2345,8 +2346,8 @@ class User(BaseObject, Cacheable):
return list
def getPlaylistIDs(self):
"""Returns a list the playlists IDs this user has created. """
def getPlaylistsData(self):
"""Returns a list of dictionaries for each playlist. """
params = self._getParams()
doc = Request(self, 'user.getPlaylists', self.api_key, params).execute()
@ -2366,6 +2367,15 @@ class User(BaseObject, Cacheable):
return list
def getPlaylistIDs(self):
"""Returns a list the playlists IDs this user has created. """
ids = []
for i in self.getPlaylistsData():
ids.append(i['id'])
return ids
def fetchPlaylist(self, playlist_id):
"""Returns a list of the tracks on a playlist.
* playlist_id: A unique last.fm playlist ID, can be retrieved from getPlaylistIDs().
@ -2373,7 +2383,7 @@ class User(BaseObject, Cacheable):
uri = u'lastfm://playlist/%s' %unicode(playlist_id)
return Playlist(uri, self.api_key).fetch()
return Playlist(uri, *self.auth_data).fetch()
def getNowPlaying(self):
"""Returns the currently playing track, or None if nothing is playing. """

View file

@ -1,10 +1,12 @@
from distutils.core import setup
setup(name='pylast',
version='0.2b10',
author='Amr Hassan',
long_description = 'A Python interface to the Last.fm API',
author_email='amr.hassan@gmail.com',
import pylast
setup(name = pylast.__name__,
version = pylast.__version__,
author = pylast.__author__,
long_description = pylast.__doc__,
author_email = pylast.__email__,
url='http://code.google.com/p/pylast/',
py_modules= ("pylast",)
)