新增完整歌词相关字段和API支持
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
|
||||
- 新增「设置 → 其他设置 → 主窗口使用软件内置的圆角及阴影」选项(#2360)
|
||||
*默认启用,关闭后将使用系统原生的窗口样式,该选项重启软件后生效*
|
||||
- 开放 API 新增播放器声音大小、静音、播放进度控制,详情看接入文档(#2386)
|
||||
- 开放 API 新增播放器声音大小、静音、播放进度控制、完整歌词获取,详情看接入文档(#2386)
|
||||
- 新增「设置 → 播放设置 → 调换歌词翻译与歌词罗马音位置」选项,默认关闭(#2451)
|
||||
- 新增启动参数 `-hidden`,在启动时将软件最小化到系统托盘(#2459)
|
||||
- 新增 Any Listen 歌词标签数据读取与播放(#2485)
|
||||
|
||||
Vendored
+3
@@ -31,6 +31,9 @@ declare namespace LX {
|
||||
lyricLineText: string
|
||||
lyricLineAllText: string
|
||||
lyric: string
|
||||
tlyric: string
|
||||
rlyric: string
|
||||
lxlyric: string
|
||||
collect: boolean
|
||||
volume: number
|
||||
mute: boolean
|
||||
|
||||
@@ -64,6 +64,9 @@ export const initGlobalData = () => {
|
||||
lyricLineText: '',
|
||||
lyricLineAllText: '',
|
||||
lyric: '',
|
||||
tlyric: '',
|
||||
rlyric: '',
|
||||
lxlyric: '',
|
||||
collect: false,
|
||||
volume: 0,
|
||||
mute: false,
|
||||
|
||||
@@ -52,6 +52,15 @@ const handleSendStatus = (res: http.ServerResponse<http.IncomingMessage>, query?
|
||||
for (const k of keys) resp[k] = global.lx.player_status[k]
|
||||
sendResponse(res, 200, resp, 'application/json; charset=utf-8')
|
||||
}
|
||||
const handleSendAllLyric = (res: http.ServerResponse<http.IncomingMessage>) => {
|
||||
const resp: Partial<Record<SubscribeKeys, any>> = {
|
||||
lyric: global.lx.player_status.lyric,
|
||||
tlyric: global.lx.player_status.tlyric,
|
||||
rlyric: global.lx.player_status.rlyric,
|
||||
lxlyric: global.lx.player_status.lxlyric,
|
||||
}
|
||||
sendResponse(res, 200, resp, 'application/json; charset=utf-8')
|
||||
}
|
||||
const handleSubscribePlayerStatus = (req: http.IncomingMessage, res: http.ServerResponse<http.IncomingMessage>, query?: string) => {
|
||||
res.writeHead(200, {
|
||||
'Content-Type': 'text/event-stream',
|
||||
@@ -130,6 +139,9 @@ const handleStartServer = async(port: number, ip: string) => new Promise<void>((
|
||||
case '/lyric':
|
||||
msg = global.lx.player_status.lyric
|
||||
break
|
||||
case '/lyric-all':
|
||||
handleSendAllLyric(res)
|
||||
return
|
||||
case '/play':
|
||||
sendTaskbarButtonClick('play')
|
||||
break
|
||||
|
||||
@@ -52,6 +52,9 @@ export default () => {
|
||||
const handleSetLyric = () => {
|
||||
sendPlayerStatus({
|
||||
lyric: musicInfo.lrc ?? '',
|
||||
tlyric: musicInfo.tlrc ?? '',
|
||||
rlyric: musicInfo.rlrc ?? '',
|
||||
lxlyric: musicInfo.lxlrc ?? '',
|
||||
lyricLineText: '',
|
||||
lyricLineAllText: '',
|
||||
})
|
||||
@@ -188,6 +191,9 @@ export default () => {
|
||||
playbackRate: appSetting['player.playbackRate'],
|
||||
picUrl: musicInfo.pic ?? '',
|
||||
lyric: musicInfo.lrc ?? '',
|
||||
tlyric: musicInfo.tlrc ?? '',
|
||||
rlyric: musicInfo.rlrc ?? '',
|
||||
lxlyric: musicInfo.lxlrc ?? '',
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user