aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/UpdateContainer.cxx16
-rw-r--r--src/UpdateContainer.hxx2
-rw-r--r--src/UpdateSong.cxx6
3 files changed, 18 insertions, 6 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);
diff --git a/src/UpdateContainer.hxx b/src/UpdateContainer.hxx
index 3b54fb39f..b8f0ad39a 100644
--- a/src/UpdateContainer.hxx
+++ b/src/UpdateContainer.hxx
@@ -31,6 +31,6 @@ bool
update_container_file(Directory &directory,
const char *name,
const struct stat *st,
- const DecoderPlugin &plugin);
+ const char *suffix);
#endif
diff --git a/src/UpdateSong.cxx b/src/UpdateSong.cxx
index bbfde7f4d..4101d6231 100644
--- a/src/UpdateSong.cxx
+++ b/src/UpdateSong.cxx
@@ -35,7 +35,7 @@
static void
update_song_file2(Directory &directory,
const char *name, const struct stat *st,
- const DecoderPlugin &plugin)
+ const char *suffix)
{
db_lock();
Song *song = directory.FindSong(name);
@@ -56,7 +56,7 @@ update_song_file2(Directory &directory,
if (!(song != nullptr && st->st_mtime == song->mtime &&
!walk_discard) &&
- update_container_file(directory, name, st, plugin)) {
+ update_container_file(directory, name, st, suffix)) {
if (song != nullptr) {
db_lock();
delete_song(directory, song);
@@ -110,6 +110,6 @@ update_song_file(Directory &directory,
if (plugin == nullptr)
return false;
- update_song_file2(directory, name, st, *plugin);
+ update_song_file2(directory, name, st, suffix);
return true;
}