Updated workflow to: - Use Gitea token for repository checkout authentication - Use Gitea repository owner as username for registry login - Use PACKAGES_TOKEN secret for registry authentication - Follow proven pattern from working repository - Only build and push on main/master branches and version tags - Added proper job dependencies (test → build → docker)
3.1 KiB
3.1 KiB
Filter Flow Documentation
This document explains how the ignore_singles and ignore_compilations settings propagate through the NaviWatcher system.
Overview
The application implements a dual-path filtering approach to balance storage efficiency with real-time responsiveness to user preference changes:
-
MusicBrainz Sync Path (Store-time filtering):
- Applies filtering when caching release groups from the MusicBrainz API
- Stores only filtered results in the
external_releasestable - Reduces database size by excluding unwanted release types upfront
-
Scanner Path (Read-time filtering):
- Applies filtering when retrieving cached data for comparison
- Ensures changes to
ignore_singles/ignore_compilationstake effect immediately - Provides real-time responsiveness without waiting for cache expiry
Data Flow
-
Artist Settings Storage:
- Navidrome artist sync populates the
artist_settingstable - Stores
ignore_singlesandignore_compilationsboolean flags per artist
- Navidrome artist sync populates the
-
MusicBrainz Synchronization:
SyncArtistDiscographyretrieves artist settings viagetArtistFilterOptions- Applies filtering using
ApplyTypeTogglesbefore storing inexternal_releases - On cache hits, re-applies filter to ensure freshness of user preferences
-
Scanning Process:
ScanArtist settings viaGetArtistSettings`- Creates
TypeFilterwith currentignore_singles/ignore_compilationsvalues - Applies filter during
FindMissingReleasesviafilter.suppressed()check - Uses same
musicbrainz.ApplyTypeToggleslogic for consistency
Implementation Details
Shared Filtering Logic
Both paths use the same underlying filtering logic:
musicbrainz.ApplyTypeTogglesfor ExternalRelease filteringmusicbrainz.ApplyTypeTogglesToReleaseGroupsfor ReleaseGroup filtering- Consistent criteria:
- IgnoreSingles: Type == "Single" OR Type == "EP" OR SecondaryTypes contains "Single"/"EP"
- IgnoreCompilations: Type == "Compilation" OR SecondaryTypes contains "Compilation"
TypeFilter Structure
type TypeFilter struct {
IgnoreSingles bool
IgnoreCompilations bool
}
Filter Application
- MusicBrainz Path:
ApplyTypeToggles(releases, FilterOptions{IgnoreSingles: s.IgnoreSingles, IgnoreCompilations: s.IgnoreCompilations}) - Scanner Path:
filter.suppressed(ext)which internally uses the same logic
Benefits
- Storage Efficiency: Only desired release types are cached in the database
- Immediate Responsiveness: User preference changes take effect in real-time
- Consistent Behavior: Both code paths produce identical filtering results
- Cache Efficiency: Existing cached data remains useful when preferences change
Related Files
internal/scanner/diff.go: TypeFilter definition and suppressed() methodinternal/scanner/scan.go: ScanArtist and ScanAll functionsinternal/musicbrainz/sync.go: SyncArtistDiscography and getArtistFilterOptionsinternal/musicbrainz/filter.go: ApplyTypeToggles and related filtering functionsinternal/database/artist_settings.go: GetArtistSettings and GetAllArtistSettings