from __future__ import unicode_literals

import mopidy
from mopidy import ext


__doc__ = """A backend for playing music for streaming music.

This backend will handle streaming of URIs in
:attr:`mopidy.settings.STREAM_PROTOCOLS` assuming the right plugins are
installed.

**Issues:**

https://github.com/mopidy/mopidy/issues?labels=Stream+backend

**Dependencies:**

- None

**Settings:**

- :attr:`mopidy.settings.STREAM_PROTOCOLS`
"""


class Extension(ext.Extension):

    name = 'Mopidy-Stream'
    version = mopidy.__version__

    def get_default_config(self):
        return '[ext.stream]'

    def validate_config(self, config):
        pass

    def validate_environment(self):
        pass

    def get_backend_classes(self):
        from .actor import StreamBackend
        return [StreamBackend]

from __future__ import unicode_literals

import mopidy
from mopidy import ext
from mopidy.utils import config, formatting


default_config = """
[ext.stream]

# If the stream extension should be enabled or not
enabled = true

# Whitelist of URI schemas to support streaming from
protocols =
    http
    https
    mms
    rtmp
    rtmps
    rtsp
"""

__doc__ = """A backend for playing music for streaming music.

This backend will handle streaming of URIs in
:attr:`mopidy.settings.STREAM_PROTOCOLS` assuming the right plugins are
installed.

**Issues:**

https://github.com/mopidy/mopidy/issues?labels=Stream+backend

**Dependencies:**

- None

**Default config:**

.. code-block:: ini

%(config)s
""" % {'config': formatting.indent(default_config)}


class Extension(ext.Extension):

    name = 'Mopidy-Stream'
    version = mopidy.__version__

    def get_default_config(self):
        return default_config

    def get_config_schema(self):
        schema = config.ExtensionConfigSchema()
        schema['protocols'] = config.List()
        return schema

    def validate_environment(self):
        pass

    def get_backend_classes(self):
        from .actor import StreamBackend
        return [StreamBackend]

Add default config and config schema
stream: Add default config and config schema

  from __future__ import unicode_literals
  
  import mopidy
  from mopidy import ext
+ from mopidy.utils import config, formatting
  
+ 
+ default_config = """
+ [ext.stream]
+ 
+ # If the stream extension should be enabled or not
+ enabled = true
+ 
+ # Whitelist of URI schemas to support streaming from
+ protocols =
+     http
+     https
+     mms
+     rtmp
+     rtmps
+     rtsp
+ """
  
  __doc__ = """A backend for playing music for streaming music.
  
  This backend will handle streaming of URIs in
  :attr:`mopidy.settings.STREAM_PROTOCOLS` assuming the right plugins are
  installed.
  
  **Issues:**
  
  https://github.com/mopidy/mopidy/issues?labels=Stream+backend
  
  **Dependencies:**
  
  - None
  
- **Settings:**
+ **Default config:**
  
- - :attr:`mopidy.settings.STREAM_PROTOCOLS`
- """
+ .. code-block:: ini
+ 
+ %(config)s
+ """ % {'config': formatting.indent(default_config)}
  
  
  class Extension(ext.Extension):
  
      name = 'Mopidy-Stream'
      version = mopidy.__version__
  
      def get_default_config(self):
-         return '[ext.stream]'
+         return default_config
  
-     def validate_config(self, config):
-         pass
+     def get_config_schema(self):
+         schema = config.ExtensionConfigSchema()
+         schema['protocols'] = config.List()
+         return schema
  
      def validate_environment(self):
          pass
  
      def get_backend_classes(self):
          from .actor import StreamBackend
          return [StreamBackend]
  
Add default config and config schema
## Code Before:
from __future__ import unicode_literals

import mopidy
from mopidy import ext


__doc__ = """A backend for playing music for streaming music.

This backend will handle streaming of URIs in
:attr:`mopidy.settings.STREAM_PROTOCOLS` assuming the right plugins are
installed.

**Issues:**

https://github.com/mopidy/mopidy/issues?labels=Stream+backend

**Dependencies:**

- None

**Settings:**

- :attr:`mopidy.settings.STREAM_PROTOCOLS`
"""


class Extension(ext.Extension):

    name = 'Mopidy-Stream'
    version = mopidy.__version__

    def get_default_config(self):
        return '[ext.stream]'

    def validate_config(self, config):
        pass

    def validate_environment(self):
        pass

    def get_backend_classes(self):
        from .actor import StreamBackend
        return [StreamBackend]

## Instruction:
Add default config and config schema
## Code After:
from __future__ import unicode_literals

import mopidy
from mopidy import ext
from mopidy.utils import config, formatting


default_config = """
[ext.stream]

# If the stream extension should be enabled or not
enabled = true

# Whitelist of URI schemas to support streaming from
protocols =
    http
    https
    mms
    rtmp
    rtmps
    rtsp
"""

__doc__ = """A backend for playing music for streaming music.

This backend will handle streaming of URIs in
:attr:`mopidy.settings.STREAM_PROTOCOLS` assuming the right plugins are
installed.

**Issues:**

https://github.com/mopidy/mopidy/issues?labels=Stream+backend

**Dependencies:**

- None

**Default config:**

.. code-block:: ini

%(config)s
""" % {'config': formatting.indent(default_config)}


class Extension(ext.Extension):

    name = 'Mopidy-Stream'
    version = mopidy.__version__

    def get_default_config(self):
        return default_config

    def get_config_schema(self):
        schema = config.ExtensionConfigSchema()
        schema['protocols'] = config.List()
        return schema

    def validate_environment(self):
        pass

    def get_backend_classes(self):
        from .actor import StreamBackend
        return [StreamBackend]
