From 973d5d330e5719f8aa479d5e7bf95dcb69bfe109 Mon Sep 17 00:00:00 2001 From: Stein Magnus Jodal Date: Thu, 29 Apr 2010 22:54:37 +0200 Subject: [PATCH 1/4] Fix some pylint warnings --- mopidy/backends/__init__.py | 4 +++- mopidy/backends/dummy.py | 4 ++-- mopidy/backends/libspotify.py | 7 +++++-- mopidy/mixers/nad.py | 1 + mopidy/mpd/frontend.py | 3 ++- mopidy/mpd/server.py | 10 +++++----- mopidy/process.py | 2 ++ 7 files changed, 20 insertions(+), 11 deletions(-) diff --git a/mopidy/backends/__init__.py b/mopidy/backends/__init__.py index e45dcf63..1a7e1559 100644 --- a/mopidy/backends/__init__.py +++ b/mopidy/backends/__init__.py @@ -104,7 +104,7 @@ class BaseCurrentPlaylistController(object): tracks = self.playlist.tracks assert at_position <= len(tracks), 'at_position can not be greater' \ - + ' than playlist length' + + ' than playlist length' if at_position is not None: tracks.insert(at_position, track) @@ -337,6 +337,8 @@ class BasePlaybackController(object): self._state = self.STOPPED self._shuffled = [] self._first_shuffle = True + self._play_time_accumulated = 0 + self._play_time_started = None @property def next_track(self): diff --git a/mopidy/backends/dummy.py b/mopidy/backends/dummy.py index 0da24c44..b64cdfba 100644 --- a/mopidy/backends/dummy.py +++ b/mopidy/backends/dummy.py @@ -36,7 +36,7 @@ class DummyLibraryController(BaseLibraryController): find_exact = search class DummyPlaybackController(BasePlaybackController): - def _next(self): + def _next(self, track): return True def _pause(self): @@ -45,7 +45,7 @@ class DummyPlaybackController(BasePlaybackController): def _play(self, track): return True - def _previous(self): + def _previous(self, track): return True def _resume(self): diff --git a/mopidy/backends/libspotify.py b/mopidy/backends/libspotify.py index edffa3af..48c11f4b 100644 --- a/mopidy/backends/libspotify.py +++ b/mopidy/backends/libspotify.py @@ -181,6 +181,7 @@ class LibspotifySessionManager(SpotifySessionManager, threading.Thread): self.core_queue = core_queue self.connected = threading.Event() self.audio = AlsaController() + self.session = None def run(self): self.connect() @@ -219,9 +220,11 @@ class LibspotifySessionManager(SpotifySessionManager, threading.Thread): """Callback used by pyspotify""" logger.debug('Notify main thread') - def music_delivery(self, *args, **kwargs): + def music_delivery(self, session, frames, frame_size, num_frames, + sample_type, sample_rate, channels): """Callback used by pyspotify""" - self.audio.music_delivery(*args, **kwargs) + self.audio.music_delivery(session, frames, frame_size, num_frames, + sample_type, sample_rate, channels) def play_token_lost(self, session): """Callback used by pyspotify""" diff --git a/mopidy/mixers/nad.py b/mopidy/mixers/nad.py index d82a19a3..4aec79cd 100644 --- a/mopidy/mixers/nad.py +++ b/mopidy/mixers/nad.py @@ -80,6 +80,7 @@ class NadTalker(BaseProcess): def __init__(self, pipe=None): super(NadTalker, self).__init__() self.pipe = pipe + self._device = None def _run(self): self._open_connection() diff --git a/mopidy/mpd/frontend.py b/mopidy/mpd/frontend.py index 21d1752b..d7c21a31 100644 --- a/mopidy/mpd/frontend.py +++ b/mopidy/mpd/frontend.py @@ -53,6 +53,7 @@ class MpdFrontend(object): def __init__(self, backend=None): self.backend = backend self.command_list = False + self.command_list_ok = False def handle_request(self, request, add_ok=True): if self.command_list is not False and request != u'command_list_end': @@ -286,7 +287,7 @@ class MpdFrontend(object): songpos = int(songpos) track = self.backend.current_playlist.playlist.tracks[songpos] self.backend.current_playlist.remove(track) - except IndexError as e: + except IndexError: raise MpdAckError(u'Position out of bounds') @handle_pattern(r'^deleteid "(?P\d+)"$') diff --git a/mopidy/mpd/server.py b/mopidy/mpd/server.py index e6abb633..bd37c998 100644 --- a/mopidy/mpd/server.py +++ b/mopidy/mpd/server.py @@ -67,15 +67,15 @@ class MpdSession(asynchat.async_chat): def found_terminator(self): data = ''.join(self.input_buffer).strip() self.input_buffer = [] - input = data.decode(ENCODING) - logger.debug(u'Input: %s', indent(input)) - self.handle_request(input) + request = data.decode(ENCODING) + logger.debug(u'Input: %s', indent(request)) + self.handle_request(request) - def handle_request(self, input): + def handle_request(self, request): my_end, other_end = multiprocessing.Pipe() self.core_queue.put({ 'command': 'mpd_request', - 'request': input, + 'request': request, 'reply_to': pickle_connection(other_end), }) my_end.poll(None) diff --git a/mopidy/process.py b/mopidy/process.py index 9459f816..9e260438 100644 --- a/mopidy/process.py +++ b/mopidy/process.py @@ -26,6 +26,8 @@ class CoreProcess(BaseProcess): def __init__(self, core_queue): super(CoreProcess, self).__init__() self.core_queue = core_queue + self._backend = None + self._frontend = None def _run(self): self._setup() From e12874bb6ee18a8f1de190deaa270e9a7238397c Mon Sep 17 00:00:00 2001 From: Stein Magnus Jodal Date: Thu, 29 Apr 2010 23:52:52 +0200 Subject: [PATCH 2/4] Fix logging of exception message --- mopidy/process.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mopidy/process.py b/mopidy/process.py index 9e260438..d3c1d03e 100644 --- a/mopidy/process.py +++ b/mopidy/process.py @@ -14,8 +14,8 @@ class BaseProcess(multiprocessing.Process): except KeyboardInterrupt: logger.info(u'Interrupted by user') sys.exit(0) - except SettingsError, e: - logger.error(e) + except SettingsError as e: + logger.error(e.message) sys.exit(1) def _run(self): From 24e16fa003117654526f4500b5a3e1c614d647cc Mon Sep 17 00:00:00 2001 From: Stein Magnus Jodal Date: Thu, 29 Apr 2010 23:56:52 +0200 Subject: [PATCH 3/4] Update Mopidy+despotify install docs after trying them on a clean Ubuntu 10.04 installation --- docs/installation/despotify.rst | 4 +--- docs/installation/index.rst | 4 ++-- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/docs/installation/despotify.rst b/docs/installation/despotify.rst index b6053b16..07a3cd9a 100644 --- a/docs/installation/despotify.rst +++ b/docs/installation/despotify.rst @@ -16,7 +16,7 @@ Installing despotify *Linux:* Install despotify's dependencies. At Debian/Ubuntu systems:: sudo aptitude install libssl-dev zlib1g-dev libvorbis-dev \ - libtool libncursesw5-dev libao-dev + libtool libncursesw5-dev libao-dev python-dev *OS X:* In OS X you need to have `XCode `_ installed, and either `MacPorts @@ -46,7 +46,6 @@ file so that it reads:: *All OS:* Build and install despotify:: cd despotify/src/ - make sudo make install @@ -59,7 +58,6 @@ Build and install spytify:: cd despotify/src/bindings/python/ export PKG_CONFIG_PATH=../../lib # Needed on OS X - make sudo make install diff --git a/docs/installation/index.rst b/docs/installation/index.rst index bacefb77..6daae78f 100644 --- a/docs/installation/index.rst +++ b/docs/installation/index.rst @@ -46,8 +46,8 @@ Install latest release To install the currently latest release of Mopidy using ``pip``:: - sudo aptitude install python-pip # On Ubuntu/Debian - sudo brew install pip # On OS X + sudo aptitude install python-setuptools python-pip # On Ubuntu/Debian + sudo brew install pip # On OS X sudo pip install Mopidy To later upgrade to the latest release:: From 0b5fc83c90976c29fa7bee313cf419072565cb83 Mon Sep 17 00:00:00 2001 From: Stein Magnus Jodal Date: Thu, 29 Apr 2010 23:58:54 +0200 Subject: [PATCH 4/4] Add initial gstreamer install docs --- docs/installation/gstreamer.rst | 10 ++++++++++ docs/installation/index.rst | 7 ++++++- docs/installation/libspotify.rst | 2 ++ 3 files changed, 18 insertions(+), 1 deletion(-) create mode 100644 docs/installation/gstreamer.rst diff --git a/docs/installation/gstreamer.rst b/docs/installation/gstreamer.rst new file mode 100644 index 00000000..d8fc9029 --- /dev/null +++ b/docs/installation/gstreamer.rst @@ -0,0 +1,10 @@ +********************** +Gstreamer installation +********************** + +**TODO** Document Gstreamer installation on Linux, OS X and Windows. + +To install Gstreamer on OS X:: + + sudo port install py26-gst-python py26-gobject \ + gstreamer-plugins-good gstreamer-plugins-ugly diff --git a/docs/installation/index.rst b/docs/installation/index.rst index 6daae78f..d21b49ad 100644 --- a/docs/installation/index.rst +++ b/docs/installation/index.rst @@ -18,6 +18,7 @@ Dependencies despotify libspotify + gstreamer - Python >= 2.6 - Dependencies for at least one Mopidy mixer: @@ -36,10 +37,14 @@ Dependencies - see :doc:`despotify` - - LibspotifyBackend (Linux only) + - LibspotifyBackend (Linux, OS X and Windows) - see :doc:`libspotify` + - GstreamerBackend (Linux, OS X and Windows) + + - see :doc:`gstreamer` + Install latest release ====================== diff --git a/docs/installation/libspotify.rst b/docs/installation/libspotify.rst index 3dfd8f5a..5d2448f7 100644 --- a/docs/installation/libspotify.rst +++ b/docs/installation/libspotify.rst @@ -12,6 +12,8 @@ To use the libspotify backend you must install libspotify and This backend requires a Spotify premium account, and it requires you to get an application key from Spotify before use. +**TODO** Test and document installation on OS X. + Installing libspotify =====================