diff --git a/NEWS b/NEWS index be3124e01..8995ad9d5 100644 --- a/NEWS +++ b/NEWS @@ -15,6 +15,10 @@ ver 0.23 (not yet released) * new build-time dependency: libfmt ver 0.22.9 (not yet released) +* database + - simple: load all .mpdignore files of all parent directories +* decoder + - ffmpeg: support the tags "sort_album", "album-sort", "artist-sort" * Windows - fix build failure with SQLite diff --git a/src/db/update/Walk.cxx b/src/db/update/Walk.cxx index 88e8fc480..c4b20fca4 100644 --- a/src/db/update/Walk.cxx +++ b/src/db/update/Walk.cxx @@ -312,6 +312,29 @@ UpdateWalk::SkipSymlink(const Directory *directory, #endif } +static void +LoadExcludeListOrThrow(const Storage &storage, const Directory &directory, + ExcludeList &exclude_list) +{ + Mutex mutex; + auto is = InputStream::OpenReady(storage.MapUTF8(PathTraitsUTF8::Build(directory.GetPath(), + ".mpdignore")).c_str(), + mutex); + exclude_list.Load(std::move(is)); +} + +static void +LoadExcludeListOrLog(const Storage &storage, const Directory &directory, + ExcludeList &exclude_list) noexcept +{ + try { + LoadExcludeListOrThrow(storage, directory, exclude_list); + } catch (...) { + if (!IsFileNotFound(std::current_exception())) + LogError(std::current_exception()); + } +} + bool UpdateWalk::UpdateDirectory(Directory &directory, const ExcludeList &exclude_list, @@ -331,17 +354,7 @@ UpdateWalk::UpdateDirectory(Directory &directory, } ExcludeList child_exclude_list(exclude_list); - - try { - Mutex mutex; - auto is = InputStream::OpenReady(storage.MapUTF8(PathTraitsUTF8::Build(directory.GetPath(), - ".mpdignore")).c_str(), - mutex); - child_exclude_list.Load(std::move(is)); - } catch (...) { - if (!IsFileNotFound(std::current_exception())) - LogError(std::current_exception()); - } + LoadExcludeListOrLog(storage, directory, child_exclude_list); if (!child_exclude_list.IsEmpty()) RemoveExcludedFromDirectory(directory, child_exclude_list); @@ -445,6 +458,28 @@ UpdateWalk::DirectoryMakeUriParentChecked(Directory &root, return directory; } +static void +LoadExcludeLists(std::forward_list &lists, + const Storage &storage, const Directory &directory) noexcept +{ + assert(!lists.empty()); + + if (!directory.IsRoot()) + LoadExcludeLists(lists, storage, *directory.parent); + + lists.emplace_front(); + LoadExcludeListOrLog(storage, directory, lists.front()); +} + +static auto +LoadExcludeLists(const Storage &storage, const Directory &directory) noexcept +{ + std::forward_list lists; + lists.emplace_front(); + LoadExcludeLists(lists, storage, directory); + return lists; +} + inline void UpdateWalk::UpdateUri(Directory &root, const char *uri) noexcept try { @@ -465,9 +500,8 @@ try { return; } - ExcludeList exclude_list; - - UpdateDirectoryChild(*parent, exclude_list, name, info); + const auto exclude_lists = LoadExcludeLists(storage, *parent); + UpdateDirectoryChild(*parent, exclude_lists.front(), name, info); } catch (...) { LogError(std::current_exception()); } diff --git a/src/decoder/plugins/FfmpegMetaData.cxx b/src/decoder/plugins/FfmpegMetaData.cxx index 4ca45afb8..54fef3136 100644 --- a/src/decoder/plugins/FfmpegMetaData.cxx +++ b/src/decoder/plugins/FfmpegMetaData.cxx @@ -30,11 +30,22 @@ extern "C" { #include } +/** + * FFmpeg specific tag name mappings, as supported by + * libavformat/id3v2.c, libavformat/mov.c and others. + */ static constexpr struct tag_table ffmpeg_tags[] = { - { "year", TAG_DATE }, - { "author-sort", TAG_ARTIST_SORT }, + /* from libavformat/id3v2.c, libavformat/mov.c */ { "album_artist", TAG_ALBUM_ARTIST }, - { "album_artist-sort", TAG_ALBUM_ARTIST_SORT }, + + /* from libavformat/id3v2.c */ + { "album-sort", TAG_ALBUM_SORT }, + { "artist-sort", TAG_ARTIST_SORT }, + + /* from libavformat/mov.c */ + { "sort_album_artist", TAG_ALBUM_ARTIST_SORT }, + { "sort_album", TAG_ALBUM_SORT }, + { "sort_artist", TAG_ARTIST_SORT }, /* sentinel */ { nullptr, TAG_NUM_OF_ITEM_TYPES }