diff options
Diffstat (limited to 'src/UpdateContainer.cxx')
-rw-r--r-- | src/UpdateContainer.cxx | 20 |
1 files changed, 16 insertions, 4 deletions
diff --git a/src/UpdateContainer.cxx b/src/UpdateContainer.cxx index 80f059734..1d219930f 100644 --- a/src/UpdateContainer.cxx +++ b/src/UpdateContainer.cxx @@ -1,5 +1,5 @@ /* - * Copyright (C) 2003-2013 The Music Player Daemon Project + * Copyright (C) 2003-2014 The Music Player Daemon Project * http://www.musicpd.org * * This program is free software; you can redistribute it and/or modify @@ -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); @@ -102,7 +114,7 @@ update_container_file(Directory &directory, add_tag_handler, &tag_builder); if (tag_builder.IsDefined()) - song->tag = tag_builder.Commit(); + song->tag = tag_builder.CommitNew(); else tag_builder.Clear(); |