A multi-command CLI for searching, downloading, inspecting, cleansing, and publishing lyrics around LRCLIB.
Project description
pylrclib
A multi-command CLI for searching, downloading, inspecting, cleansing, and publishing lyrics around LRCLIB.
pylrclib is built for people who keep a real music library: audio files in one folder, plain lyrics in another, synced .lrc files somewhere else, and sometimes YAML metadata standing in for missing tags. It gives you one CLI for finding LRCLIB records, saving lyrics locally, checking local matches before upload, cleaning noisy LRC files, and publishing lyrics back to LRCLIB.
Package name: pylrclib-cli
Command name: pylrclib
Features
- Find LRCLIB records by text search, structured artist/title metadata, or exact LRCLIB id.
- Download lyrics as
.txt,.lrc, or both, with predictable file naming. - Upload local plain lyrics, synced lyrics, mixed records, or instrumental markers.
- Flag incorrect LRCLIB records by id.
- List and download public LRCLIB database dumps.
- Match lyrics from audio filenames, YAML-declared files, and normalized
Artist - Titlenames. - Preview local matches before publishing so you can catch bad pairings.
- Clean
.lrcfiles with default rules or fine-tuned--keep-*options. - Diagnose a workspace before a large upload run.
- Switch CLI output between English and Chinese with
--lang auto|en_US|zh_CN.
Lyrics Model
The CLI treats lyrics as explicit states:
| State | Meaning |
|---|---|
plain |
Unsynced plain-text lyrics. |
synced |
Timed LRC lyrics. |
mixed |
Both plain and synced lyrics are available. |
instrumental |
Instrumental / no-vocals track. |
The same model is used by search, down, up, and inspect, while cleanse uses the same LRC parser to normalize synced lyric files.
Installation
Install from PyPI:
pip install pylrclib-cli
Then check the CLI:
pylrclib --help
pylrclib --version
Install from source when developing:
pip install -e .
Quick Start
Search LRCLIB:
pylrclib search --query "Aimer Ref:rain"
pylrclib search --artist "Aimer" --title "Ref:rain"
Download the best matching lyrics:
pylrclib down \
--artist "Aimer" \
--title "Ref:rain" \
--output-dir ./lyrics
Download both plain text and synced LRC for an exact LRCLIB record:
pylrclib down \
--lrclib-id 12345 \
--output-dir ./lyrics \
--save-mode both
Inspect local matches before uploading:
pylrclib inspect \
--tracks ./music \
--plain-dir ./lyrics_plain \
--synced-dir ./lyrics_lrc \
--show-all-candidates
Upload local lyrics:
pylrclib up \
--tracks ./music \
--plain-dir ./lyrics_plain \
--synced-dir ./lyrics_lrc \
--lyrics-mode auto
Flag an incorrect LRCLIB record:
pylrclib flag --lrclib-id 12345 --content "wrong lyrics"
List or download database dumps:
pylrclib dumps
pylrclib dumps --limit 1 --download --output-dir ./dumps
Clean LRC files, first as a preview and then with write-back:
pylrclib cleanse ./lyrics_lrc
pylrclib cleanse ./lyrics_lrc --write
Diagnose the workspace:
pylrclib doctor \
--tracks ./music \
--plain-dir ./lyrics_plain \
--synced-dir ./lyrics_lrc
Commands
search
Use search to inspect remote LRCLIB records before downloading or uploading.
pylrclib search --query "artist title"
pylrclib search --title "Song Title" --artist "Artist Name"
pylrclib search --lrclib-id 12345
Common options:
--query TEXT
--title TEXT
--artist TEXT
--album TEXT
--lrclib-id N
--limit N
--preview-lines N
--max-retries N
--user-agent TEXT
--api-base URL
--json
--yes
--non-interactive
down
Use down to fetch lyrics from LRCLIB and write them locally.
Input modes:
- Scan local audio or YAML metadata with
--tracks. - Download one manually specified track with
--artistand--title. - Fetch one exact LRCLIB record with
--lrclib-id.
pylrclib down --tracks ./music --output-dir ./lyrics
pylrclib down --artist "Artist" --title "Song" --output-dir ./lyrics
pylrclib down --lrclib-id 12345 --output-dir ./lyrics --save-mode both
Save modes:
| Mode | Behavior |
|---|---|
auto |
Save .lrc when synced lyrics exist, otherwise save .txt when plain lyrics exist. |
plain |
Save only .txt. |
synced |
Save only .lrc. |
both |
Save both .txt and .lrc when available. |
Naming modes:
| Mode | Behavior |
|---|---|
auto |
Use local track basename when scanning files, otherwise use Artist - Title. |
track-basename |
Force the source audio/YAML basename when available. |
artist-title |
Use Artist - Title. |
Common options:
--tracks PATH
--artist TEXT
--title TEXT
--album TEXT
--duration N
--lrclib-id N
--output-dir PATH
--plain-dir PATH
--synced-dir PATH
--save-mode auto|plain|synced|both
--naming auto|track-basename|artist-title
--skip-existing
--overwrite
--allow-derived-plain
--no-derived-plain
--preview-lines N
--max-retries N
--user-agent TEXT
--api-base URL
--yes
--non-interactive
up
Use up to publish local lyrics to LRCLIB.
The upload workflow:
- Discover audio files or YAML metadata.
- Query LRCLIB external matches. The deprecated
/api/get-cachedpath is skipped with a warning because current LRCLIB returns 404 for it. - Resolve local plain and synced lyric candidates.
- Classify lyrics as
plain,synced,mixed,instrumental,invalid, orempty. - Optionally normalize matched LRC content when
--cleanseis enabled. - Build an upload plan from
--lyrics-mode. - Publish lyrics or mark the track instrumental.
- Optionally move or rename processed files.
Recommended split-directory workflow:
pylrclib up \
--tracks ./music \
--plain-dir ./lyrics_plain \
--synced-dir ./lyrics_lrc \
--cleanse \
--cleanse-write \
--done-lrc ./done_lyrics \
--lyrics-mode auto
Upload modes:
| Mode | Behavior |
|---|---|
auto |
Upload the best available local lyrics. Mixed wins over synced, synced wins over plain. |
plain |
Require plain lyrics. |
synced |
Require synced lyrics. Plain lyrics may be derived unless disabled. |
mixed |
Require both plain and synced lyrics, or derive plain from synced when allowed. |
instrumental |
Publish instrumental metadata. |
Local matching checks:
- Same basename as the audio or YAML file.
- YAML-declared filenames.
- Normalized
Artist - Title.*matches. - Interactive selection when multiple candidates exist.
Supported local lyric extensions:
| Type | Extensions |
|---|---|
| Plain | .txt, .lyrics, .lyric |
| Synced | .lrc |
Common options:
--tracks PATH
--lyrics-dir PATH
--plain-dir PATH
--synced-dir PATH
--done-tracks PATH
--done-lrc PATH
-f, --follow
-r, --rename
-c, --cleanse
--cleanse-write
--keep-headers
--keep-credits
--keep-translations
--keep-instrumental-marker
--allow-non-lrc
--ignore-duration-mismatch
--lyrics-mode auto|plain|synced|mixed|instrumental
--allow-derived-plain
--no-derived-plain
-d, --default TRACKS_DIR LYRICS_DIR
-m, --match
--preview-lines N
--max-retries N
--user-agent TEXT
--api-base URL
--yes
--non-interactive
flag
Use flag to report an incorrect LRCLIB record by id.
pylrclib flag --lrclib-id 12345 --content "wrong lyrics"
pylrclib flag --lrclib-id 12345 --yes
Common options:
--lrclib-id N
--content TEXT
--preview-lines N
--max-retries N
--user-agent TEXT
--api-base URL
--yes
--non-interactive
dumps
Use dumps to list public LRCLIB database dumps, emit their metadata as JSON, or download the newest entries.
pylrclib dumps
pylrclib dumps --json
pylrclib dumps --limit 1 --download --output-dir ./dumps
Common options:
--limit N
--json
--download
--output-dir PATH
--overwrite
--max-retries N
--user-agent TEXT
inspect
Use inspect to see what up would find locally without publishing anything.
pylrclib inspect \
--tracks ./music \
--plain-dir ./lyrics_plain \
--synced-dir ./lyrics_lrc \
--show-all-candidates
Common options:
--tracks PATH
--lyrics-dir PATH
--plain-dir PATH
--synced-dir PATH
--lyrics-mode auto|plain|synced|mixed|instrumental
--preview-lines N
--show-all-candidates
cleanse
Use cleanse to normalize .lrc files. Without --write, the command previews the cleansed output and leaves files unchanged.
pylrclib cleanse ./lyrics_lrc
pylrclib cleanse ./lyrics_lrc --write
pylrclib cleanse song.lrc another.lrc
cleanse removes common noisy content such as header tags, credit lines, duplicate CJK translation lines, and pure-music marker lines by default. Invalid files are not rewritten into empty files.
Every cleanse rule has a keep flag for precision:
pylrclib cleanse ./lyrics_lrc --write --keep-translations
pylrclib cleanse ./lyrics_lrc --write --keep-headers --keep-credits
Inside pylrclib up, --cleanse controls in-memory LRC normalization for preview and upload. Without it, matched .lrc files are uploaded as read from disk. Add --cleanse-write to write the normalized LRC content back to the matched file before upload. The same --keep-* flags refine upload-time cleansing. Use the standalone cleanse command when you want to bulk-normalize files without uploading.
Common options:
paths ...
--lrc-dir PATH
--write
--keep-headers
--keep-credits
--keep-translations
--keep-instrumental-marker
--preview-lines N
doctor
Use doctor to print resolved configuration, count local inputs, and catch obvious workflow conflicts.
pylrclib doctor \
--tracks ./music \
--plain-dir ./lyrics_plain \
--synced-dir ./lyrics_lrc
Common options:
--tracks PATH
--lyrics-dir PATH
--plain-dir PATH
--synced-dir PATH
--done-tracks PATH
--done-lrc PATH
-f, --follow
-r, --rename
-c, --cleanse
--lyrics-mode auto|plain|synced|mixed|instrumental
-d, --default TRACKS_DIR LYRICS_DIR
-m, --match
--preview-lines N
--max-retries N
--user-agent TEXT
--api-base URL
YAML Metadata
YAML files can be used as track inputs when audio metadata is unavailable or inconvenient.
track: Song Title
artist: Artist Name
album: Album Name
duration: 180
plain_file: song.txt
synced_file: song.lrc
lyrics_file: song.lrc
lrc_file: song.lrc
Required fields:
track
artist
album
duration
Optional lyric filename fields:
plain_file
synced_file
lyrics_file
lrc_file
Environment Variables
Most directory, metadata, network, and preview options can be provided through environment variables:
PYLRCLIB_TRACKS_DIR
PYLRCLIB_LYRICS_DIR
PYLRCLIB_PLAIN_DIR
PYLRCLIB_SYNCED_DIR
PYLRCLIB_DONE_TRACKS_DIR
PYLRCLIB_DONE_LRC_DIR
PYLRCLIB_OUTPUT_DIR
PYLRCLIB_ARTIST
PYLRCLIB_TITLE
PYLRCLIB_ALBUM
PYLRCLIB_DURATION
PYLRCLIB_LRCLIB_ID
PYLRCLIB_FLAG_CONTENT
PYLRCLIB_API_BASE
PYLRCLIB_USER_AGENT
PYLRCLIB_PREVIEW_LINES
PYLRCLIB_MAX_HTTP_RETRIES
PYLRCLIB_LIMIT
PYLRCLIB_LANG
CLI arguments take precedence over environment variables. Environment variables take precedence over hardcoded defaults.
Language
pylrclib supports English and Chinese output:
pylrclib --lang en_US --help
pylrclib --lang zh_CN --help
pylrclib --lang auto --help
You can also set the language once for a shell session:
export PYLRCLIB_LANG=zh_CN
pylrclib --help
Help Reference
The command help is the source of truth for current defaults and exact option names:
pylrclib -h
pylrclib search -h
pylrclib down -h
pylrclib up -h
pylrclib flag -h
pylrclib dumps -h
pylrclib inspect -h
pylrclib cleanse -h
pylrclib doctor -h
Development
Install development dependencies:
pip install -e ".[dev]"
Run tests:
python -m pytest -q
Run coverage:
python -m coverage run --source=pylrclib -m pytest -q
python -m coverage report -m
As of the 0.4.8 release prep, the local suite has 122 tests and reports 94% line coverage.
Run linting, type checking, and packaging checks before publishing:
ruff check .
mypy pylrclib
python -m build
twine check dist/*
When changing CLI arguments, defaults, or help text, refresh the README summaries against:
python -m pylrclib --lang en_US -h
python -m pylrclib --lang en_US search -h
python -m pylrclib --lang en_US down -h
python -m pylrclib --lang en_US up -h
python -m pylrclib --lang en_US flag -h
python -m pylrclib --lang en_US inspect -h
python -m pylrclib --lang en_US cleanse -h
python -m pylrclib --lang en_US doctor -h
中文速览
pylrclib 是一个围绕 LRCLIB 的歌词命令行工具,可以搜索、下载、检查、清洗和上传歌词。
常用命令:
pylrclib search --query "歌手 歌名"
pylrclib down --artist "歌手" --title "歌名" --output-dir ./lyrics
pylrclib inspect --tracks ./music --lyrics-dir ./lyrics --show-all-candidates
pylrclib up --tracks ./music --plain-dir ./plain --synced-dir ./lrc
pylrclib cleanse ./lrc --write
pylrclib doctor --tracks ./music --lyrics-dir ./lyrics
使用中文界面:
pylrclib --lang zh_CN --help
export PYLRCLIB_LANG=zh_CN
License
MIT
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 pylrclib_cli-0.6.0.tar.gz.
File metadata
- Download URL: pylrclib_cli-0.6.0.tar.gz
- Upload date:
- Size: 66.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1b1a2d71b773fe8f23426f32ed2df9db9fd1a183bfaacad8335725a8440ef8ba
|
|
| MD5 |
c7cdc515465fcd866ae893c7fcdc40a7
|
|
| BLAKE2b-256 |
efbc71913badae367cedffd6b9fd173819c1b7e0908f31442376d2a71dbb70ee
|
Provenance
The following attestation bundles were made for pylrclib_cli-0.6.0.tar.gz:
Publisher:
python-publish.yml on Harmonese/pylrclib
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pylrclib_cli-0.6.0.tar.gz -
Subject digest:
1b1a2d71b773fe8f23426f32ed2df9db9fd1a183bfaacad8335725a8440ef8ba - Sigstore transparency entry: 1619792884
- Sigstore integration time:
-
Permalink:
Harmonese/pylrclib@26934cb335c787692c66c8c92b58e2ea4950b876 -
Branch / Tag:
refs/tags/v0.6.0 - Owner: https://github.com/Harmonese
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-publish.yml@26934cb335c787692c66c8c92b58e2ea4950b876 -
Trigger Event:
release
-
Statement type:
File details
Details for the file pylrclib_cli-0.6.0-py3-none-any.whl.
File metadata
- Download URL: pylrclib_cli-0.6.0-py3-none-any.whl
- Upload date:
- Size: 62.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9f45d650ca4cccf87ce7f8932072639d4b7225e64f612b39c58213e548ac3053
|
|
| MD5 |
f53c1587fd36e8c18ffd2163d096426f
|
|
| BLAKE2b-256 |
89a031bfee55d2b423c351b5036a96b1066c3df5fb2040028f033ef60622f5bb
|
Provenance
The following attestation bundles were made for pylrclib_cli-0.6.0-py3-none-any.whl:
Publisher:
python-publish.yml on Harmonese/pylrclib
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pylrclib_cli-0.6.0-py3-none-any.whl -
Subject digest:
9f45d650ca4cccf87ce7f8932072639d4b7225e64f612b39c58213e548ac3053 - Sigstore transparency entry: 1619792976
- Sigstore integration time:
-
Permalink:
Harmonese/pylrclib@26934cb335c787692c66c8c92b58e2ea4950b876 -
Branch / Tag:
refs/tags/v0.6.0 - Owner: https://github.com/Harmonese
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-publish.yml@26934cb335c787692c66c8c92b58e2ea4950b876 -
Trigger Event:
release
-
Statement type: