diff options
author | Max Kellermann <max@duempel.org> | 2014-02-08 00:04:29 +0100 |
---|---|---|
committer | Max Kellermann <max@duempel.org> | 2014-02-08 00:04:29 +0100 |
commit | 3fdc678aae362b262c50636a8a5e6851f37eed4c (patch) | |
tree | f242194cf8c1c047f094b2962848ab7a4a0c52e6 | |
parent | a0088ccce1749dbef6503fbf489f7096d824c11d (diff) | |
download | mpd-3fdc678aae362b262c50636a8a5e6851f37eed4c.tar.gz mpd-3fdc678aae362b262c50636a8a5e6851f37eed4c.tar.xz mpd-3fdc678aae362b262c50636a8a5e6851f37eed4c.zip |
Main: support arbitrary storage plugins
Diffstat (limited to '')
-rw-r--r-- | NEWS | 3 | ||||
-rw-r--r-- | src/Main.cxx | 12 |
2 files changed, 15 insertions, 0 deletions
@@ -8,6 +8,9 @@ ver 0.19 (not yet released) - proxy: forward "idle" events - proxy: copy "Last-Modified" from remote directories - upnp: new plugin +* storage + - music_directory can point to a remote file server + - smbclient: new plugin * playlist - soundcloud: use https instead of http - soundcloud: add default API key diff --git a/src/Main.cxx b/src/Main.cxx index 82e0145cd..b98f3c24d 100644 --- a/src/Main.cxx +++ b/src/Main.cxx @@ -55,6 +55,7 @@ #include "unix/SignalHandlers.hxx" #include "unix/Daemon.hxx" #include "system/FatalError.hxx" +#include "util/UriUtil.hxx" #include "util/Error.hxx" #include "util/Domain.hxx" #include "thread/Id.hxx" @@ -63,6 +64,7 @@ #include "config/ConfigData.hxx" #include "config/ConfigDefaults.hxx" #include "config/ConfigOption.hxx" +#include "config/ConfigError.hxx" #include "Stats.hxx" #ifdef ENABLE_DATABASE @@ -71,6 +73,7 @@ #include "db/DatabaseSimple.hxx" #include "db/plugins/SimpleDatabasePlugin.hxx" #include "storage/plugins/LocalStorage.hxx" +#include "storage/Registry.hxx" #endif #ifdef ENABLE_NEIGHBOR_PLUGINS @@ -148,6 +151,15 @@ glue_mapper_init(Error &error) static bool InitStorage(Error &error) { + auto uri = config_get_string(CONF_MUSIC_DIR, nullptr); + if (uri != nullptr && uri_has_scheme(uri)) { + instance->storage = CreateStorageURI(uri, error); + if (instance->storage == nullptr && !error.IsDefined()) + error.Format(config_domain, + "Unrecognized storage URI: %s", uri); + return instance->storage != nullptr; + } + auto path_fs = config_get_path(CONF_MUSIC_DIR, error); if (path_fs.IsNull() && error.IsDefined()) return false; |