feat: merge cover and lyrics extraction into single TagLib pass with concurrent processing#720
Conversation
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: kt286 The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
|
Hi @kt286. Thanks for your PR. I'm waiting for a linuxdeepin member to verify that this patch is reasonable to test. If it is, they should reply with Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. DetailsInstructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
Reviewer's GuideAdds a new AudioAnalysis::parseMetaCoverAndLyrics() routine that extracts cover art and lyrics in a single TagLib pass with FFmpeg fallback for covers, and wires it into DBOperate via QtConcurrent-based parallel batch processing while updating build configuration to link QtConcurrent and MPRIS conditionally on Linux. Sequence diagram for parallel cover and lyrics extraction via parseMetaCoverAndLyricssequenceDiagram
participant DBOperate
participant QtConcurrent
participant AudioAnalysis
participant TagLib
participant FFmpeg
DBOperate->>DBOperate: slotImportMetas(urls, metaHash)
DBOperate->>DBOperate: collect pendingCovers
DBOperate->>DBOperate: processPendingCovers(pendingCovers)
DBOperate->>QtConcurrent: map(pendingCovers, parseMetaCoverAndLyrics)
activate QtConcurrent
loop for each MediaMeta in pendingCovers (in parallel)
QtConcurrent->>AudioAnalysis: parseMetaCoverAndLyrics(meta)
activate AudioAnalysis
AudioAnalysis->>AudioAnalysis: check cache for cover/lyrics
alt [not fully cached]
AudioAnalysis->>TagLib: open MPEG::File(path)
alt [TagLib file valid]
AudioAnalysis->>TagLib: read APIC frame (cover)
AudioAnalysis->>TagLib: read SYLT/USLT frames (lyrics)
alt [cover not found via TagLib]
AudioAnalysis->>FFmpeg: avformat_open_input(path)
AudioAnalysis->>FFmpeg: scan streams for attached_pic
FFmpeg-->>AudioAnalysis: cover image data
end
end
end
AudioAnalysis-->>QtConcurrent: meta updated (coverUrl, hasimage, lyricPath)
deactivate AudioAnalysis
end
QtConcurrent-->>DBOperate: all metas updated
deactivate QtConcurrent
loop batches of size 8
DBOperate->>DBOperate: emit signalMetaCoverReady(meta) for each in batch
end
DBOperate->>DBOperate: emit signalCoverBatchFinished()
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this comment.
Hey - I've left some high level feedback:
- The cache directory setup in parseMetaCoverAndLyrics() mixes manual cdUp()/mkdir() for images with mkpath() for lyrics; consider using QDir().mkpath() consistently for both to avoid fragile parent-directory assumptions and simplify the logic.
- In the FFmpeg fallback path inside parseMetaCoverAndLyrics(), the dynamic symbol resolution (DynamicLibraries::instance()->resolve) runs for every file and now potentially in parallel; consider caching these function pointers once at a higher level or as static locals to avoid repeated, concurrent lookups on the same symbols.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- The cache directory setup in parseMetaCoverAndLyrics() mixes manual cdUp()/mkdir() for images with mkpath() for lyrics; consider using QDir().mkpath() consistently for both to avoid fragile parent-directory assumptions and simplify the logic.
- In the FFmpeg fallback path inside parseMetaCoverAndLyrics(), the dynamic symbol resolution (DynamicLibraries::instance()->resolve) runs for every file and now potentially in parallel; consider caching these function pointers once at a higher level or as static locals to avoid repeated, concurrent lookups on the same symbols.Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
05dd233 to
18410af
Compare
…concurrent processing - Add parseMetaCoverAndLyrics() to extract cover art and lyrics in one TagLib file-open, reducing redundant I/O - Fall back to FFmpeg for cover extraction when TagLib APIC frame is empty - Add QtConcurrent-based concurrent cover processing in DBOperate for batch imports - Conditionally link MPRIS only on Linux, add Qt6::Concurrent module feat: 将封面和歌词提取合并为单次 TagLib 读取,并支持并发处理 - 新增 parseMetaCoverAndLyrics() 方法,在一次 TagLib 文件打开中同时提取封面和歌词,减少重复 I/O - 当 TagLib APIC 帧为空时,回退到 FFmpeg 提取封面 - 在 DBOperate 中添加基于 QtConcurrent 的并发封面处理,用于批量导入 - 仅在 Linux 上链接 MPRIS,添加 Qt6::Concurrent 模块
18410af to
f89ca6c
Compare
…concurrent processing
feat: 将封面和歌词提取合并为单次 TagLib 读取,并支持并发处理
Summary by Sourcery
Unify cover art and lyrics extraction into a single metadata pass and process pending covers concurrently during batch imports, while updating build configuration for conditional MPRIS linking and QtConcurrent support.
New Features:
Enhancements:
Build: