* 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. * 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 0.2b10
* fixed: getURL now returns the link with it's parameters double quoted as it should. * 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/ # http://code.google.com/p/pylast/
__name__ = 'pyLast' __name__ = 'pyLast'
__version__ = '0.2b11' __version__ = '0.2b12'
__doc__ = 'A Python interface to the Last.fm API.'
__author__ = 'Amr Hassan' __author__ = 'Amr Hassan'
__mail__ = 'amr.hassan@gmail.com' __email__ = 'amr.hassan@gmail.com'
API_SERVER = 'ws.audioscrobbler.com' API_SERVER = 'ws.audioscrobbler.com'
API_SUBDIR = '/2.0/' API_SUBDIR = '/2.0/'
@ -2345,8 +2346,8 @@ class User(BaseObject, Cacheable):
return list return list
def getPlaylistIDs(self): def getPlaylistsData(self):
"""Returns a list the playlists IDs this user has created. """ """Returns a list of dictionaries for each playlist. """
params = self._getParams() params = self._getParams()
doc = Request(self, 'user.getPlaylists', self.api_key, params).execute() doc = Request(self, 'user.getPlaylists', self.api_key, params).execute()
@ -2366,6 +2367,15 @@ class User(BaseObject, Cacheable):
return list 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): def fetchPlaylist(self, playlist_id):
"""Returns a list of the tracks on a playlist. """Returns a list of the tracks on a playlist.
* playlist_id: A unique last.fm playlist ID, can be retrieved from getPlaylistIDs(). * 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) 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): def getNowPlaying(self):
"""Returns the currently playing track, or None if nothing is playing. """ """Returns the currently playing track, or None if nothing is playing. """

View file

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