From dad14baa73a9a46c450193da43bf960b436f7ec5 Mon Sep 17 00:00:00 2001 From: jacqueline Date: Wed, 6 Sep 2023 10:14:48 +1000 Subject: Add an opus-specific tag parser --- src/database/include/tag_parser.hpp | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) (limited to 'src/database/include') diff --git a/src/database/include/tag_parser.hpp b/src/database/include/tag_parser.hpp index dcc8aa21..85721357 100644 --- a/src/database/include/tag_parser.hpp +++ b/src/database/include/tag_parser.hpp @@ -20,18 +20,27 @@ class ITagParser { -> bool = 0; }; +class GenericTagParser : public ITagParser { + public: + auto ReadAndParseTags(const std::string& path, TrackTags* out) + -> bool override; +}; + class TagParserImpl : public ITagParser { public: + TagParserImpl(); auto ReadAndParseTags(const std::string& path, TrackTags* out) -> bool override; private: - std::mutex cache_mutex_; + std::map> extension_to_parser_; + GenericTagParser generic_parser_; /* * Cache of tags that have already been extracted from files. Ideally this * cache should be slightly larger than any page sizes in the UI. */ + std::mutex cache_mutex_; util::LruCache<16, std::string, TrackTags> cache_; // We could also consider keeping caches of artist name -> shared_string and @@ -39,4 +48,10 @@ class TagParserImpl : public ITagParser { // of our UI. }; +class OpusTagParser : public ITagParser { + public: + auto ReadAndParseTags(const std::string& path, TrackTags* out) + -> bool override; +}; + } // namespace database -- cgit v1.2.3