Permalink
Browse files

Release v1.7

  • Loading branch information...
2 parents 7f6a5cc + 5979a9f commit 3d62577148fd11add6ab96c2d8a1582a4cd4f64a @jodal jodal committed Apr 21, 2012
Showing with 2,207 additions and 2,366 deletions.
  1. +4 −0 .gitignore
  2. +24 −0 Makefile
  3. +1 −4 README.rst
  4. +0 −15 docs/_templates/layout.html
  5. +11 −8 docs/api/albumbrowse.rst
  6. +40 −8 docs/api/artistbrowse.rst
  7. +30 −3 docs/api/image.rst
  8. +51 −22 docs/api/link.rst
  9. +5 −0 docs/api/playlist.rst
  10. +18 −0 docs/api/search.rst
  11. +26 −9 docs/api/session.rst
  12. +48 −0 docs/audiosink.rst
  13. +4 −1 docs/authors.rst
  14. +116 −4 docs/changes.rst
  15. +23 −10 docs/conf.py
  16. +4 −14 docs/development.rst
  17. +1 −0 docs/index.rst
  18. +2 −2 docs/licenses.rst
  19. +3 −2 docs/managers/session.rst
  20. +113 −49 examples/jukebox.py
  21. +23 −0 pylintrc
  22. +17 −1 setup.py
  23. +32 −16 spotify/__init__.py
  24. +0 −62 spotify/alsahelper.py
  25. +127 −0 spotify/audiosink/__init__.py
  26. +26 −0 spotify/audiosink/alsa.py
  27. +95 −0 spotify/audiosink/gstreamer.py
  28. +28 −0 spotify/audiosink/oss.py
  29. +27 −0 spotify/audiosink/portaudio.py
  30. +130 −47 spotify/manager/session.py
  31. +0 −62 spotify/osshelper.py
  32. +24 −27 src/albumbrowser.c
  33. +3 −0 src/albumbrowser.h
  34. +121 −31 src/artistbrowser.c
  35. +5 −2 src/artistbrowser.h
  36. +2 −0 src/image.c
  37. +2 −2 src/link.c
  38. +541 −1,637 src/mockmodule.c
  39. +10 −3 src/playlist.c
  40. +20 −0 src/search.c
  41. +118 −47 src/session.c
  42. +3 −0 src/session.h
  43. +2 −0 src/toplistbrowser.c
  44. +1 −1 tests/test_album.py
  45. +30 −20 tests/test_albumbrowser.py
  46. +7 −7 tests/test_artist.py
  47. +48 −17 tests/test_artistbrowser.py
  48. +12 −13 tests/test_containermanager.py
  49. +1 −1 tests/test_globals.py
  50. +45 −46 tests/test_link.py
  51. +67 −60 tests/test_playlist.py
  52. +31 −19 tests/test_playlistmanager.py
  53. +40 −77 tests/test_search.py
  54. +38 −12 tests/test_toplist.py
  55. +6 −4 tests/test_track.py
  56. +1 −1 tests/test_user.py
View
@@ -4,6 +4,9 @@
*.swp
*.wpr
*.wpu
+*~
+\#*
+.\#*
.coverage
.pc
MANIFEST
@@ -14,3 +17,4 @@ dist
nosetests.xml
spotify_appkey.key
tmp/
+.DS_Store
View
@@ -0,0 +1,24 @@
+.PHONY: autotest build clean default install test
+
+BUILD_DIR="build/lib/"
+
+default: build
+
+clean:
+ @rm -rf build/
+
+build: clean
+ @python setup.py build --with-mock --build-lib ${BUILD_DIR}
+
+test: build
+ @PYTHONPATH=${BUILD_DIR} nosetests
+
+autotest: build
+ @which inotifywait || (echo "inotifywait not found"; exit 1)
+ @while true; do \
+ clear; \
+ PYTHONPATH=${BUILD_DIR} nosetests; \
+ inotifywait -q -e create -e modify -e delete \
+ --exclude ".*\.(pyc|sw.)" \
+ -r spotify/ src/ tests/; \
+ done
View
@@ -14,10 +14,7 @@ apply for, and receive an API key from Spotify.
Project resources
=================
-- `Documentation for the latest release
- <http://pyspotify.mopidy.com/docs/master/>`_
-- `Documentation for the development version
- <http://pyspotify.mopidy.com/docs/develop/>`_
+- `Documentation <http://pyspotify.mopidy.com/>`_
- `Source code <http://github.com/mopidy/pyspotify>`_
- `Issue tracker <http://github.com/mopidy/pyspotify/issues>`_
- IRC: ``#mopidy`` at `irc.freenode.net <http://freenode.net/>`_
@@ -1,15 +0,0 @@
-{% extends "!layout.html" %}
-
-{% block extrahead %}
-{{ super() }}
-<script type="text/javascript">
- var _gaq = _gaq || [];
- _gaq.push(['_setAccount', 'UA-15510432-2']);
- _gaq.push(['_trackPageview']);
- (function() {
- var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
- ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
- var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
- })();
-</script>
-{% endblock %}
View
@@ -2,21 +2,24 @@ Album browsing
**************
.. currentmodule:: spotify
-Album browsers are created by :meth:`Session.browse_album` object. They are
-iterable objects.
-
-
The :class:`AlbumBrowser` class
===============================
-.. class:: AlbumBrowser
-
- AlbumBrowser objects.
+.. class:: AlbumBrowser(album[, callback[, userdata]])
.. note:: A sequence of :class:`Track` objects.
+ Browse an album, calling the callback when the browser's metadata is
+ loaded.
+
+ :param album: a Spotify album (does not have to be loaded)
+ :type album: :class:`Album`
+ :param callback: a function with signature :
+ ``(AlbumBrowser browser, Object userdata)``
+ :param userdata: any object
+
.. method:: is_loaded
:rtype: :class:`int`
- :returns: Wether this album browser has finished loading metadata.
+ :returns: wether this album browser has finished loading metadata.
View
@@ -2,21 +2,53 @@ Artist browsing
***************
.. currentmodule:: spotify
-Artist browsers are created by :meth:`Session.browse_artist` object. They are
-iterable objects.
-
-
The :class:`ArtistBrowser` class
================================
-.. class:: ArtistBrowser
-
- ArtistBrowser objects.
+.. class:: ArtistBrowser(artist[, type[, callback[, userdata]]])
.. note:: A sequence of :class:`Track` objects.
+ Browse an artist, calling the callback when the browser's metadata is
+ loaded.
+
+ :param artist: a Spotify artist (does not have to be loaded)
+ :type artist: :class:`Artist`
+ :param type: this browser's type. One of:
+
+ * ``'full'`` (default): all data will be fetched (deprecated in
+ pyspotify 1.7 / libspotify 11)
+ * ``'no_tracks'``: no information about tracks
+ * ``'no_albums'``: no information about albums (implies ``'no_tracks'``)
+
+ The ``'no_tracks'`` and ``'no_albums'`` browser types also include a
+ list of top tracks for this artist.
+
+ :param callback: a function with signature :
+ ``(ArtistBrowser browser, Object userdata)``
+ :param userdata: any object
+
.. method:: is_loaded
:rtype: :class:`int`
- :returns: Wether this artist browser has finished loading metadata.
+ :returns: wether this artist browser has finished loading metadata.
+
+ .. method:: albums
+
+ :rtype: list of :class:`Album`
+ :returns: the list of albums found while browsing
+
+ .. method:: similar_artists
+
+ :rtype: list of :class:`Artist`
+ :returns: the list of similar artists found while browsing
+
+ .. method:: tracks
+
+ :rtype: list of :class:`Track`
+ :returns: the list of tracks found while browsing
+
+ .. method:: tophit_tracks
+ :rtype: list of :class:`Track`
+ :returns: the list of top tracks for this artist found while browsing
View
@@ -8,7 +8,34 @@ The :class:`Image` class
========================
.. currentmodule:: spotify
-.. autoclass:: Image
- :members:
- :undoc-members:
+.. class:: Image
+ Image objects
+
+ .. method:: add_load_callback()
+
+ Add a load callback
+
+ .. method:: data()
+
+ Get image data
+
+ .. method:: error()
+
+ Check if image retrieval returned an error code
+
+ .. method:: format()
+
+ Get image format (currently only JPEG)
+
+ .. method:: image_id()
+
+ Get image ID
+
+ .. method:: is_loaded()
+
+ True if this Image has been loaded by the client
+
+ .. method:: remove_load_callback()
+
+ Remove a load callback
View
@@ -17,71 +17,100 @@ The :class:`Link` class
.. data:: LINK_TRACK
-
.. data:: LINK_ALBUM
-
.. data:: LINK_ARTIST
-
.. data:: LINK_SEARCH
-
.. data:: LINK_PLAYLIST
+ .. method:: __str__()
+
+ Return the link as a string in the Spotify format.
+
+ Example: ``spotify:track:5st5644IlBmKiiRE73UsoZ``
+
+ .. method:: type()
+
+ Return the type of the link as an :class:`int`. Check value
+ against the :data:`LINK_*` types.
.. method:: as_album()
- Return this link as an :class:`Album` object.
+ :return: the link as an :class:`Album` object.
+ :rtype: :class:`Album`
.. method:: as_artist()
- Return this link as an :class:`Artist` object.
+ :return: the link as an :class:`Artist` object.
+ :rtype: :class:`Artist`
.. method:: as_track()
- Return this link as a :class:`Track` object.
+ :return: the link as a :class:`Track` object.
+ :rtype: :class:`Track`
.. staticmethod:: from_album(album)
+ :param album: an album
+ :type album: :class:`Album`
+ :return: link to the album
+ :rtype: :class:`Link`
:raises: :exc:`SpotifyError`
Create a new :class:`Link` object from an :class:`Album` object.
.. staticmethod:: from_artist(artist)
- :raises: :exc:`SpotifyError`
+ :param artist: an artist
+ :type artist: :class:`Artist`
+ :return: link to the artist
+ :rtype: :class:`Link`
+ :raises: :exc:`SpotifyError`
- Create a new :class:`Link` object from an :class:`Artist` object.
+ Create a new :class:`Link` object from an :class:`Artist` object.
.. staticmethod:: from_playlist(playlist)
- :raises: :exc:`SpotifyError`
+ :param playlist: a playlist
+ :type playlist: :class:`Playlist`
+ :return: link to the playlist
+ :rtype: :class:`Link`
+ :raises: :exc:`SpotifyError`
- Create a new :class:`Link` object from a :class:`Playlist` object.
+ Create a new :class:`Link` object from a :class:`Playlist` object.
.. staticmethod:: from_search(results)
- :raises: :exc:`SpotifyError`
+ :param results: a result set
+ :type results: :class:`Results`
+ :return: link to the result set
+ :rtype: :class:`Link`
+ :raises: :exc:`SpotifyError`
- Create a new :class:`Link` object from a :class:`Results` object.
+ Create a new :class:`Link` object from a :class:`Results` object.
.. staticmethod:: from_string(s)
+ :param s: a Spotify URI
+ :type s: :class:`string`
+ :return: link to the same resource as the URI string
+ :rtype: :class:`Link`
:raises: :exc:`SpotifyError`
Create a new :class:`Link` object from a string.
Raises an exception if the string is not a valid Spotify URI.
- .. staticmethod:: from_track()
+ .. staticmethod:: from_track(track[, offset])
+ :param track: a track
+ :type track: :class:`Track`
+ :param offset: offset in milliseconds from the start of the track
+ :type offset: :class:`int`
+ :return: link to the result set
+ :rtype: :class:`Link`
:raises: :exc:`SpotifyError`
- Create a new :class:`Link` object from a :class:`Track` object.
-
- .. method:: type()
-
- Return the type of the link as an :class:`int`. Check value
- against the :data:`LINK_*` types.
-
-
+ Create a new :class:`Link` object from a :class:`Track` object, and
+ optionally a time offset in milliseconds from the start of the track.
View
@@ -150,6 +150,11 @@ objects.
:rtype: :class:`int`
:returns: The number of subscribers of this playlist
+ .. method:: owner
+
+ :rtype: :class:`spotify.User`
+ :returns: the owner of the playlist
+
.. method:: rename(name)
:param name: the new name
View
@@ -39,6 +39,24 @@ The :class:`Results` class
:rtype: string
:returns: the query expression that generated these results.
+ .. method:: total_albums
+
+ :rtype: :class:`int`
+ :returns: the total number of albums available for this search query.
+
+ .. note:: If this value is larger than the interval specified at
+ creation of the search object, more search results are available.
+ To fetch these, create a new search object with a new interval.
+
+ .. method:: total_artists
+
+ :rtype: :class:`int`
+ :returns: the total number of artists available for this search query.
+
+ .. note:: If this value is larger than the interval specified at
+ creation of the search object, more search results are available.
+ To fetch these, create a new search object with a new interval.
+
.. method:: total_tracks
:rtype: :class:`int`
Oops, something went wrong.

0 comments on commit 3d62577

Please sign in to comment.