diff options
author | Max Kellermann <max@duempel.org> | 2013-12-29 16:46:02 +0100 |
---|---|---|
committer | Max Kellermann <max@duempel.org> | 2013-12-29 16:46:02 +0100 |
commit | 5bb563e3bc72b7aaea4e2df3280f38085bb515ba (patch) | |
tree | 2052618d1b51651969fe715c20e2203f00a3b972 /src/UpdateContainer.cxx | |
parent | 9be82891b01ba2190a97032a2f84b70151bc2358 (diff) | |
download | mpd-5bb563e3bc72b7aaea4e2df3280f38085bb515ba.tar.gz mpd-5bb563e3bc72b7aaea4e2df3280f38085bb515ba.tar.xz mpd-5bb563e3bc72b7aaea4e2df3280f38085bb515ba.zip |
UpdateContainer: pass suffix instead of DecoderPlugin
Instead of using the first DecoderPlugin that supports the suffix, use
the first one that actually implements the "container_scan" method.
Diffstat (limited to 'src/UpdateContainer.cxx')
-rw-r--r-- | src/UpdateContainer.cxx | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/src/UpdateContainer.cxx b/src/UpdateContainer.cxx index 80f059734..c970dc05c 100644 --- a/src/UpdateContainer.cxx +++ b/src/UpdateContainer.cxx @@ -26,6 +26,7 @@ #include "Directory.hxx" #include "Song.hxx" #include "DecoderPlugin.hxx" +#include "DecoderList.hxx" #include "Mapper.hxx" #include "fs/AllocatedPath.hxx" #include "tag/TagHandler.hxx" @@ -64,14 +65,25 @@ make_directory_if_modified(Directory &parent, const char *name, return directory; } +static bool +SupportsContainerSuffix(const DecoderPlugin &plugin, const char *suffix) +{ + return plugin.container_scan != nullptr && + plugin.SupportsSuffix(suffix); +} + bool update_container_file(Directory &directory, const char *name, const struct stat *st, - const DecoderPlugin &plugin) + const char *suffix) { - if (plugin.container_scan == nullptr) + const DecoderPlugin *_plugin = decoder_plugins_find([suffix](const DecoderPlugin &plugin){ + return SupportsContainerSuffix(plugin, suffix); + }); + if (_plugin == nullptr) return false; + const DecoderPlugin &plugin = *_plugin; db_lock(); Directory *contdir = make_directory_if_modified(directory, name, st); |