Update docs with latest OUTPUT changes and fix issues raised in review of pull request.
This commit is contained in:
parent
7948921510
commit
343207ebe2
@ -16,6 +16,10 @@ v0.8 (in development)
|
||||
|
||||
- Removed most traces of multiple outputs support. Having this feature
|
||||
currently seems to be more trouble than what it is worth.
|
||||
:attr:`mopidy.settings.OUTPUTS` setting is no longer supported, and has been
|
||||
replaced with :attr:`mopidy.settings.OUTPUT` which is a GStreamer
|
||||
bin descriped in the same format as gst-launch expects. Default value is
|
||||
``autoaudiosink``.
|
||||
|
||||
|
||||
v0.7.3 (2012-08-11)
|
||||
|
||||
@ -112,12 +112,9 @@ Using a custom audio sink
|
||||
=========================
|
||||
|
||||
If you for some reason want to use some other GStreamer audio sink than
|
||||
``autoaudiosink``, you can set :attr:`mopidy.settings.OUTPUTS` to
|
||||
``mopidy.outputs.custom.CustomOutput``, and set the
|
||||
:attr:`mopidy.settings.CUSTOM_OUTPUT` setting to a partial GStreamer pipeline
|
||||
description describing the GStreamer sink you want to use.
|
||||
``autoaudiosink``, you can set :attr:`mopidy.settings.OUTPUT` to a partial
|
||||
GStreamer pipeline description describing the GStreamer sink you want to use.
|
||||
|
||||
Example of ``settings.py`` for OSS4::
|
||||
|
||||
OUTPUTS = (u'mopidy.outputs.custom.CustomOutput',)
|
||||
CUSTOM_OUTPUT = u'oss4sink'
|
||||
OUTPUT = u'oss4sink'
|
||||
|
||||
@ -157,18 +157,17 @@ server simultaneously. To use the SHOUTcast output, do the following:
|
||||
#. Install, configure and start the Icecast server. It can be found in the
|
||||
``icecast2`` package in Debian/Ubuntu.
|
||||
|
||||
#. Set ``mopidy.outputs.shoutcast.ShoutcastOutput`` as the first output in the
|
||||
:attr:`mopidy.settings.OUTPUTS` setting.
|
||||
#. Set :attr:`mopidy.settings.OUTPUT` to ``lame ! shout2send`` (an ogg-vorbis
|
||||
encoder could be used instead of lame).
|
||||
|
||||
#. Check the default values for the following settings, and alter them to match
|
||||
your Icecast setup if needed:
|
||||
#. You might also need to change the shout2send default settings, run
|
||||
``gst-inspect-0.10 shout2send`` to see the available settings. Most likely
|
||||
you want to change ``ip``, ``username``, ``password`` and ``mount``. For
|
||||
example, to set the password use: ``lame ! shout2send password="s3cret"``.
|
||||
|
||||
- :attr:`mopidy.settings.SHOUTCAST_OUTPUT_HOSTNAME`
|
||||
- :attr:`mopidy.settings.SHOUTCAST_OUTPUT_PORT`
|
||||
- :attr:`mopidy.settings.SHOUTCAST_OUTPUT_USERNAME`
|
||||
- :attr:`mopidy.settings.SHOUTCAST_OUTPUT_PASSWORD`
|
||||
- :attr:`mopidy.settings.SHOUTCAST_OUTPUT_MOUNT`
|
||||
- :attr:`mopidy.settings.SHOUTCAST_OUTPUT_ENCODER`
|
||||
Other advanced setups are also possible for outputs. Basically anything you can
|
||||
get a gst-lauch command to output to can be plugged into
|
||||
:attr:`mopidy.settings.OUTPUT``.
|
||||
|
||||
|
||||
Available settings
|
||||
|
||||
@ -1,96 +0,0 @@
|
||||
import pygst
|
||||
pygst.require('0.10')
|
||||
import gst
|
||||
|
||||
from mopidy import settings
|
||||
|
||||
|
||||
def custom():
|
||||
"""
|
||||
Custom output for using alternate setups.
|
||||
|
||||
This output is intended to handle two main cases:
|
||||
|
||||
1. Simple things like switching which sink to use. Say :class:`LocalOutput`
|
||||
doesn't work for you and you want to switch to ALSA, simple. Set
|
||||
:attr:`mopidy.settings.CUSTOM_OUTPUT` to ``alsasink`` and you are good
|
||||
to go. Some possible sinks include:
|
||||
|
||||
- alsasink
|
||||
- osssink
|
||||
- pulsesink
|
||||
- ...and many more
|
||||
|
||||
2. Advanced setups that require complete control of the output bin. For
|
||||
these cases setup :attr:`mopidy.settings.CUSTOM_OUTPUT` with a
|
||||
:command:`gst-launch` compatible string describing the target setup.
|
||||
|
||||
**Dependencies:**
|
||||
|
||||
- None
|
||||
|
||||
**Settings:**
|
||||
|
||||
- :attr:`mopidy.settings.CUSTOM_OUTPUT`
|
||||
"""
|
||||
return gst.parse_bin_from_description(settings.CUSTOM_OUTPUT, True)
|
||||
|
||||
|
||||
def local():
|
||||
"""
|
||||
Basic output to local audio sink.
|
||||
|
||||
This output will normally tell GStreamer to choose whatever it thinks is
|
||||
best for your system. In other words this is usually a sane choice.
|
||||
|
||||
**Dependencies:**
|
||||
|
||||
- None
|
||||
|
||||
**Settings:**
|
||||
|
||||
- None
|
||||
"""
|
||||
return gst.parse_bin_from_description('autoaudiosink', True)
|
||||
|
||||
|
||||
def shoutcast():
|
||||
"""
|
||||
Shoutcast streaming output.
|
||||
|
||||
This output allows for streaming to an icecast server or anything else that
|
||||
supports Shoutcast. The output supports setting for: server address, port,
|
||||
mount point, user, password and encoder to use. Please see
|
||||
:class:`mopidy.settings` for details about settings.
|
||||
|
||||
**Dependencies:**
|
||||
|
||||
- A SHOUTcast/Icecast server
|
||||
|
||||
**Settings:**
|
||||
|
||||
- :attr:`mopidy.settings.SHOUTCAST_OUTPUT_HOSTNAME`
|
||||
- :attr:`mopidy.settings.SHOUTCAST_OUTPUT_PORT`
|
||||
- :attr:`mopidy.settings.SHOUTCAST_OUTPUT_USERNAME`
|
||||
- :attr:`mopidy.settings.SHOUTCAST_OUTPUT_PASSWORD`
|
||||
- :attr:`mopidy.settings.SHOUTCAST_OUTPUT_MOUNT`
|
||||
- :attr:`mopidy.settings.SHOUTCAST_OUTPUT_ENCODER`
|
||||
"""
|
||||
encoder = settings.SHOUTCAST_OUTPUT_ENCODER
|
||||
output = gst.parse_bin_from_description(
|
||||
'%s ! shout2send name=shoutcast' % encoder, True)
|
||||
|
||||
shoutcast = output.get_by_name('shoutcast')
|
||||
|
||||
properties = {
|
||||
u'ip': settings.SHOUTCAST_OUTPUT_HOSTNAME,
|
||||
u'port': settings.SHOUTCAST_OUTPUT_PORT,
|
||||
u'mount': settings.SHOUTCAST_OUTPUT_MOUNT,
|
||||
u'username': settings.SHOUTCAST_OUTPUT_USERNAME,
|
||||
u'password': settings.SHOUTCAST_OUTPUT_PASSWORD,
|
||||
}
|
||||
|
||||
for name, value in properties.items():
|
||||
shoutcast.set_property(name, value)
|
||||
|
||||
return output
|
||||
@ -26,14 +26,6 @@ BACKENDS = (
|
||||
#: details on the format.
|
||||
CONSOLE_LOG_FORMAT = u'%(levelname)-8s %(message)s'
|
||||
|
||||
#: Which GStreamer bin description to use in
|
||||
#: :class:`mopidy.outputs.custom.CustomOutput`.
|
||||
#:
|
||||
#: Default::
|
||||
#:
|
||||
#: CUSTOM_OUTPUT = u'fakesink'
|
||||
CUSTOM_OUTPUT = u'fakesink'
|
||||
|
||||
#: The log format used for debug logging.
|
||||
#:
|
||||
#: See http://docs.python.org/library/logging.html#formatter-objects for
|
||||
|
||||
@ -22,24 +22,18 @@ def import_module(name):
|
||||
return sys.modules[name]
|
||||
|
||||
|
||||
def _get_obj(name):
|
||||
def get_class(name):
|
||||
logger.debug('Loading: %s', name)
|
||||
if '.' not in name:
|
||||
raise ImportError("Couldn't load: %s" % name)
|
||||
module_name = name[:name.rindex('.')]
|
||||
obj_name = name[name.rindex('.') + 1:]
|
||||
cls_name = name[name.rindex('.') + 1:]
|
||||
try:
|
||||
module = import_module(module_name)
|
||||
obj = getattr(module, obj_name)
|
||||
cls = getattr(module, cls_name)
|
||||
except (ImportError, AttributeError):
|
||||
raise ImportError("Couldn't load: %s" % name)
|
||||
return obj
|
||||
|
||||
|
||||
# We provide both get_class and get_function to make it more obvious what the
|
||||
# intent of our code really is.
|
||||
get_class = _get_obj
|
||||
get_function = _get_obj
|
||||
return cls
|
||||
|
||||
|
||||
def locale_decode(bytestr):
|
||||
|
||||
@ -112,6 +112,7 @@ def validate_settings(defaults, settings):
|
||||
errors = {}
|
||||
|
||||
changed = {
|
||||
'CUSTOM_OUTPUT': 'OUTPUT',
|
||||
'DUMP_LOG_FILENAME': 'DEBUG_LOG_FILENAME',
|
||||
'DUMP_LOG_FORMAT': 'DEBUG_LOG_FORMAT',
|
||||
'FRONTEND': 'FRONTENDS',
|
||||
@ -139,20 +140,23 @@ def validate_settings(defaults, settings):
|
||||
|
||||
if setting == 'BACKENDS':
|
||||
if 'mopidy.backends.despotify.DespotifyBackend' in value:
|
||||
errors[setting] = (u'Deprecated setting value. '
|
||||
errors[setting] = (
|
||||
u'Deprecated setting value. '
|
||||
u'"mopidy.backends.despotify.DespotifyBackend" is no '
|
||||
u'longer available.')
|
||||
continue
|
||||
|
||||
if setting == 'OUTPUTS':
|
||||
errors[setting] = (u'Deprecated setting, please change to OUTPUT. '
|
||||
u'Please note that output values have also changed.')
|
||||
errors[setting] = (
|
||||
u'Deprecated setting, please change to OUTPUT. OUTPUT expectes '
|
||||
u'a GStreamer bin describing your desired output.')
|
||||
continue
|
||||
|
||||
if setting == 'SPOTIFY_BITRATE':
|
||||
if value not in (96, 160, 320):
|
||||
errors[setting] = (u'Unavailable Spotify bitrate. ' +
|
||||
u'Available bitrates are 96, 160, and 320.')
|
||||
errors[setting] = (
|
||||
u'Unavailable Spotify bitrate. Available bitrates are 96, '
|
||||
u'160, and 320.')
|
||||
|
||||
if setting not in defaults:
|
||||
errors[setting] = u'Unknown setting. Is it misspelled?'
|
||||
|
||||
Loading…
Reference in New Issue
Block a user