Skip to content

fix: exact mid lookup via trackInfo API + --lrc for external lyrics#3

Open
CPbianma wants to merge 1 commit into
Sophomoresty:mainfrom
CPbianma:fix/trackinfo-api
Open

fix: exact mid lookup via trackInfo API + --lrc for external lyrics#3
CPbianma wants to merge 1 commit into
Sophomoresty:mainfrom
CPbianma:fix/trackinfo-api

Conversation

@CPbianma

@CPbianma CPbianma commented Jul 2, 2026

Copy link
Copy Markdown

@

Summary

Two changes in one PR (supersedes both #1 and #2):

1. Fix: replace broken search-by-mid with exact trackInfo API

Root cause: music.search.SearchCgiService performs fuzzy text matching, not exact mid lookup. A mid like 0039MnYb0qxYhV matches the substring b0 in unrelated song metadata. Neither iterating through results (the #1 approach) nor sanity-checking can work — the correct song is simply never in the result set.

Fix: Replace fetch_song_detail to use music.trackInfo.UniformRuleCtrl / CgiGetTrackInfo, which does exact matching by mid and always returns the correct track.

2. Feature: --lrc flag for external lyric files

Adds --lrc to decrypt, download, and album commands. When set, write_metadata writes a sibling .lrc file (UTF-8, timed LRC with optional Chinese translation) alongside the audio file.

Testing

$ qmdec download "晴天" -q 128 --lrc -o ./out
# → 晴天 - 周杰伦.mp3  (4.2 MB, tagged)
# → 晴天 - 周杰伦.lrc  (2615 bytes, timed lyrics)

All metadata fields verified: title, artist, album, year, genre, language, track/disc numbers, cover art, lyrics.

🤖 Generated with Claude Code
@

fix: use trackInfo API for exact mid lookup, add --lrc for external lyrics

Replace the broken search-by-mid endpoint in fetch_song_detail with
music.trackInfo.UniformRuleCtrl, which does exact mid matching. The old
search API (music.search.SearchCgiService) performs fuzzy text matching
on the query string — a mid like "0039MnYb0qxYhV" matches songs whose
metadata contains "b0", returning completely unrelated results. This
affected the decrypt path where only song_mid is available.

Also add --lrc flag to decrypt, download, and album commands. When set,
write_metadata dumps fetched lyrics as a sibling .lrc file (UTF-8,
timed LRC with optional Chinese translation) alongside the audio file
for external-lyric-aware players.

Co-Authored-By: Claude <noreply@anthropic.com>
@
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant