A multi-command CLI for searching, downloading, inspecting, cleansing, and publishing lyrics around LRCLIB.
Project description
pylrclib
A multi-command CLI around LRCLIB for searching, downloading, inspecting, cleansing, and publishing lyrics.
pylrclib treats lyrics as four explicit states:
plain: unsynced plain-text lyricssynced: timed LRC lyricsmixed: both plain and synced lyrics are availableinstrumental: instrumental / no-vocals track
That shared model drives all major commands:
pylrclib search: search LRCLIB and preview remote resultspylrclib down: download lyrics from LRCLIB to local filespylrclib up: publish local lyrics to LRCLIBpylrclib inspect: inspect local matching and classification without publishingpylrclib cleanse: normalize.lrcfilespylrclib doctor: diagnose workspace and configuration issues
Installation
From PyPI (Recommended)
pip install pylrclib-cli
From source
pip install -e .
Entry points
pylrclib --help
python -m pylrclib --help
Command overview
pylrclib search ...
pylrclib down ...
pylrclib up ...
pylrclib inspect ...
pylrclib cleanse ...
pylrclib doctor ...
search: search LRCLIB and preview remote records
Use search when you want to inspect LRCLIB results before downloading or publishing.
Query search
pylrclib search --query "song title"
pylrclib search --title "Song Title" --artist "Artist Name"
Lookup by LRCLIB id
pylrclib search --lrclib-id 12345
Useful parameters
--query TEXT
--title TEXT
--artist TEXT
--album TEXT
--lrclib-id N
--limit N
--preview-lines N
--json
--api-base URL
down: download lyrics from LRCLIB
down supports three input modes:
- Scan local audio / YAML metadata and query LRCLIB
- Manually specify artist/title metadata
- Fetch one exact record with
--lrclib-id
Download based on local music metadata
pylrclib down \
--tracks ./music \
--output-dir ./lyrics_downloaded
Download one song manually
pylrclib down \
--artist "Artist Name" \
--title "Song Title" \
--album "Album Name" \
--duration 180 \
--output-dir ./lyrics_downloaded
Download one exact LRCLIB record
pylrclib down \
--lrclib-id 12345 \
--output-dir ./lyrics_downloaded \
--save-mode both
Save strategy
--save-mode auto|plain|synced|both
Default behavior:
auto- if LRCLIB provides synced lyrics, save
.lrc - if only plain lyrics exist, save
.txt - if instrumental, report it and do not write lyric files
- if LRCLIB provides synced lyrics, save
plain: save only.txtsynced: save only.lrcboth: save both.txtand.lrcwhen available
Naming strategy
--naming auto|track-basename|artist-title
When scanning local files, auto prefers the track basename. In manual or id-based downloads, auto falls back to Artist - Title.
up: publish local lyrics to LRCLIB
up runs the full upload workflow:
- Discover audio files or YAML metadata
- Check LRCLIB cached and external matches
- Resolve local plain and synced lyric candidates
- Classify lyrics as
plain,synced,mixed,instrumental, orinvalid - Build an upload plan from
--lyrics-mode - Publish lyrics or mark the track instrumental
- Optionally move or rename processed files
Basic usage
pylrclib up --tracks ./music --lyrics-dir ./lyrics
Recommended split-directory usage
pylrclib up \
--tracks ./music \
--plain-dir ./lyrics_plain \
--synced-dir ./lyrics_lrc \
--done-lrc ./done_lyrics \
--lyrics-mode auto \
--cleanse
Upload strategy
--lyrics-mode auto|plain|synced|mixed|instrumental
Behavior summary:
auto- plain + synced => publish both
- only synced => publish synced and optionally derive plain text
- only plain => publish plain only
- explicit instrumental markers => publish as instrumental
- invalid lyrics => skip
plain: publish plain lyrics onlysynced: publish synced lyrics and optionally derived plain textmixed: require both plain and synced lyricsinstrumental: force instrumental upload
Local lyric matching
up searches for two lyric types separately:
- plain candidates:
.txt.lyrics.lyric
- synced candidates:
.lrc
Matching sources include:
- same basename as the audio / YAML file
- YAML-declared filenames
- normalized
Artist - Title.*matches - interactive selection when multiple candidates exist
Important parameters
--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
--lyrics-mode auto|plain|synced|mixed|instrumental
--allow-derived-plain / --no-derived-plain
--ignore-duration-mismatch
--yes
--non-interactive
YAML input format
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
inspect: inspect local matching and classification
inspect shows what the tool would use locally, without publishing.
pylrclib inspect \
--tracks ./music \
--plain-dir ./lyrics_plain \
--synced-dir ./lyrics_lrc \
--show-all-candidates
This is useful for debugging why a track resolved to plain, mixed, or invalid.
cleanse: normalize .lrc files
cleanse cleans synced lyrics safely.
pylrclib cleanse ./lyrics_lrc
pylrclib cleanse ./lyrics_lrc --write
Recommended behavior:
- use
cleanseto preview / analyze normalization - use
--writeonly when you really want to rewrite files in place
Invalid files are not blindly rewritten into empty files.
doctor: diagnose the current workspace
pylrclib doctor \
--tracks ./music \
--plain-dir ./lyrics_plain \
--synced-dir ./lyrics_lrc
doctor prints resolved configuration, counts discovered inputs, and highlights obvious workflow conflicts.
Environment variables
Supported environment variables include:
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_API_BASE
PYLRCLIB_USER_AGENT
PYLRCLIB_PREVIEW_LINES
PYLRCLIB_MAX_HTTP_RETRIES
Development
Install dev dependencies:
pip install -e .[dev]
中文说明
pylrclib 是一个围绕 LRCLIB 的多子命令命令行工具,可用于搜索、下载、检查、清洗和上传歌词。
它把歌词明确建模成四种状态:
plain:纯文本歌词,无时间轴synced:滚动歌词,带时间轴(LRC)mixed:同时拥有纯文本歌词和滚动歌词instrumental:纯音乐 / 无人声
对应的主要命令是:
pylrclib search:搜索 LRCLIB 并预览远端结果pylrclib down:从 LRCLIB 下载歌词到本地pylrclib up:把本地歌词上传到 LRCLIBpylrclib inspect:只检查本地匹配与分类结果pylrclib cleanse:清洗和标准化.lrcpylrclib doctor:诊断工作区和配置问题
search
pylrclib search --query "歌名"
pylrclib search --title "歌名" --artist "歌手"
pylrclib search --lrclib-id 12345
适合用来先确认 LRCLIB 上到底有哪些候选结果,再决定是否下载或上传。
down
down 现在支持三种输入方式:
- 读取本地音频 / YAML 元数据后去 LRCLIB 查询
- 手动指定
--artist/--title - 通过
--lrclib-id精确抓取某一条 LRCLIB 记录
示例:
pylrclib down --tracks ./music --output-dir ./lyrics_downloaded
pylrclib down --artist "歌手" --title "歌名" --output-dir ./lyrics_downloaded
pylrclib down --lrclib-id 12345 --output-dir ./lyrics_downloaded --save-mode both
保存策略:
--save-mode auto|plain|synced|both
auto:有滚动歌词就保存.lrc;只有纯文本就保存.txtplain:只保存.txtsynced:只保存.lrcboth:两种都保存
up
up 会按以下步骤工作:
- 扫描音频文件或 YAML 元数据
- 查询 LRCLIB 缓存与外部歌词候选
- 分别查找本地 plain / synced 歌词
- 自动识别歌词类型
- 根据
--lyrics-mode决定上传策略 - 上传成功后按配置移动或重命名文件
推荐用法:
pylrclib up \
--tracks ./music \
--plain-dir ./lyrics_plain \
--synced-dir ./lyrics_lrc \
--done-lrc ./done_lyrics \
--lyrics-mode auto \
--cleanse
上传策略:
--lyrics-mode auto|plain|synced|mixed|instrumental
默认 auto 的逻辑是:
- 同时有 plain 和 synced:一起上传
- 只有 synced:上传滚动歌词,并可从中派生纯文本歌词
- 只有 plain:只上传纯文本歌词
- 明确识别为纯音乐:按纯音乐上传
- 无效歌词:跳过,不再自动当成纯音乐
inspect / cleanse / doctor
inspect:查看本地匹配到了哪些歌词文件、最终被识别为什么类型cleanse:清洗.lrc,并避免把无效文件误清空doctor:查看解析后的配置和当前目录中的可用输入数量
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.4.1.tar.gz.
File metadata
- Download URL: pylrclib_cli-0.4.1.tar.gz
- Upload date:
- Size: 32.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0a8fc1d4d9916ad2306e0fc126703eccce56b1ff98e38c7bd493b2307cf8a449
|
|
| MD5 |
c318d721bf0c94f3ab840c1082aba861
|
|
| BLAKE2b-256 |
ece3a04a408695843f0cb82048099643c2e2885a94e43ebda20babe37f07423c
|
Provenance
The following attestation bundles were made for pylrclib_cli-0.4.1.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.4.1.tar.gz -
Subject digest:
0a8fc1d4d9916ad2306e0fc126703eccce56b1ff98e38c7bd493b2307cf8a449 - Sigstore transparency entry: 1283024486
- Sigstore integration time:
-
Permalink:
Harmonese/pylrclib@7ee0fb8e50a67d7d78ab6cb1623930996a8c1df5 -
Branch / Tag:
refs/tags/v0.4.1 - Owner: https://github.com/Harmonese
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-publish.yml@7ee0fb8e50a67d7d78ab6cb1623930996a8c1df5 -
Trigger Event:
release
-
Statement type:
File details
Details for the file pylrclib_cli-0.4.1-py3-none-any.whl.
File metadata
- Download URL: pylrclib_cli-0.4.1-py3-none-any.whl
- Upload date:
- Size: 41.4 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 |
3a0c1522da7b1e301341449f2e4552296babc77bb8dbaec42af7321a2b87f2f0
|
|
| MD5 |
f5167556dc281230b9953973375a3a3e
|
|
| BLAKE2b-256 |
15c5b375ef188e0a08d3d1bc66d611e015c69371df0d1f1efa742b3260652e8f
|
Provenance
The following attestation bundles were made for pylrclib_cli-0.4.1-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.4.1-py3-none-any.whl -
Subject digest:
3a0c1522da7b1e301341449f2e4552296babc77bb8dbaec42af7321a2b87f2f0 - Sigstore transparency entry: 1283024492
- Sigstore integration time:
-
Permalink:
Harmonese/pylrclib@7ee0fb8e50a67d7d78ab6cb1623930996a8c1df5 -
Branch / Tag:
refs/tags/v0.4.1 - Owner: https://github.com/Harmonese
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-publish.yml@7ee0fb8e50a67d7d78ab6cb1623930996a8c1df5 -
Trigger Event:
release
-
Statement type: