From b5f3bfce92b42ad3b6c7f5f37ea1b8a23616f87f Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Sun, 29 Dec 2013 16:34:16 +0100 Subject: 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. --- src/SongUpdate.cxx | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) (limited to 'src/SongUpdate.cxx') 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 #include @@ -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; } -- cgit v1.2.3