Private implemented
This commit is contained in:
parent
4defeb82f0
commit
23ad2640dc
2 changed files with 30 additions and 34 deletions
|
@ -1,18 +1,19 @@
|
||||||
require('v8-compile-cache');
|
require("v8-compile-cache");
|
||||||
|
|
||||||
const {app, components, ipcMain} = require('electron');
|
|
||||||
import {join} from 'path';
|
|
||||||
|
|
||||||
|
import {join} from "path";
|
||||||
|
import {app} from "electron"
|
||||||
if (!app.isPackaged) {
|
if (!app.isPackaged) {
|
||||||
app.setPath('userData', join(app.getPath('appData'), 'Cider'));
|
app.setPath("userData", join(app.getPath("appData"), "Cider"));
|
||||||
}
|
}
|
||||||
|
|
||||||
import {Store} from "./base/store";
|
import {Store} from "./base/store";
|
||||||
import {AppEvents} from "./base/app";
|
import {AppEvents} from "./base/app";
|
||||||
import {Plugins} from "./base/plugins";
|
import {Plugins} from "./base/plugins";
|
||||||
import {BrowserWindow} from "./base/browserwindow";
|
import {BrowserWindow} from "./base/browserwindow";
|
||||||
import {init as Sentry} from '@sentry/electron';
|
import {init as Sentry} from "@sentry/electron";
|
||||||
import {RewriteFrames} from "@sentry/integrations";
|
import {RewriteFrames} from "@sentry/integrations";
|
||||||
|
import {components, ipcMain} from "electron"
|
||||||
|
|
||||||
|
|
||||||
// Analytics for debugging fun yeah.
|
// Analytics for debugging fun yeah.
|
||||||
Sentry({
|
Sentry({
|
||||||
|
@ -32,13 +33,13 @@ const CiderPlug = new Plugins();
|
||||||
* App Event Handlers
|
* App Event Handlers
|
||||||
* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
|
* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
|
||||||
|
|
||||||
app.on('ready', () => {
|
app.on("ready", () => {
|
||||||
Cider.ready(CiderPlug);
|
Cider.ready(CiderPlug);
|
||||||
|
|
||||||
console.log('[Cider] Application is Ready. Creating Window.')
|
console.log("[Cider] Application is Ready. Creating Window.")
|
||||||
if (!app.isPackaged) {
|
if (!app.isPackaged) {
|
||||||
console.info('[Cider] Running in development mode.')
|
console.info("[Cider] Running in development mode.")
|
||||||
require('vue-devtools').install()
|
require("vue-devtools").install()
|
||||||
}
|
}
|
||||||
|
|
||||||
components.whenReady().then(async () => {
|
components.whenReady().then(async () => {
|
||||||
|
@ -49,11 +50,11 @@ app.on('ready', () => {
|
||||||
console.log(gpuInfo)
|
console.log(gpuInfo)
|
||||||
})
|
})
|
||||||
|
|
||||||
console.log('[Cider][Widevine] Status:', components.status());
|
console.log("[Cider][Widevine] Status:", components.status());
|
||||||
Cider.bwCreated();
|
Cider.bwCreated();
|
||||||
win.on("ready-to-show", () => {
|
win.on("ready-to-show", () => {
|
||||||
console.debug('[Cider] Window is Ready.')
|
console.debug("[Cider] Window is Ready.")
|
||||||
CiderPlug.callPlugins('onReady', win);
|
CiderPlug.callPlugins("onReady", win);
|
||||||
win.show();
|
win.show();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@ -68,20 +69,20 @@ ipcMain.handle("renderer-ready", (event) => {
|
||||||
CiderPlug.callPlugins("onRendererReady", event);
|
CiderPlug.callPlugins("onRendererReady", event);
|
||||||
})
|
})
|
||||||
|
|
||||||
ipcMain.on('playbackStateDidChange', (_event, attributes) => {
|
ipcMain.on("playbackStateDidChange", (_event, attributes) => {
|
||||||
CiderPlug.callPlugins('onPlaybackStateDidChange', attributes);
|
CiderPlug.callPlugins("onPlaybackStateDidChange", attributes);
|
||||||
});
|
});
|
||||||
|
|
||||||
ipcMain.on('nowPlayingItemDidChange', (_event, attributes) => {
|
ipcMain.on("nowPlayingItemDidChange", (_event, attributes) => {
|
||||||
CiderPlug.callPlugins('onNowPlayingItemDidChange', attributes);
|
CiderPlug.callPlugins("onNowPlayingItemDidChange", attributes);
|
||||||
});
|
});
|
||||||
|
|
||||||
ipcMain.on('nowPlayingItemDidChangeLastFM', (_event, attributes) => {
|
ipcMain.on("nowPlayingItemDidChangeLastFM", (_event, attributes) => {
|
||||||
CiderPlug.callPlugin('lastfm.js', 'nowPlayingItemDidChangeLastFM', attributes);
|
CiderPlug.callPlugin("lastfm.js", "nowPlayingItemDidChangeLastFM", 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.`);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -90,21 +91,21 @@ app.on('before-quit', () => {
|
||||||
* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
|
* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
|
||||||
|
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
app.on('widevine-ready', (version, lastVersion) => {
|
app.on("widevine-ready", (version, lastVersion) => {
|
||||||
if (null !== lastVersion) {
|
if (null !== lastVersion) {
|
||||||
console.log('[Cider][Widevine] Widevine ' + version + ', upgraded from ' + lastVersion + ', is ready to be used!')
|
console.log("[Cider][Widevine] Widevine " + version + ", upgraded from " + lastVersion + ", is ready to be used!")
|
||||||
} else {
|
} else {
|
||||||
console.log('[Cider][Widevine] Widevine ' + version + ' is ready to be used!')
|
console.log("[Cider][Widevine] Widevine " + version + " is ready to be used!")
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
app.on('widevine-update-pending', (currentVersion, pendingVersion) => {
|
app.on("widevine-update-pending", (currentVersion, pendingVersion) => {
|
||||||
console.log('[Cider][Widevine] Widevine ' + currentVersion + ' is ready to be upgraded to ' + pendingVersion + '!')
|
console.log("[Cider][Widevine] Widevine " + currentVersion + " is ready to be upgraded to " + pendingVersion + "!")
|
||||||
})
|
})
|
||||||
|
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
app.on('widevine-error', (error) => {
|
app.on("widevine-error", (error) => {
|
||||||
console.log('[Cider][Widevine] Widevine installation encountered an error: ' + error)
|
console.log("[Cider][Widevine] Widevine installation encountered an error: " + error)
|
||||||
app.exit()
|
app.exit()
|
||||||
})
|
})
|
||||||
|
|
|
@ -1,9 +1,3 @@
|
||||||
// https://github.com/maxkueng/node-lastfmapi
|
|
||||||
// https://github.com/maxkueng/lastfm-autocorrect
|
|
||||||
// @todo: add autocorrect
|
|
||||||
// @todo: add scrobble and filter to prevent no-title-found being scrobbled
|
|
||||||
// @todo: handle session keys through config to stop aids session.json
|
|
||||||
|
|
||||||
export default class lastfm {
|
export default class lastfm {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -74,6 +68,7 @@ export default class lastfm {
|
||||||
* @param attributes Music Attributes
|
* @param attributes Music Attributes
|
||||||
*/
|
*/
|
||||||
onNowPlayingItemDidChange(attributes: any): void {
|
onNowPlayingItemDidChange(attributes: any): void {
|
||||||
|
if (this._utils.getStoreValue("general.privateEnabled")) return;
|
||||||
this._attributes = attributes
|
this._attributes = attributes
|
||||||
if (!attributes?.lfmTrack || !attributes?.lfmAlbum) {
|
if (!attributes?.lfmTrack || !attributes?.lfmAlbum) {
|
||||||
this.verifyTrack(attributes)
|
this.verifyTrack(attributes)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue