linux is cooollll
This commit is contained in:
parent
c219758207
commit
2a9a5c68ff
3 changed files with 8 additions and 15 deletions
|
@ -76,10 +76,6 @@ ipcMain.on("nowPlayingItemDidChange", (_event, attributes) => {
|
|||
CiderPlug.callPlugins("onNowPlayingItemDidChange", attributes);
|
||||
});
|
||||
|
||||
ipcMain.on("updatePlaybackProgress", (_event, attributes) => {
|
||||
CiderPlug.callPlugins("updatePlaybackProgress", attributes);
|
||||
})
|
||||
|
||||
app.on("before-quit", () => {
|
||||
CiderPlug.callPlugins("onBeforeQuit");
|
||||
console.warn(`${app.getName()} exited.`);
|
||||
|
|
|
@ -10,8 +10,6 @@ export default class mpris {
|
|||
* MPRIS Service
|
||||
*/
|
||||
private static player: Player.Player;
|
||||
private static globalAttributes: any = {}
|
||||
|
||||
/**
|
||||
* Base Plugin Details (Eventually implemented into a GUI in settings)
|
||||
*/
|
||||
|
@ -76,6 +74,10 @@ export default class mpris {
|
|||
player.on('loopStatus', (status: string) => renderer.executeJavaScript(`app.mk.repeatMode = ${loopType[status.toLowerCase()]}`))
|
||||
player.on('shuffle', () => renderer.executeJavaScript('app.mk.shuffleMode = (app.mk.shuffleMode === 0) ? 1 : 0'))
|
||||
|
||||
mpris.utils.getIPCMain().on('mpris:playbackTimeDidChange', (event: any, time: number) => {
|
||||
player.getPosition = () => time;
|
||||
})
|
||||
|
||||
mpris.utils.getIPCMain().on('repeatModeDidChange', (_e: any, mode: number) => {
|
||||
switch (mode) {
|
||||
case 0:
|
||||
|
@ -160,7 +162,6 @@ export default class mpris {
|
|||
*/
|
||||
@mpris.linuxOnly
|
||||
onPlaybackStateDidChange(attributes: any): void {
|
||||
mpris.globalAttributes = attributes
|
||||
mpris.player.playbackStatus = attributes?.status ? Player.PLAYBACK_STATUS_PLAYING : Player.PLAYBACK_STATUS_PAUSED
|
||||
}
|
||||
|
||||
|
@ -170,14 +171,7 @@ export default class mpris {
|
|||
*/
|
||||
@mpris.linuxOnly
|
||||
onNowPlayingItemDidChange(attributes: object): void {
|
||||
mpris.globalAttributes = attributes
|
||||
mpris.updateMetaData(attributes);
|
||||
}
|
||||
|
||||
@mpris.linuxOnly
|
||||
updatePlaybackProgress(attributes: any): void {
|
||||
mpris.globalAttributes = attributes
|
||||
mpris.player.getPosition = () => attributes.currentPlaybackTime * 1000 * 1000;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue