From cb82ff482d0c918a17cdd3f7c9f8558e8848e763 Mon Sep 17 00:00:00 2001 From: Core <64542347+coredev-uk@users.noreply.github.com> Date: Thu, 17 Feb 2022 01:06:47 +0000 Subject: [PATCH] Revert "Revert "LastFM can be unique and have its own call"" This reverts commit f156083d48f866fcd69d590794a33e0b25c8d95d. --- src/main/index.ts | 4 ++++ src/main/plugins/lastfm.ts | 2 +- src/preload/cider-preload.js | 4 +++- 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/main/index.ts b/src/main/index.ts index 7038f483..9e0d53d9 100644 --- a/src/main/index.ts +++ b/src/main/index.ts @@ -69,6 +69,10 @@ ipcMain.on('nowPlayingItemDidChange', (_event, attributes) => { CiderPlug.callPlugins('onNowPlayingItemDidChange', attributes); }); +ipcMain.on('lfmItemChange', (_event, attributes) => { + CiderPlug.callPlugins('lfmItemChange', attributes); +}); + app.on('before-quit', () => { CiderPlug.callPlugins('onBeforeQuit'); console.warn(`${app.getName()} exited.`); diff --git a/src/main/plugins/lastfm.ts b/src/main/plugins/lastfm.ts index 6110ad31..5e871f3b 100644 --- a/src/main/plugins/lastfm.ts +++ b/src/main/plugins/lastfm.ts @@ -265,7 +265,7 @@ export default class LastFMPlugin { * Runs on song change * @param attributes Music Attributes */ - onNowPlayingItemDidChange(attributes: object): void { + lfmItemChange(attributes: object): void { if (!this._store.lastfm.filterLoop){ this._lastfm.cachedNowPlayingAttributes = false; this._lastfm.cachedAttributes = false} diff --git a/src/preload/cider-preload.js b/src/preload/cider-preload.js index bf6f2924..47441d25 100644 --- a/src/preload/cider-preload.js +++ b/src/preload/cider-preload.js @@ -25,8 +25,10 @@ const MusicKitInterop = { MusicKit.getInstance().addEventListener(MusicKit.Events.nowPlayingItemDidChange, async () => { // await MusicKitInterop.modifyNamesOnLocale(); if (MusicKitInterop.filterTrack(MusicKitInterop.getAttributes(), false, true) || !app.cfg.lastfm.filterLoop) { - global.ipcRenderer.send('nowPlayingItemDidChange', MusicKitInterop.getAttributes()); + global.ipcRenderer.send('lfmItemChange', MusicKitInterop.getAttributes()); } + + global.ipcRenderer.send('nowPlayingItemDidChange', MusicKitInterop.getAttributes()); }); MusicKit.getInstance().addEventListener(MusicKit.Events.authorizationStatusDidChange, () => {