Revert "Revert "LastFM can be unique and have its own call""

This reverts commit f156083d48.
This commit is contained in:
Core 2022-02-17 01:06:47 +00:00
parent 604ef16db8
commit cb82ff482d
No known key found for this signature in database
GPG key ID: FE9BF1B547F8F3C6
3 changed files with 8 additions and 2 deletions

View file

@ -69,6 +69,10 @@ ipcMain.on('nowPlayingItemDidChange', (_event, attributes) => {
CiderPlug.callPlugins('onNowPlayingItemDidChange', attributes); CiderPlug.callPlugins('onNowPlayingItemDidChange', attributes);
}); });
ipcMain.on('lfmItemChange', (_event, attributes) => {
CiderPlug.callPlugins('lfmItemChange', attributes);
});
app.on('before-quit', () => { app.on('before-quit', () => {
CiderPlug.callPlugins('onBeforeQuit'); CiderPlug.callPlugins('onBeforeQuit');
console.warn(`${app.getName()} exited.`); console.warn(`${app.getName()} exited.`);

View file

@ -265,7 +265,7 @@ export default class LastFMPlugin {
* Runs on song change * Runs on song change
* @param attributes Music Attributes * @param attributes Music Attributes
*/ */
onNowPlayingItemDidChange(attributes: object): void { lfmItemChange(attributes: object): void {
if (!this._store.lastfm.filterLoop){ if (!this._store.lastfm.filterLoop){
this._lastfm.cachedNowPlayingAttributes = false; this._lastfm.cachedNowPlayingAttributes = false;
this._lastfm.cachedAttributes = false} this._lastfm.cachedAttributes = false}

View file

@ -25,8 +25,10 @@ const MusicKitInterop = {
MusicKit.getInstance().addEventListener(MusicKit.Events.nowPlayingItemDidChange, async () => { MusicKit.getInstance().addEventListener(MusicKit.Events.nowPlayingItemDidChange, async () => {
// await MusicKitInterop.modifyNamesOnLocale(); // await MusicKitInterop.modifyNamesOnLocale();
if (MusicKitInterop.filterTrack(MusicKitInterop.getAttributes(), false, true) || !app.cfg.lastfm.filterLoop) { 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, () => { MusicKit.getInstance().addEventListener(MusicKit.Events.authorizationStatusDidChange, () => {