diff options
| author | cooljqln <cooljqln@noreply.codeberg.org> | 2025-01-24 00:40:48 +0000 |
|---|---|---|
| committer | cooljqln <cooljqln@noreply.codeberg.org> | 2025-01-24 00:40:48 +0000 |
| commit | 580712acd11d5afdacd51c2e8d29313efc93d520 (patch) | |
| tree | b53e5f14926e03ff5c5399b3be95c827a255c83b /src/tangara/database/index.cpp | |
| parent | eeead037478ec9015cac6383ff32af6e179a952d (diff) | |
| download | tangara-fw-580712acd11d5afdacd51c2e8d29313efc93d520.tar.gz | |
Resolve some issues with dangling index records (#193)
- The tag parser's cache is now cleared between indexing runs, preventing stale data from being used
- Multi-value tag fields (genres, all artists) are now properly ingested in the tag value cache
- Cleaning up removed index records now properly handles the case where only a subset of the records for multi-value tags need to be deleted.
- Synthesizing missing tag values is now done in the tag parser instead of TrackTags, which resolves some issues with multi-value tag callbacks from libtags not being handled properly
These fixes seem to address all the issues with stale index records we were able to repro (including the issues in https://codeberg.org/cool-tech-zone/tangara-fw/issues/191), but if you've got any more cases with consistent repros then lmk!
Co-authored-by: ailurux <ailuruxx@gmail.com>
Reviewed-on: https://codeberg.org/cool-tech-zone/tangara-fw/pulls/193
Diffstat (limited to 'src/tangara/database/index.cpp')
| -rw-r--r-- | src/tangara/database/index.cpp | 19 |
1 files changed, 6 insertions, 13 deletions
diff --git a/src/tangara/database/index.cpp b/src/tangara/database/index.cpp index e60f56d5..7f594700 100644 --- a/src/tangara/database/index.cpp +++ b/src/tangara/database/index.cpp @@ -77,8 +77,8 @@ const IndexInfo kAudiobooks{ .components = {Tag::kAlbum, Tag::kAlbumOrder}, }; -static auto titleOrFilename(const TrackData& data, const TrackTags& tags) - -> std::pmr::string { +static auto titleOrFilename(const TrackData& data, + const TrackTags& tags) -> std::pmr::string { auto title = tags.title(); if (title) { return *title; @@ -147,8 +147,7 @@ auto Indexer::index() -> std::vector<std::pair<IndexKey, std::string>> { IndexKey::Header root_header{ .id = index_.id, - .depth = 0, - .components_hash = 0, + .components_hash = {}, }; handleLevel(root_header, index_.components); @@ -237,16 +236,10 @@ auto Index(locale::ICollator& collator, } auto ExpandHeader(const IndexKey::Header& header, - const std::optional<std::pmr::string>& component) - -> IndexKey::Header { + const std::pmr::string& component) -> IndexKey::Header { IndexKey::Header ret{header}; - ret.depth++; - if (component) { - ret.components_hash = - komihash(component->data(), component->size(), ret.components_hash); - } else { - ret.components_hash = komihash(NULL, 0, ret.components_hash); - } + ret.components_hash.push_back( + komihash(component.data(), component.size(), 0)); return ret; } |
