A beets plugin for managing lyrics files alongside music files
Project description
beets-lyrics-manager
A beets plugin for automatically managing lyrics files (.lrc) when importing music files and synchronizing lyrics files when moving songs.
Features
- Copy lyrics on import: Automatically find and copy lyrics files (.lrc) with the same name when importing music files
- Synchronize on move: Automatically move corresponding lyrics files when using beets to move music files
- Rename lyrics: Automatically rename lyrics files according to new music file names
- Support multiple operations: Support all beets file operations including copy, move, link, hardlink, reflink
- Unified processing logic: All lyrics file operations use unified methods to ensure consistent behavior and error handling
- Configurable: Support custom lyrics file extensions and other options
Installation
Method 1: Install with pip (Recommended)
git clone https://github.com/yourusername/beets-lyrics-manager.git
cd beets-lyrics-manager
pip install -e .
This is the most recommended installation method as it correctly installs the plugin into beets' namespace package.
Method 2: Manual installation
Copy the beetsplug/lyricsmanager.py file to your beets plugin directory:
# Find beets plugin directory
python -c "import beets; print(beets.__file__)"
# Then copy the plugin file to beets/plugins/ directory
cp beetsplug/lyricsmanager.py /path/to/beets/plugins/
Uninstall
# If installed with pip
pip uninstall beets-lyrics-manager
# If manually installed, delete the plugin file directly
rm /path/to/beets/plugins/lyricsmanager.py
Verify installation
After installation, check if beets can find the plugin:
beet config -e
If you see lyricsmanager in the plugins list, the installation was successful.
Configuration
Add the following to your beets configuration file (usually ~/.config/beets/config.yaml):
plugins:
- lyricsmanager
# Optional: Custom configuration
lyricsmanager:
# Supported lyrics file extensions (default: [.lrc])
extensions: [.lrc, .txt]
# Whether to copy lyrics files on import (default: true)
copy_lyrics: true
# Whether to move lyrics files on move (default: true)
move_lyrics: true
Usage
After installing and configuring the plugin, it will work automatically:
Import music files
beet import /path/to/music/directory
If there are .lrc files with the same name next to music files, the plugin will automatically copy the lyrics files to the target directory.
Move music files
beet move artist:"Artist Name"
When music files are moved, the corresponding lyrics files will also be moved to the new location.
Copy music files
beet copy artist:"Artist Name" /new/destination
Lyrics files will also be copied to the new location.
How it works
The plugin listens to the following beets events and uses unified lyrics file processing logic:
item_imported: Copy lyrics files on importitem_moved: Synchronize and move lyrics files on moveitem_copied: Copy lyrics files on copyitem_linked: Copy lyrics files on linkitem_hardlinked: Copy lyrics files on hardlinkitem_reflinked: Copy lyrics files on reflink
All operations are handled through the unified _handle_lyrics_operation method to ensure consistent behavior and error handling.
File matching rules
The plugin looks for lyrics files with the same name as music files:
- Music file:
song.mp3→ Look for:song.lrc - Music file:
album_track.flac→ Look for:album_track.lrc
Supports multiple extensions, searched in the order specified in the configuration.
Logging
The plugin records detailed operation logs:
INFOlevel: Successfully copied/moved lyrics files, formatted as "Operation type lyrics file: source path -> target path"DEBUGlevel: Detailed operation information, including cases where lyrics files already existERRORlevel: Error information for failed operations, including specific error reasons
Use beet -v to view detailed logs.
Examples
Suppose you have the following file structure:
/music/
├── song1.mp3
├── song1.lrc
├── song2.flac
└── song2.lrc
After running beet import /music:
/beets_library/
├── Artist/
│ └── Album/
│ ├── 01 - Song1.mp3
│ ├── 01 - Song1.lrc
│ ├── 02 - Song2.flac
│ └── 02 - Song2.lrc
Troubleshooting
Lyrics files are not copied/moved
- Check if the lyrics file has the same name as the music file (except for the extension)
- Check if the lyrics file extension is in the configured
extensionslist - Check if the plugin is loaded correctly:
beet config -e - Use
beet -vto view detailed logs - Check if the configuration items
copy_lyricsandmove_lyricsare set totrue
Permission errors
Ensure beets has permission to read source lyrics files and write to target directories.
Log information
- If you see "Lyrics file already in correct location" DEBUG message, it means the lyrics file is already in the correct location and no operation is needed
- If you see "Failed to copy/move lyrics file" ERROR message, check file permissions and disk space
Contributing
Issues and Pull Requests are welcome!
License
MIT License
Acknowledgments
- Inspired by the design approach of beets-extrafiles plugin
- Based on the beets plugin development framework
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file beets_lyrics_manager-0.0.3.tar.gz.
File metadata
- Download URL: beets_lyrics_manager-0.0.3.tar.gz
- Upload date:
- Size: 5.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5d562c76d4e6aba14adea6f2a729f3e0691b163b730e7d3c84c7e17aa2e3e033
|
|
| MD5 |
fe6738b046972dff12f687f4a47f136c
|
|
| BLAKE2b-256 |
812809651c8dadd32a75151201c173e11da025fcdd598c71907efa0c61449a5a
|
Provenance
The following attestation bundles were made for beets_lyrics_manager-0.0.3.tar.gz:
Publisher:
python-publish.yml on zytx/beets-lyrics-manager
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
beets_lyrics_manager-0.0.3.tar.gz -
Subject digest:
5d562c76d4e6aba14adea6f2a729f3e0691b163b730e7d3c84c7e17aa2e3e033 - Sigstore transparency entry: 398173417
- Sigstore integration time:
-
Permalink:
zytx/beets-lyrics-manager@ae82b2364b15e1f6e7461c10054169abc6cb91c2 -
Branch / Tag:
refs/tags/v0.0.3 - Owner: https://github.com/zytx
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-publish.yml@ae82b2364b15e1f6e7461c10054169abc6cb91c2 -
Trigger Event:
release
-
Statement type:
File details
Details for the file beets_lyrics_manager-0.0.3-py3-none-any.whl.
File metadata
- Download URL: beets_lyrics_manager-0.0.3-py3-none-any.whl
- Upload date:
- Size: 5.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1c6528b9df575f223ae04e8af75f78468050154467ad7ebc3458e4d1fca51e16
|
|
| MD5 |
94d1a48c3a206a4aa667806b61feaa6a
|
|
| BLAKE2b-256 |
83a2e64e856223a96b791230c3945fff281bc5f613c4f7a71793df92359c3e75
|
Provenance
The following attestation bundles were made for beets_lyrics_manager-0.0.3-py3-none-any.whl:
Publisher:
python-publish.yml on zytx/beets-lyrics-manager
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
beets_lyrics_manager-0.0.3-py3-none-any.whl -
Subject digest:
1c6528b9df575f223ae04e8af75f78468050154467ad7ebc3458e4d1fca51e16 - Sigstore transparency entry: 398173424
- Sigstore integration time:
-
Permalink:
zytx/beets-lyrics-manager@ae82b2364b15e1f6e7461c10054169abc6cb91c2 -
Branch / Tag:
refs/tags/v0.0.3 - Owner: https://github.com/zytx
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-publish.yml@ae82b2364b15e1f6e7461c10054169abc6cb91c2 -
Trigger Event:
release
-
Statement type: