feat: --lrc to export sibling .lrc files alongside audio#2
Open
CPbianma wants to merge 1 commit into
Open
Conversation
External-lyric-aware players (PotPlayer, foobar2000, car head units, etc.) expect a same-stem .lrc file next to the audio. The fetched LRC is already embedded as a FLAC LYRICS tag; this just dumps it as UTF-8 to <stem>.lrc when --lrc is passed. Exposed on `download`, `decrypt`, and `album`. The write_metadata return dict gains an "lrc" boolean indicating whether the side-car was written. Translation, if QQ returns one, is appended to the .lrc the same way it's embedded in the tag. Note: on `download` this currently doesn't fire because the existing fetch_metadata(song_mid) path silently returns None for most mids (search endpoint misbehavior). That's a separate bug filed as a companion PR; once that's merged --lrc kicks in for `download` too. On `album` it works today.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
External-lyric-aware players (PotPlayer, foobar2000, car head units,
…) expect a same-stem
.lrcfile next to the audio. The fetched LRCis already embedded as a FLAC
LYRICStag; this just dumps it asUTF-8 to
<stem>.lrcwhen--lrcis passed.Exposed on
download,decrypt, andalbum. Thewrite_metadatareturn dict gains an
"lrc"boolean indicating whether the side-carwas written. Translation, if QQ returns one, is appended to the
.lrcthe same way it's embedded in the tag.Note on ordering
This PR is independent and safe to merge on its own, but on the
downloadcommand the side-car only materializes once the companionfix PR (#1) is merged — without that fix,
fetch_metadatareturnsNone for most mids and we never reach the write-lyrics branch. On
albumthe side-car works today.Risk
write_metadatasignature is backwards-compatible (new param iskeyword-only with a default).
"lrc"is purely additive.Test
qmdec album <singer_mid> -o ./out -q flac --lrcon this branchproduces
.lrcfiles alongside each.flac. The generated.lrcisvalid (
[ti]/[ar]/[al]/[mm:ss.xx]) and UTF-8.With both PRs applied,
qmdec download "周杰伦 晴天" -o ./out -q flac --lrcproduces a 2.6 KB.lrcalongside the FLAC, content matchesthe FLAC's embedded
LYRICStag verbatim.中文说明
外挂歌词播放器 (PotPlayer、foobar2000、车机等) 习惯读取与音频文件同
名的
.lrc。我们已经把歌词写进 FLAC 的LYRICS标签里了; 这个 PR 只是在
--lrc开关打开时额外把它落到<stem>.lrc(UTF-8)。download/decrypt/album三条命令都加了--lrc开关。write_metadata返回 dict 新增"lrc"字段标记是否落盘。如果 QQ接口返回了翻译,
.lrc末尾也会拼接, 跟内嵌标签一致。关于合并顺序
本 PR 独立可合, 但
download命令上的.lrc落盘需要先合配套的fix PR (#1) —— 没那个 fix,
fetch_metadata对大多数 mid 返回 None,连写歌词的分支都不会走到。
album命令上目前就能用。