Merge branch 'gstreamer' of git://github.com/jodal/mopidy into singlerepeat
This commit is contained in:
commit
ffd4bebba3
@ -53,12 +53,14 @@ greatly improved MPD client support.
|
|||||||
- Fix ``playlistfind`` output so the correct song is played when playing
|
- Fix ``playlistfind`` output so the correct song is played when playing
|
||||||
songs directly from search results in GMPC.
|
songs directly from search results in GMPC.
|
||||||
- Fix ``load`` so that one can append a playlist to the current playlist.
|
- Fix ``load`` so that one can append a playlist to the current playlist.
|
||||||
|
- Support for single track repeat added. (Fixes: :issue:`4`)
|
||||||
|
|
||||||
- Backends:
|
- Backends:
|
||||||
|
|
||||||
- Rename :mod:`mopidy.backends.gstreamer` to :mod:`mopidy.backends.local`.
|
- Rename :mod:`mopidy.backends.gstreamer` to :mod:`mopidy.backends.local`.
|
||||||
- Remove :mod:`mopidy.backends.despotify`, as Despotify is little maintained
|
- Remove :mod:`mopidy.backends.despotify`, as Despotify is little maintained
|
||||||
and the Libspotify backend is working much better.
|
and the Libspotify backend is working much better. (Fixes: :issue:`9`,
|
||||||
|
:issue:`10`, :issue:`13`)
|
||||||
- Rename ``mopidy.frontends.mpd.{serializer => translator}`` to match naming
|
- Rename ``mopidy.frontends.mpd.{serializer => translator}`` to match naming
|
||||||
in backends.
|
in backends.
|
||||||
|
|
||||||
|
|||||||
@ -65,6 +65,8 @@ Install pyspotify's dependencies. At Debian/Ubuntu systems::
|
|||||||
|
|
||||||
sudo aptitude install python-dev
|
sudo aptitude install python-dev
|
||||||
|
|
||||||
|
In OS X no additional dependencies are needed.
|
||||||
|
|
||||||
Check out the pyspotify code, and install it::
|
Check out the pyspotify code, and install it::
|
||||||
|
|
||||||
git clone git://github.com/jodal/pyspotify.git
|
git clone git://github.com/jodal/pyspotify.git
|
||||||
|
|||||||
@ -42,8 +42,11 @@ class GStreamerProcess(BaseProcess):
|
|||||||
http://jameswestby.net/weblog/tech/14-caution-python-multiprocessing-and-glib-dont-mix.html.
|
http://jameswestby.net/weblog/tech/14-caution-python-multiprocessing-and-glib-dont-mix.html.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
pipeline_description = \
|
pipeline_description = ' ! '.join([
|
||||||
'appsrc name=data ! volume name=volume ! autoaudiosink name=sink'
|
'appsrc name=src',
|
||||||
|
'volume name=volume',
|
||||||
|
'autoaudiosink name=sink',
|
||||||
|
])
|
||||||
|
|
||||||
def __init__(self, core_queue, output_queue):
|
def __init__(self, core_queue, output_queue):
|
||||||
super(GStreamerProcess, self).__init__()
|
super(GStreamerProcess, self).__init__()
|
||||||
@ -52,10 +55,9 @@ class GStreamerProcess(BaseProcess):
|
|||||||
self.gst_pipeline = None
|
self.gst_pipeline = None
|
||||||
self.gst_bus = None
|
self.gst_bus = None
|
||||||
self.gst_bus_id = None
|
self.gst_bus_id = None
|
||||||
self.gst_uri_src = None
|
self.gst_uri_bin = None
|
||||||
self.gst_data_src = None
|
self.gst_data_src = None
|
||||||
self.gst_volume = None
|
self.gst_volume = None
|
||||||
self.gst_sink = None
|
|
||||||
|
|
||||||
def run_inside_try(self):
|
def run_inside_try(self):
|
||||||
self.setup()
|
self.setup()
|
||||||
@ -72,9 +74,9 @@ class GStreamerProcess(BaseProcess):
|
|||||||
messages_thread.start()
|
messages_thread.start()
|
||||||
|
|
||||||
self.gst_pipeline = gst.parse_launch(self.pipeline_description)
|
self.gst_pipeline = gst.parse_launch(self.pipeline_description)
|
||||||
self.gst_data_src = self.gst_pipeline.get_by_name('data')
|
self.gst_data_src = self.gst_pipeline.get_by_name('src')
|
||||||
|
#self.gst_uri_bin = self.gst_pipeline.get_by_name('uri')
|
||||||
self.gst_volume = self.gst_pipeline.get_by_name('volume')
|
self.gst_volume = self.gst_pipeline.get_by_name('volume')
|
||||||
self.gst_sink = self.gst_pipeline.get_by_name('sink')
|
|
||||||
|
|
||||||
# Setup bus and message processor
|
# Setup bus and message processor
|
||||||
self.gst_bus = self.gst_pipeline.get_bus()
|
self.gst_bus = self.gst_pipeline.get_bus()
|
||||||
@ -121,9 +123,8 @@ class GStreamerProcess(BaseProcess):
|
|||||||
def play_uri(self, uri):
|
def play_uri(self, uri):
|
||||||
"""Play audio at URI"""
|
"""Play audio at URI"""
|
||||||
self.set_state('READY')
|
self.set_state('READY')
|
||||||
self.gst_uri_src.set_property('uri', uri)
|
self.gst_uri_bin.set_property('uri', uri)
|
||||||
self.set_state('PLAYING')
|
return self.set_state('PLAYING')
|
||||||
# TODO Return status
|
|
||||||
|
|
||||||
def deliver_data(self, caps_string, data):
|
def deliver_data(self, caps_string, data):
|
||||||
"""Deliver audio data to be played"""
|
"""Deliver audio data to be played"""
|
||||||
|
|||||||
@ -19,6 +19,7 @@ from tests import SkipTest, data_folder
|
|||||||
song = data_folder('song%s.wav')
|
song = data_folder('song%s.wav')
|
||||||
generate_song = lambda i: path_to_uri(song % i)
|
generate_song = lambda i: path_to_uri(song % i)
|
||||||
|
|
||||||
|
raise SkipTest
|
||||||
|
|
||||||
# FIXME can be switched to generic test
|
# FIXME can be switched to generic test
|
||||||
class LocalCurrentPlaylistControllerTest(BaseCurrentPlaylistControllerTest,
|
class LocalCurrentPlaylistControllerTest(BaseCurrentPlaylistControllerTest,
|
||||||
|
|||||||
0
tests/outputs/__init__.py
Normal file
0
tests/outputs/__init__.py
Normal file
58
tests/outputs/gstreamer_test.py
Normal file
58
tests/outputs/gstreamer_test.py
Normal file
@ -0,0 +1,58 @@
|
|||||||
|
import multiprocessing
|
||||||
|
import unittest
|
||||||
|
|
||||||
|
from mopidy.utils import path_to_uri
|
||||||
|
from mopidy.process import pickle_connection
|
||||||
|
from mopidy.outputs.gstreamer import GStreamerOutput
|
||||||
|
|
||||||
|
from tests import data_folder, SkipTest
|
||||||
|
|
||||||
|
class GStreamerOutputTest(unittest.TestCase):
|
||||||
|
def setUp(self):
|
||||||
|
self.song_uri = path_to_uri(data_folder('song1.wav'))
|
||||||
|
self.output_queue = multiprocessing.Queue()
|
||||||
|
self.core_queue = multiprocessing.Queue()
|
||||||
|
self.output = GStreamerOutput(self.core_queue, self.output_queue)
|
||||||
|
|
||||||
|
def tearDown(self):
|
||||||
|
self.output.destroy()
|
||||||
|
|
||||||
|
def send_recv(self, message):
|
||||||
|
(my_end, other_end) = multiprocessing.Pipe()
|
||||||
|
message.update({'reply_to': pickle_connection(other_end)})
|
||||||
|
self.output_queue.put(message)
|
||||||
|
my_end.poll(None)
|
||||||
|
return my_end.recv()
|
||||||
|
|
||||||
|
def send(self, message):
|
||||||
|
self.output_queue.put(message)
|
||||||
|
|
||||||
|
@SkipTest
|
||||||
|
def test_play_uri_existing_file(self):
|
||||||
|
message = {'command': 'play_uri', 'uri': self.song_uri}
|
||||||
|
self.assertEqual(True, self.send_recv(message))
|
||||||
|
|
||||||
|
@SkipTest
|
||||||
|
def test_play_uri_non_existing_file(self):
|
||||||
|
message = {'command': 'play_uri', 'uri': self.song_uri + 'bogus'}
|
||||||
|
self.assertEqual(False, self.send_recv(message))
|
||||||
|
|
||||||
|
def test_default_get_volume_result(self):
|
||||||
|
message = {'command': 'get_volume'}
|
||||||
|
self.assertEqual(100, self.send_recv(message))
|
||||||
|
|
||||||
|
def test_set_volume(self):
|
||||||
|
self.send({'command': 'set_volume', 'volume': 50})
|
||||||
|
self.assertEqual(50, self.send_recv({'command': 'get_volume'}))
|
||||||
|
|
||||||
|
def test_set_volume_to_zero(self):
|
||||||
|
self.send({'command': 'set_volume', 'volume': 0})
|
||||||
|
self.assertEqual(0, self.send_recv({'command': 'get_volume'}))
|
||||||
|
|
||||||
|
def test_set_volume_to_one_hundred(self):
|
||||||
|
self.send({'command': 'set_volume', 'volume': 100})
|
||||||
|
self.assertEqual(100, self.send_recv({'command': 'get_volume'}))
|
||||||
|
|
||||||
|
@SkipTest
|
||||||
|
def test_set_state(self):
|
||||||
|
raise NotImplementedError
|
||||||
Loading…
Reference in New Issue
Block a user