$ show metabrainz/picard
MusicBrainz Picard is a cross-platform desktop music tagger written in Python using PyQt6. It is the official tagger for the MusicBrainz music metadata database. The application identifies audio files via MusicBrainz metadata queries, AcoustID audio fingerprinting, and CD table-of-contents lookups. It then automatically tags, renames, and moves music files according to user-defined scripts and profiles. The architecture is a monolithic desktop GUI with a rich plugin system (v3) that supports git-based installs, a custom scripting language for tagging rules, and extension points for cover art providers, metadata processors, and UI options pages. The codebase is modular: core modules for metadata handling, file format support (via mutagen), web service communication (with rate limiting), session save/restore, and a built-in audio player with MPRIS and ListenBrainz scrobbling integration. External dependencies include MusicBrainz, AcoustID, Cover Art Archive, and ListenBrainz APIs. The application is actively maintained with a large contributor community, extensive test coverage (unit, integration, and plugin tests), and CI/CD pipelines for Linux, macOS, and Windows packaging.
The LLM identified 5 files worth highlighting for reuse:
Provides fast string comparison functions (similarity, contains, etc.) with a pure Python fallback and an optional C extension (_astrcmp.c) for performance. The similarity function uses a multi-step approach: exact match, weighted Levenshtein, and suffix/prefix checks. The module is self-contained, has no internal Picard imports, and can be reused in any Python project requiring approximate string matching.
Implements an LRU (Least Recently Used) cache as a MutableMapping with a maximum size, thread-safe operations, and a 'invalidate' method. Includes a WeakLRUCache variant that uses weak references for values. The implementation is generic, requires no Picard-specific dependencies, and is suitable for any Python application needing a bounded cache with LRU eviction.
Provides a high-level threading abstraction built on Qt's QThreadPool. Includes `Runnable` (a task wrapper with priority and progress callbacks), `TaskCounter` (thread-safe atomic counter), and `to_main` (a decorator to schedule a function call on the main thread via Qt signals). The module is designed for PyQt6 but the pattern of running tasks in a thread pool with main-thread callbacks is reusable in any Qt-based application.
Provides a `BitReader` class for reading bits from a file object, supporting both MSB-first and LSB-first bit ordering. It includes methods for reading arbitrary numbers of bits, bytes, and integers, as well as peeking and skipping. The implementation is self-contained, has no external dependencies, and is useful for parsing binary formats that require bit-level access.
Defines the generic `ExtensionPoint` class for registering and filtering plugin extensions (functions, script variables, cover art providers, etc.). Extensions are identified by a UUID and can be registered with a human-readable name and description. The class provides iteration, retrieval by UUID, and priority-based ordering. While it is used throughout Picard's plugin system, the core logic is generic and could be extracted as a standalone plugin registration framework for any Python application.