- GUI Framework: The application is built on PyQt5, leveraging its robust widget system to create a responsive, cross-platform graphical user interface. The UI is structured as a
QMainWindowwith aQHBoxLayoutdividing the screen into a file management panel and a tag editing panel. A custom stylesheet provides a professional, unified dark theme. - File I/O Engine: The core file processing is handled by the
mutagenlibrary, which provides comprehensive read and write capabilities for metadata across various audio formats:- MP3: Uses
mutagen.id3to handle ID3 tags, including theAPICframe for album art. - FLAC: Processes native FLAC tags and
Pictureblocks for cover art. - M4A: Manages MP4 atoms, including the
covratom for album art. - Ogg: Edits Vorbis comments and
metadata_block_picturefor embedded artwork.
- MP3: Uses
- Concurrency Model: All long-running operations, such as file saving and network requests, are offloaded to a dedicated worker thread (
QThread) to prevent the main UI thread from freezing. The customWorkerclass and therun_in_threadhelper function manage this asynchronous execution, usingpyqtSignalto emit progress, completion, and error signals back to the main thread. - API Integration: The application uses
musicbrainzngsto interact with the MusicBrainz database and therequestslibrary to fetch album art from the Cover Art Archive. All API requests are made with a custom user agentMetagify/1.0 (negroayub97@gmail.com)as required by the MusicBrainz terms of service.
- Interactive File List: The
QListWidgethas been enhanced with key interactive features:- Drag-and-Drop: Users can drag audio files directly from their file explorer to load them.
- Reordering: The list supports
QAbstractItemView.InternalMoveto let users reorder tracks, which is crucial for preparing a release submission to MusicBrainz. - Multi-selection: Supports
QAbstractItemView.ExtendedSelectionto enable efficient batch editing and removal of multiple files at once.
- Dynamic Tag Editor: The right-side panel features a dynamic
QFormLayoutthat adapts its functionality based on the selection.- Single File Mode: Displays all tag fields for manual editing, with the album art visible.
- Batch Mode: When multiple files are selected, a
QCheckBoxappears next to each tag field. Changes are only applied to files for fields where the checkbox is checked, preventing unintended overwrites.
- MusicBrainz Integration:
- Search and Apply: The
SearchDialogallows users to search the MusicBrainz database by artist and album. The selected release's metadata, including title, artist, album, and track number, can be applied to the loaded files. - Release Submission: The
SubmissionDialogprovides a structured form to submit new releases to MusicBrainz, including tracks, release title, artist, and date.
- Search and Apply: The
- Album Art Management: The application handles album art fetching from Cover Art Archive. It downloads the art and uses a
QPixmapandQBufferto resize the image to a standardized 500x500 pixels for optimized file size before embedding it.
- Contextual Help System: A
QLabelin the status bar displays a description of each UI element on hover, based on theHELP_TEXTdictionary. - Progress and Status Feedback: A
QProgressBarandQStatusBarprovide real-time feedback on file-loading and saving operations. - Robust File Handling: The application includes comprehensive
try-exceptblocks to gracefully handle unsupported file formats or corrupted audio files, providing clear error messages. - Settings Persistence:
QSettingsis used to save and restore the main window's geometry to maintain the user's preferred size and position between sessions. - User Configuration: The initial run prompts the user to enter a contact email, required by the MusicBrainz API, and stores it using `Q