config/Param: split block-specific attributes to new struct ConfigBlock
The old struct config_param remains only for top-level string options.
This commit is contained in:
@@ -20,7 +20,7 @@
|
||||
#ifndef MPD_PLAYLIST_PLUGIN_HXX
|
||||
#define MPD_PLAYLIST_PLUGIN_HXX
|
||||
|
||||
struct config_param;
|
||||
struct ConfigBlock;
|
||||
class InputStream;
|
||||
struct Tag;
|
||||
class Mutex;
|
||||
@@ -38,7 +38,7 @@ struct playlist_plugin {
|
||||
* @return true if the plugin was initialized successfully,
|
||||
* false if the plugin is not available
|
||||
*/
|
||||
bool (*init)(const config_param ¶m);
|
||||
bool (*init)(const ConfigBlock &block);
|
||||
|
||||
/**
|
||||
* Deinitialize a plugin which was initialized successfully.
|
||||
@@ -75,10 +75,10 @@ struct playlist_plugin {
|
||||
*/
|
||||
static inline bool
|
||||
playlist_plugin_init(const struct playlist_plugin *plugin,
|
||||
const config_param ¶m)
|
||||
const ConfigBlock &block)
|
||||
{
|
||||
return plugin->init != nullptr
|
||||
? plugin->init(param)
|
||||
? plugin->init(block)
|
||||
: true;
|
||||
}
|
||||
|
||||
|
||||
@@ -36,7 +36,7 @@
|
||||
#include "util/Error.hxx"
|
||||
#include "util/Macros.hxx"
|
||||
#include "config/ConfigGlobal.hxx"
|
||||
#include "config/Param.hxx"
|
||||
#include "config/Block.hxx"
|
||||
#include "Log.hxx"
|
||||
|
||||
#include <assert.h>
|
||||
@@ -77,12 +77,12 @@ static bool playlist_plugins_enabled[n_playlist_plugins];
|
||||
void
|
||||
playlist_list_global_init(void)
|
||||
{
|
||||
const config_param empty;
|
||||
const ConfigBlock empty;
|
||||
|
||||
for (unsigned i = 0; playlist_plugins[i] != nullptr; ++i) {
|
||||
const struct playlist_plugin *plugin = playlist_plugins[i];
|
||||
const auto *param =
|
||||
config_find_block(ConfigOption::PLAYLIST_PLUGIN,
|
||||
config_find_block(ConfigBlockOption::PLAYLIST_PLUGIN,
|
||||
"name", plugin->name);
|
||||
if (param == nullptr)
|
||||
param = ∅
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
#include "SoundCloudPlaylistPlugin.hxx"
|
||||
#include "../PlaylistPlugin.hxx"
|
||||
#include "../MemorySongEnumerator.hxx"
|
||||
#include "config/Param.hxx"
|
||||
#include "config/Block.hxx"
|
||||
#include "input/InputStream.hxx"
|
||||
#include "tag/TagBuilder.hxx"
|
||||
#include "util/StringUtil.hxx"
|
||||
@@ -44,10 +44,10 @@ static struct {
|
||||
static constexpr Domain soundcloud_domain("soundcloud");
|
||||
|
||||
static bool
|
||||
soundcloud_init(const config_param ¶m)
|
||||
soundcloud_init(const ConfigBlock &block)
|
||||
{
|
||||
// APIKEY for MPD application, registered under DarkFox' account.
|
||||
soundcloud_config.apikey = param.GetBlockValue("apikey", "a25e51780f7f86af0afa91f241d091f8");
|
||||
soundcloud_config.apikey = block.GetBlockValue("apikey", "a25e51780f7f86af0afa91f241d091f8");
|
||||
if (soundcloud_config.apikey.empty()) {
|
||||
LogDebug(soundcloud_domain,
|
||||
"disabling the soundcloud playlist plugin "
|
||||
|
||||
Reference in New Issue
Block a user