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()