Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Merge branch 'develop' into feature/libspotify11

  • Loading branch information...
commit b5aaeffd0b4000d3912347a1f8131a9ede21527b 2 parents 769cae8 + e75fc1d
@jodal jodal authored
View
9 docs/changes.rst
@@ -30,6 +30,15 @@ v1.7 (in development)
- ``offset`` is now optional in :meth:`Link.from_track`.
+- Remove undocumented/internal method
+ :meth:`spotify.manager.SpotifySessionManager.wake`.
+ :meth:`spotify.manager.SpotifySessionManager.notify_main_thread` does the
+ same job.
+
+- Remove undocumented/internal method
+ :meth:`spotify.manager.SpotifySessionManager.terminate`. Use
+ :meth:`spotify.manager.SpotifySessionManager.disconnect` instead.
+
**New features**
- Added method :meth:`spotify.Playlist.owner`.
View
5 docs/managers/session.rst
@@ -1,8 +1,9 @@
Session manager
-****************
+***************
+
.. currentmodule:: spotify.manager
.. autoclass:: SpotifySessionManager
:members:
- :exclude-members: terminate,wake,loop
+ :exclude-members: loop
:member-order: bysource
View
2  examples/jukebox.py
@@ -38,7 +38,7 @@ def do_logout(self, line):
def do_quit(self, line):
print "Goodbye!"
- self.jukebox.terminate()
+ self.jukebox.disconnect()
return True
def do_list(self, line):
View
30 spotify/manager/session.py
@@ -42,7 +42,11 @@ def __init__(self, username=None, password=None, remember_me=False,
def connect(self):
"""
Connect to the Spotify API using the given username and password.
+
This method calls the :func:`spotify.connect` function.
+
+ This method does not return before we disconnect from the Spotify
+ service.
"""
session = spotify.connect(self)
self.loop(session) # returns on disconnect
@@ -62,23 +66,13 @@ def loop(self, session):
self.timer.start()
self.awoken.wait()
- def terminate(self):
+ def disconnect(self):
"""
Terminate the current Spotify session.
"""
self.finished = True
self.wake()
- disconnect = terminate
-
- def wake(self, session=None):
- """
- This is called by the Spotify subsystem to wake up the main loop.
- """
- if self.timer is not None:
- self.timer.cancel()
- self.awoken.set()
-
def logged_in(self, session, error):
"""
Callback.
@@ -148,9 +142,13 @@ def notify_main_thread(self, session):
"""
Callback.
- When this method is called, you should make sure that
- :meth:`session.process_events() <spotify.Session.process_events>` is
- called.
+ When this method is called by ``libspotify``, one should call
+ :meth:`session.process_events() <spotify.Session.process_events>`.
+
+ If you use the :class:`SessionManager`'s default loop, the default
+ implementation of this method does the job. Though, if you implement
+ your own loop for handling Spotify events, you'll need to override this
+ method.
.. warning::
This method is called from an internal thread in libspotify. You
@@ -160,7 +158,9 @@ def notify_main_thread(self, session):
:param session: the current session.
:type session: :class:`spotify.Session`
"""
- pass
+ if self.timer is not None:
+ self.timer.cancel()
+ self.awoken.set()
def music_delivery(self, session, frames, frame_size, num_frames,
sample_type, sample_rate, channels):
View
2  src/session.c
@@ -586,7 +586,7 @@ notify_main_thread(sp_session * session)
PyObject *client = (PyObject *)sp_session_userdata(session);
if (client != NULL) {
- method = PyObject_GetAttrString(client, "wake");
+ method = PyObject_GetAttrString(client, "notify_main_thread");
res = PyObject_CallFunctionObjArgs(method, psession, NULL);
if (!res)
PyErr_WriteUnraisable(method);
Please sign in to comment.
Something went wrong with that request. Please try again.