diff --git a/docs/changelog.rst b/docs/changelog.rst index 18c45b79..66e27a6f 100644 --- a/docs/changelog.rst +++ b/docs/changelog.rst @@ -16,6 +16,15 @@ Feature release. new API introuced in v0.18 is now required. Most extensions already use the new API location. +**Commands** + +- The ``mopidy-convert-config`` tool for migrating the ``setings.py`` + configuration file used by Mopidy up until 0.14 to the new config file format + has been removed after almost a year of trusty service. If you still need to + convert your old ``settings.py`` configuration file, do so using and older + release, like Mopidy 0.18, or migrate the configuration to the new format by + hand. + **Extension support** - Removed the :class:`~mopidy.ext.Extension` methods that were deprecated in @@ -687,7 +696,7 @@ one new. To ease migration we've made a tool named :option:`mopidy-convert-config` for automatically converting the old ``settings.py`` to a new ``mopidy.conf`` file. This tool takes care of all the renamed config values as well. See - :ref:`mopidy-convert-config` for details on how to use it. + ``mopidy-convert-config`` for details on how to use it. - A long wanted feature: You can now enable or disable specific frontends or backends without having to redefine :attr:`~mopidy.settings.FRONTENDS` or diff --git a/docs/commands/mopidy-convert-config.rst b/docs/commands/mopidy-convert-config.rst deleted file mode 100644 index 83bb7ae3..00000000 --- a/docs/commands/mopidy-convert-config.rst +++ /dev/null @@ -1,98 +0,0 @@ -.. _mopidy-convert-config: - -***************************** -mopidy-convert-config command -***************************** - -Synopsis -======== - -mopidy-convert-config - - -Description -=========== - -Mopidy is a music server which can play music both from multiple sources, like -your local hard drive, radio streams, and from Spotify and SoundCloud. Searches -combines results from all music sources, and you can mix tracks from all -sources in your play queue. Your playlists from Spotify or SoundCloud are also -available for use. - -The ``mopidy-convert-config`` command is used to convert :file:`settings.py` -configuration files used by ``mopidy`` < 0.14 to the :file:`mopidy.conf` config -file used by ``mopidy`` >= 0.14. - - -Options -======= - -.. program:: mopidy-convert-config - -This program does not take any options. It looks for the pre-0.14 settings file -at :file:`{$XDG_CONFIG_DIR}/mopidy/settings.py`, and if it exists it converts -it and ouputs a Mopidy 0.14 compatible ini-format configuration. If you don't -already have a config file at :file:`{$XDG_CONFIG_DIR}/mopidy/mopidy.conf``, -you're asked if you want to save the converted config to that file. - - -Example -======= - -Given the following contents in :file:`~/.config/mopidy/settings.py`: - -:: - - LOCAL_MUSIC_PATH = u'~/music' - MPD_SERVER_HOSTNAME = u'::' - SPOTIFY_PASSWORD = u'secret' - SPOTIFY_USERNAME = u'alice' - -Running ``mopidy-convert-config`` will convert the config and create a new -:file:`mopidy.conf` config file: - -.. code-block:: none - - $ mopidy-convert-config - Checking /home/alice/.config/mopidy/settings.py - Converted config: - - [spotify] - username = alice - password = ******** - - [mpd] - hostname = :: - - [local] - media_dir = ~/music - - Write new config to /home/alice/.config/mopidy/mopidy.conf? [yN] y - Done. - -Contents of :file:`~/.config/mopidy/mopidy.conf` after the conversion: - -.. code-block:: ini - - [spotify] - username = alice - password = secret - - [mpd] - hostname = :: - - [local] - media_dir = ~/music - - -See also -======== - -:ref:`mopidy(1) ` - - -Reporting bugs -============== - -Report bugs to Mopidy's issue tracker at - diff --git a/docs/commands/mopidy.rst b/docs/commands/mopidy.rst index 75515a8d..5d733dc5 100644 --- a/docs/commands/mopidy.rst +++ b/docs/commands/mopidy.rst @@ -130,12 +130,6 @@ The ``mopidy config`` output shows the effect of the :option:`--option` flags:: mopidy -o mpd/enabled=false -o spotify/bitrate=320 config -See also -======== - -:ref:`mopidy-convert-config(1) ` - - Reporting bugs ============== diff --git a/docs/conf.py b/docs/conf.py index 737fb07a..860f2869 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -147,13 +147,6 @@ man_pages = [ '', '1' ), - ( - 'commands/mopidy-convert-config', - 'mopidy-convert-config', - 'migrate config files from mopidy pre-0.14', - '', - '1' - ), ] diff --git a/docs/config.rst b/docs/config.rst index d1752ba5..740b1f1e 100644 --- a/docs/config.rst +++ b/docs/config.rst @@ -40,14 +40,6 @@ below, together with their default values. In addition, all :ref:`extensions defaults are documented on the :ref:`extension pages `. -Migrating from pre 0.14 -======================= - -For those users upgrading from versions prior to 0.14 we made -the :option:`mopidy-convert-config` tool, to ease the process of migrating -settings to the new config format. - - Default core configuration ========================== diff --git a/mopidy/config/convert.py b/mopidy/config/convert.py deleted file mode 100644 index a3ae5273..00000000 --- a/mopidy/config/convert.py +++ /dev/null @@ -1,126 +0,0 @@ -from __future__ import print_function, unicode_literals - -import io -import os.path -import sys - -from mopidy import config as config_lib, ext -from mopidy.utils import path - - -def load(): - settings_file = path.expand_path(b'$XDG_CONFIG_DIR/mopidy/settings.py') - print('Checking %s' % settings_file) - - setting_globals = {} - try: - execfile(settings_file, setting_globals) - except Exception as e: - print('Problem loading settings: %s' % e) - return setting_globals - - -def convert(settings): - config = {} - - def helper(confval, setting_name): - if settings.get(setting_name) is not None: - section, key = confval.split('/') - config.setdefault(section, {})[key] = settings[setting_name] - - # Perform all the simple mappings using our helper: - - helper('logging/console_format', 'CONSOLE_LOG_FORMAT') - helper('logging/debug_format', 'DEBUG_LOG_FORMAT') - helper('logging/debug_file', 'DEBUG_LOG_FILENAME') - - helper('audio/mixer', 'MIXER') - helper('audio/mixer_track', 'MIXER_TRACK') - helper('audio/mixer_volume', 'MIXER_VOLUME') - helper('audio/output', 'OUTPUT') - - helper('proxy/hostname', 'SPOTIFY_PROXY_HOST') - helper('proxy/port', 'SPOTIFY_PROXY_PORT') - helper('proxy/username', 'SPOTIFY_PROXY_USERNAME') - helper('proxy/password', 'SPOTIFY_PROXY_PASSWORD') - - helper('local/media_dir', 'LOCAL_MUSIC_PATH') - helper('local/playlists_dir', 'LOCAL_PLAYLIST_PATH') - - helper('spotify/username', 'SPOTIFY_USERNAME') - helper('spotify/password', 'SPOTIFY_PASSWORD') - helper('spotify/bitrate', 'SPOTIFY_BITRATE') - helper('spotify/timeout', 'SPOTIFY_TIMEOUT') - helper('spotify/cache_dir', 'SPOTIFY_CACHE_PATH') - - helper('stream/protocols', 'STREAM_PROTOCOLS') - - helper('http/hostname', 'HTTP_SERVER_HOSTNAME') - helper('http/port', 'HTTP_SERVER_PORT') - helper('http/static_dir', 'HTTP_SERVER_STATIC_DIR') - - helper('mpd/hostname', 'MPD_SERVER_HOSTNAME') - helper('mpd/port', 'MPD_SERVER_PORT') - helper('mpd/password', 'MPD_SERVER_PASSWORD') - helper('mpd/max_connections', 'MPD_SERVER_MAX_CONNECTIONS') - helper('mpd/connection_timeout', 'MPD_SERVER_CONNECTION_TIMEOUT') - - helper('mpris/desktop_file', 'DESKTOP_FILE') - - helper('scrobbler/username', 'LASTFM_USERNAME') - helper('scrobbler/password', 'LASTFM_PASSWORD') - - # Assume FRONTENDS/BACKENDS = None implies all enabled, otherwise disable - # if our module path is missing from the setting. - - frontends = settings.get('FRONTENDS') - if frontends is not None: - if 'mopidy.frontends.http.HttpFrontend' not in frontends: - config.setdefault('http', {})['enabled'] = False - if 'mopidy.frontends.mpd.MpdFrontend' not in frontends: - config.setdefault('mpd', {})['enabled'] = False - if 'mopidy.frontends.lastfm.LastfmFrontend' not in frontends: - config.setdefault('scrobbler', {})['enabled'] = False - if 'mopidy.frontends.mpris.MprisFrontend' not in frontends: - config.setdefault('mpris', {})['enabled'] = False - - backends = settings.get('BACKENDS') - if backends is not None: - if 'mopidy.backends.local.LocalBackend' not in backends: - config.setdefault('local', {})['enabled'] = False - if 'mopidy.backends.spotify.SpotifyBackend' not in backends: - config.setdefault('spotify', {})['enabled'] = False - if 'mopidy.backends.stream.StreamBackend' not in backends: - config.setdefault('stream', {})['enabled'] = False - - return config - - -def main(): - settings = load() - if not settings: - return - - config = convert(settings) - - known = [ - 'spotify', 'scrobbler', 'mpd', 'mpris', 'local', 'stream', 'http'] - extensions = [e for e in ext.load_extensions() if e.ext_name in known] - - print(b'Converted config:\n') - print(config_lib.format(config, extensions)) - - conf_file = path.expand_path(b'$XDG_CONFIG_DIR/mopidy/mopidy.conf') - if os.path.exists(conf_file): - print('%s exists, exiting.' % conf_file) - sys.exit(1) - - print('Write new config to %s? [yN]' % conf_file, end=' ') - if raw_input() != 'y': - print('Not saving, exiting.') - sys.exit(0) - - serialized_config = config_lib.format(config, extensions, display=False) - with io.open(conf_file, 'wb') as filehandle: - filehandle.write(serialized_config) - print('Done.') diff --git a/setup.py b/setup.py index f3e20f4a..703615db 100644 --- a/setup.py +++ b/setup.py @@ -38,7 +38,6 @@ setup( entry_points={ 'console_scripts': [ 'mopidy = mopidy.__main__:main', - 'mopidy-convert-config = mopidy.config.convert:main', ], 'mopidy.ext': [ 'http = mopidy.http:Extension [http]',