audio: Use pbutils to provide usable plugin missing info
This commit is contained in:
parent
fb8b02cee9
commit
88788fddfd
@ -7,6 +7,7 @@ import gobject
|
|||||||
import pygst
|
import pygst
|
||||||
pygst.require('0.10')
|
pygst.require('0.10')
|
||||||
import gst # noqa
|
import gst # noqa
|
||||||
|
import gst.pbutils
|
||||||
|
|
||||||
import pykka
|
import pykka
|
||||||
|
|
||||||
@ -341,6 +342,8 @@ class Audio(pykka.ThreadingActor):
|
|||||||
elif msg.type == gst.MESSAGE_ELEMENT:
|
elif msg.type == gst.MESSAGE_ELEMENT:
|
||||||
if msg.structure.has_name('playbin2-stream-changed'):
|
if msg.structure.has_name('playbin2-stream-changed'):
|
||||||
self._on_stream_changed(msg.structure['uri'])
|
self._on_stream_changed(msg.structure['uri'])
|
||||||
|
elif gst.pbutils.is_missing_plugin_message(msg):
|
||||||
|
self._on_missing_plugin(msg)
|
||||||
|
|
||||||
def _on_playbin_state_changed(self, old_state, new_state, pending_state):
|
def _on_playbin_state_changed(self, old_state, new_state, pending_state):
|
||||||
if new_state == gst.STATE_READY and pending_state == gst.STATE_NULL:
|
if new_state == gst.STATE_READY and pending_state == gst.STATE_NULL:
|
||||||
@ -401,6 +404,17 @@ class Audio(pykka.ThreadingActor):
|
|||||||
logger.debug('Triggering event: stream_changed(uri=%s)', uri)
|
logger.debug('Triggering event: stream_changed(uri=%s)', uri)
|
||||||
AudioListener.send('stream_changed', uri=uri)
|
AudioListener.send('stream_changed', uri=uri)
|
||||||
|
|
||||||
|
def _on_missing_plugin(self, msg):
|
||||||
|
desc = gst.pbutils.missing_plugin_message_get_description(msg)
|
||||||
|
debug = gst.pbutils.missing_plugin_message_get_installer_detail(msg)
|
||||||
|
logger.warning('Could not find a %s to handle media.', desc)
|
||||||
|
if gst.pbutils.install_plugins_supported():
|
||||||
|
logger.info('You might be able to fix this by running: '
|
||||||
|
'gst-installer "%s"', debug)
|
||||||
|
# TODO: store the missing plugins installer info in a file so we can
|
||||||
|
# can provide a 'mopidy install-missing-plugins' if the system has the
|
||||||
|
# required helper installed?
|
||||||
|
|
||||||
def set_uri(self, uri):
|
def set_uri(self, uri):
|
||||||
"""
|
"""
|
||||||
Set URI of audio to be played.
|
Set URI of audio to be played.
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user