aboutsummaryrefslogtreecommitdiffstats
path: root/src/SongUpdate.cxx
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2013-12-29 16:34:16 +0100
committerMax Kellermann <max@duempel.org>2013-12-29 18:15:30 +0100
commitb5f3bfce92b42ad3b6c7f5f37ea1b8a23616f87f (patch)
treef447e6931100cc94f18befc52bf2fddce9f6c23f /src/SongUpdate.cxx
parentaeb2baa495776d9fc06e63f91167c40c334303c8 (diff)
downloadmpd-b5f3bfce92b42ad3b6c7f5f37ea1b8a23616f87f.tar.gz
mpd-b5f3bfce92b42ad3b6c7f5f37ea1b8a23616f87f.tar.xz
mpd-b5f3bfce92b42ad3b6c7f5f37ea1b8a23616f87f.zip
SongUpdate: read tags from songs in an archive
Add the TagStream.cxx library, similar to TagFile.cxx, and use it to load tags from song files inside archives.
Diffstat (limited to 'src/SongUpdate.cxx')
-rw-r--r--src/SongUpdate.cxx14
1 files changed, 9 insertions, 5 deletions
diff --git a/src/SongUpdate.cxx b/src/SongUpdate.cxx
index 1e1bb2ff5..fd4aa6751 100644
--- a/src/SongUpdate.cxx
+++ b/src/SongUpdate.cxx
@@ -32,6 +32,7 @@
#include "tag/TagId3.hxx"
#include "tag/ApeTag.hxx"
#include "TagFile.hxx"
+#include "TagStream.hxx"
#include <assert.h>
#include <string.h>
@@ -119,12 +120,15 @@ Song::UpdateFileInArchive()
if (!decoder_plugins_supports_suffix(suffix))
return false;
- delete tag;
+ const auto path_fs = map_song_fs(*this);
+ if (path_fs.IsNull())
+ return false;
- //accept every file that has music suffix
- //because we don't support tag reading through
- //input streams
- tag = new Tag();
+ TagBuilder tag_builder;
+ if (!tag_stream_scan(path_fs.c_str(), full_tag_handler, &tag_builder))
+ return false;
+ delete tag;
+ tag = tag_builder.Commit();
return true;
}