mirror of
https://github.com/GiriNeko/YesPlayMusic.git
synced 2025-12-17 13:48:02 +00:00
feat: updates
This commit is contained in:
parent
196a974a64
commit
8f4c3d8e5b
24 changed files with 572 additions and 93 deletions
|
|
@ -12,6 +12,7 @@ import { Thumbar } from './windowsTaskbar'
|
|||
import fastFolderSize from 'fast-folder-size'
|
||||
import path from 'path'
|
||||
import prettyBytes from 'pretty-bytes'
|
||||
import { getCoverVideo } from './appleMusic'
|
||||
|
||||
const on = <T extends keyof IpcChannelsParams>(
|
||||
channel: T,
|
||||
|
|
@ -20,6 +21,16 @@ const on = <T extends keyof IpcChannelsParams>(
|
|||
ipcMain.on(channel, listener)
|
||||
}
|
||||
|
||||
const handle = <T extends keyof IpcChannelsParams>(
|
||||
channel: T,
|
||||
listener: (
|
||||
event: Electron.IpcMainInvokeEvent,
|
||||
params: IpcChannelsParams[T]
|
||||
) => void
|
||||
) => {
|
||||
return ipcMain.handle(channel, listener)
|
||||
}
|
||||
|
||||
export function initIpcMain(
|
||||
win: BrowserWindow | null,
|
||||
tray: YPMTray | null,
|
||||
|
|
@ -143,6 +154,22 @@ function initOtherIpcMain() {
|
|||
)
|
||||
})
|
||||
|
||||
/**
|
||||
* 缓存动态专辑封面
|
||||
*/
|
||||
on(IpcChannels.SetVideoCover, (event, args) => {
|
||||
const { id, url } = args
|
||||
cache.set(APIs.VideoCover, { id, url })
|
||||
})
|
||||
|
||||
/**
|
||||
* 获取动态专辑封面
|
||||
*/
|
||||
on(IpcChannels.GetVideoCover, (event, args) => {
|
||||
const { id } = args
|
||||
event.returnValue = cache.get(APIs.VideoCover, { id })
|
||||
})
|
||||
|
||||
/**
|
||||
* 导出tables到json文件,方便查看table大小(dev环境)
|
||||
*/
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue