Merge branch 'master' into gstreamer

This commit is contained in:
Thomas Adamcik 2010-05-01 01:58:33 +02:00
commit 89d06a4de3
11 changed files with 43 additions and 19 deletions

View File

@ -16,7 +16,7 @@ Installing despotify
*Linux:* Install despotify's dependencies. At Debian/Ubuntu systems:: *Linux:* Install despotify's dependencies. At Debian/Ubuntu systems::
sudo aptitude install libssl-dev zlib1g-dev libvorbis-dev \ 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 *OS X:* In OS X you need to have `XCode
<http://developer.apple.com/tools/xcode/>`_ installed, and either `MacPorts <http://developer.apple.com/tools/xcode/>`_ installed, and either `MacPorts
@ -46,7 +46,6 @@ file so that it reads::
*All OS:* Build and install despotify:: *All OS:* Build and install despotify::
cd despotify/src/ cd despotify/src/
make
sudo make install sudo make install
@ -59,7 +58,6 @@ Build and install spytify::
cd despotify/src/bindings/python/ cd despotify/src/bindings/python/
export PKG_CONFIG_PATH=../../lib # Needed on OS X export PKG_CONFIG_PATH=../../lib # Needed on OS X
make
sudo make install sudo make install

View File

@ -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

View File

@ -18,6 +18,7 @@ Dependencies
despotify despotify
libspotify libspotify
gstreamer
- Python >= 2.6 - Python >= 2.6
- Dependencies for at least one Mopidy mixer: - Dependencies for at least one Mopidy mixer:
@ -36,18 +37,22 @@ Dependencies
- see :doc:`despotify` - see :doc:`despotify`
- LibspotifyBackend (Linux only) - LibspotifyBackend (Linux, OS X and Windows)
- see :doc:`libspotify` - see :doc:`libspotify`
- GstreamerBackend (Linux, OS X and Windows)
- see :doc:`gstreamer`
Install latest release Install latest release
====================== ======================
To install the currently latest release of Mopidy using ``pip``:: To install the currently latest release of Mopidy using ``pip``::
sudo aptitude install python-pip # On Ubuntu/Debian sudo aptitude install python-setuptools python-pip # On Ubuntu/Debian
sudo brew install pip # On OS X sudo brew install pip # On OS X
sudo pip install Mopidy sudo pip install Mopidy
To later upgrade to the latest release:: To later upgrade to the latest release::

View File

@ -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 This backend requires a Spotify premium account, and it requires you to get
an application key from Spotify before use. an application key from Spotify before use.
**TODO** Test and document installation on OS X.
Installing libspotify Installing libspotify
===================== =====================

View File

@ -104,7 +104,7 @@ class BaseCurrentPlaylistController(object):
tracks = self.playlist.tracks tracks = self.playlist.tracks
assert at_position <= len(tracks), 'at_position can not be greater' \ assert at_position <= len(tracks), 'at_position can not be greater' \
+ ' than playlist length' + ' than playlist length'
if at_position is not None: if at_position is not None:
tracks.insert(at_position, track) tracks.insert(at_position, track)
@ -337,6 +337,8 @@ class BasePlaybackController(object):
self._state = self.STOPPED self._state = self.STOPPED
self._shuffled = [] self._shuffled = []
self._first_shuffle = True self._first_shuffle = True
self._play_time_accumulated = 0
self._play_time_started = None
@property @property
def next_track(self): def next_track(self):

View File

@ -36,7 +36,7 @@ class DummyLibraryController(BaseLibraryController):
find_exact = search find_exact = search
class DummyPlaybackController(BasePlaybackController): class DummyPlaybackController(BasePlaybackController):
def _next(self): def _next(self, track):
return True return True
def _pause(self): def _pause(self):
@ -45,7 +45,7 @@ class DummyPlaybackController(BasePlaybackController):
def _play(self, track): def _play(self, track):
return True return True
def _previous(self): def _previous(self, track):
return True return True
def _resume(self): def _resume(self):

View File

@ -181,6 +181,7 @@ class LibspotifySessionManager(SpotifySessionManager, threading.Thread):
self.core_queue = core_queue self.core_queue = core_queue
self.connected = threading.Event() self.connected = threading.Event()
self.audio = AlsaController() self.audio = AlsaController()
self.session = None
def run(self): def run(self):
self.connect() self.connect()
@ -219,9 +220,11 @@ class LibspotifySessionManager(SpotifySessionManager, threading.Thread):
"""Callback used by pyspotify""" """Callback used by pyspotify"""
logger.debug('Notify main thread') 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""" """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): def play_token_lost(self, session):
"""Callback used by pyspotify""" """Callback used by pyspotify"""

View File

@ -80,6 +80,7 @@ class NadTalker(BaseProcess):
def __init__(self, pipe=None): def __init__(self, pipe=None):
super(NadTalker, self).__init__() super(NadTalker, self).__init__()
self.pipe = pipe self.pipe = pipe
self._device = None
def _run(self): def _run(self):
self._open_connection() self._open_connection()

View File

@ -53,6 +53,7 @@ class MpdFrontend(object):
def __init__(self, backend=None): def __init__(self, backend=None):
self.backend = backend self.backend = backend
self.command_list = False self.command_list = False
self.command_list_ok = False
def handle_request(self, request, add_ok=True): def handle_request(self, request, add_ok=True):
if self.command_list is not False and request != u'command_list_end': if self.command_list is not False and request != u'command_list_end':
@ -286,7 +287,7 @@ class MpdFrontend(object):
songpos = int(songpos) songpos = int(songpos)
track = self.backend.current_playlist.playlist.tracks[songpos] track = self.backend.current_playlist.playlist.tracks[songpos]
self.backend.current_playlist.remove(track) self.backend.current_playlist.remove(track)
except IndexError as e: except IndexError:
raise MpdAckError(u'Position out of bounds') raise MpdAckError(u'Position out of bounds')
@handle_pattern(r'^deleteid "(?P<songid>\d+)"$') @handle_pattern(r'^deleteid "(?P<songid>\d+)"$')

View File

@ -67,15 +67,15 @@ class MpdSession(asynchat.async_chat):
def found_terminator(self): def found_terminator(self):
data = ''.join(self.input_buffer).strip() data = ''.join(self.input_buffer).strip()
self.input_buffer = [] self.input_buffer = []
input = data.decode(ENCODING) request = data.decode(ENCODING)
logger.debug(u'Input: %s', indent(input)) logger.debug(u'Input: %s', indent(request))
self.handle_request(input) self.handle_request(request)
def handle_request(self, input): def handle_request(self, request):
my_end, other_end = multiprocessing.Pipe() my_end, other_end = multiprocessing.Pipe()
self.core_queue.put({ self.core_queue.put({
'command': 'mpd_request', 'command': 'mpd_request',
'request': input, 'request': request,
'reply_to': pickle_connection(other_end), 'reply_to': pickle_connection(other_end),
}) })
my_end.poll(None) my_end.poll(None)

View File

@ -14,8 +14,8 @@ class BaseProcess(multiprocessing.Process):
except KeyboardInterrupt: except KeyboardInterrupt:
logger.info(u'Interrupted by user') logger.info(u'Interrupted by user')
sys.exit(0) sys.exit(0)
except SettingsError, e: except SettingsError as e:
logger.error(e) logger.error(e.message)
sys.exit(1) sys.exit(1)
def _run(self): def _run(self):
@ -26,6 +26,8 @@ class CoreProcess(BaseProcess):
def __init__(self, core_queue): def __init__(self, core_queue):
super(CoreProcess, self).__init__() super(CoreProcess, self).__init__()
self.core_queue = core_queue self.core_queue = core_queue
self._backend = None
self._frontend = None
def _run(self): def _run(self):
self._setup() self._setup()