config: allow configuring partitions
This just allows creating empty partitions. More features to come.
This commit is contained in:
parent
64f84d5468
commit
199037c682
1
NEWS
1
NEWS
|
@ -15,6 +15,7 @@ ver 0.24 (not yet released)
|
|||
- new tag "Mood"
|
||||
* switch to C++20
|
||||
- GCC 10 or clang 11 (or newer) recommended
|
||||
* static partition configuration
|
||||
* remove Haiku support
|
||||
|
||||
ver 0.23.9 (not yet released)
|
||||
|
|
32
doc/user.rst
32
doc/user.rst
|
@ -297,6 +297,38 @@ configure this plugin, add a :code:`database` block to
|
|||
More information can be found in the :ref:`database_plugins`
|
||||
reference.
|
||||
|
||||
|
||||
Configuring Partitions
|
||||
----------------------
|
||||
|
||||
:program:`MPD` can have multiple "partitions", that is, multiple
|
||||
independent players, each with their own queue and outputs. All
|
||||
partitions share one database. By default, there is only one
|
||||
partition called "default". Additional partitions can be created in
|
||||
the configuration file with ``partition`` blocks or at runtime with
|
||||
the :ref:`newpartition <command_newpartition>` command.
|
||||
|
||||
Example for specifying an additional partition in the configuration
|
||||
file:
|
||||
|
||||
.. code-block:: none
|
||||
|
||||
partition {
|
||||
name "foo"
|
||||
}
|
||||
|
||||
The following options are available in ``partition`` blocks:
|
||||
|
||||
.. list-table::
|
||||
:widths: 20 80
|
||||
:header-rows: 1
|
||||
|
||||
* - Name
|
||||
- Description
|
||||
* - **name**
|
||||
- The name of the partition.
|
||||
|
||||
|
||||
Configuring neighbor plugins
|
||||
----------------------------
|
||||
|
||||
|
|
|
@ -410,6 +410,15 @@ MainConfigured(const CommandLineOptions &options,
|
|||
partition.UpdateEffectiveReplayGainMode();
|
||||
}
|
||||
|
||||
raw_config.WithEach(ConfigBlockOption::PARTITION, [&](const auto &block){
|
||||
const char *name = block.GetBlockValue("name");
|
||||
if (name == nullptr)
|
||||
throw std::runtime_error("Missing 'name'");
|
||||
|
||||
instance.partitions.emplace_back(instance, name,
|
||||
partition_config);
|
||||
});
|
||||
|
||||
client_manager_init(raw_config);
|
||||
const ScopeInputPluginsInit input_plugins_init(raw_config,
|
||||
instance.io_thread.GetEventLoop());
|
||||
|
|
|
@ -97,6 +97,7 @@ enum class ConfigBlockOption {
|
|||
AUDIO_FILTER,
|
||||
DATABASE,
|
||||
NEIGHBORS,
|
||||
PARTITION,
|
||||
MAX
|
||||
};
|
||||
|
||||
|
|
|
@ -96,6 +96,7 @@ const ConfigTemplate config_block_templates[] = {
|
|||
{ "filter", true },
|
||||
{ "database" },
|
||||
{ "neighbors", true },
|
||||
{ "partition", true },
|
||||
};
|
||||
|
||||
static constexpr unsigned n_config_block_templates =
|
||||
|
|
Loading…
Reference in New Issue