Repository navigation
feat: 扩展 Linux MPRIS 媒体元数据以支持外部实时歌词组件 - #427
Open
BHLuotianyi wants to merge 3 commits into
Open
BHLuotianyi wants to merge 3 commits into
BHLuotianyi wants to merge 3 commits into
Conversation
- 在 native/media-ctrl 中补全 xesam:url 与 xesam:asText (歌词) 的输出 - 新增 resolveTrackMprisUrl 支持网易云、QQ音乐、酷狗、本地文件等多来源规范 URL 解析 - 监听 nowPlaying 歌词变更事件,实时同步文本歌词至 MPRIS 属性 - 新增 system.media.mprisExtendedMetadata 设置开关项与中英文国际化配置 - 完善单元测试与 CUE / 凭据安全过滤逻辑
BHLuotianyi
marked this pull request as ready for review
October 28, 2026 10:27
This branch has not been deployed
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.
改动类型
是否包含破坏性变更
改动说明
动机
在 Linux 桌面环境下,外部组件(如 KDE Plasma 多媒体小部件、GNOME 扩展、Waybar、Quickshell 等桌面/顶栏组件)普遍通过 MPRIS 规范读取当前播放状态。
此前 SPlayer-Next 的 MPRIS 实现仅输出了基础的
title、artist、album、artUrl,缺少了歌曲链接(xesam:url)以及动态歌词文本(xesam:asText),导致外部桌面扩展无法直接跳转歌曲页面或展示同步歌词。主要变更
native/media-ctrl):MetadataParam与MetadataPayload中增加可选的url与lyrics字段;sys_media/linux.rs的process_metadata中通过mpris-server向 D-Bus 输出xesam:url与xesam:asText。electron/main/utils/metadata.ts):resolveTrackMprisUrl,支持根据曲目所属平台生成标准链接:https://music.163.com/song?id=...https://y.qq.com/n/ryqq/songDetail/...(规范使用songmid)https://www.kugou.com/song/#hash=...file:///协议 URL,且优先提取cueAudioPath规避 CUE 分轨虚拟路径electron/main/services/media.ts):nowPlaying.onLyricChange事件,曲目歌词匹配解析就绪后,自动将纯文本提取并热更新至 MPRISxesam:asText属性;ipc/config.ts、前端设置与国际化):system.media下增加mprisExtendedMetadata配置项(默认启用,仅 Linux 平台可见;仅在启用“系统媒体控制”时生效);applyConfigChange中接入开关变化处理,开关切换时无需切歌即可即时重构并广播当前元数据;zh-CN.json与en-US.json对应的多语言说明。测试情况
更改过的源码在本地(Hyprland @ 7.3.0-4-cachyos)编译后人工确认新增与现有功能运行无误。
pnpm typecheck、pnpm lint通过运行
pnpm test:50 项 Node 测试 + 496 项 Web 测试全量通过截图 / 录屏
BEFORE: 外部桌面组件因无法得到歌曲ID,无从通过其他外部服务获取实时歌词
AFTER:可以通过歌曲ID从第三方获取到实时歌词;新增设置项如图
自查清单
pnpm format,并确认pnpm typecheck、pnpm lint通过pnpm build:native验证;未手写native/*/index.d.tsdev分支提交