LastFM Scrobbling
This commit is contained in:
parent
df6ba93242
commit
130cfed2b4
7 changed files with 331 additions and 22 deletions
68
index.js
68
index.js
|
@ -1,5 +1,7 @@
|
|||
require('v8-compile-cache');
|
||||
const { app } = require('electron');
|
||||
const { app } = require('electron'),
|
||||
{resolve} = require("path"),
|
||||
CiderBase = require ('./src/main/cider-base');
|
||||
|
||||
// Analytics for debugging.
|
||||
const ElectronSentry = require("@sentry/electron");
|
||||
|
@ -33,9 +35,11 @@ const configSchema = {
|
|||
"enable_yt": false,
|
||||
},
|
||||
"lastfm": {
|
||||
"enabled": true,
|
||||
"enabled": false,
|
||||
"scrobble_after": 30,
|
||||
"auth_token": ""
|
||||
"auth_token": "",
|
||||
"enabledRemoveFeaturingArtists" : true,
|
||||
"NowPlaying": "true"
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -119,4 +123,60 @@ app.on('widevine-update-pending', (currentVersion, pendingVersion) => {
|
|||
app.on('widevine-error', (error) => {
|
||||
console.log('[Cider][Widevine] Widevine installation encountered an error: ' + error)
|
||||
app.exit()
|
||||
})
|
||||
})
|
||||
|
||||
if (process.defaultApp) {
|
||||
if (process.argv.length >= 2) {
|
||||
app.setAsDefaultProtocolClient('cider', process.execPath, [resolve(process.argv[1])])
|
||||
app.setAsDefaultProtocolClient('ame', process.execPath, [resolve(process.argv[1])])
|
||||
app.setAsDefaultProtocolClient('itms', process.execPath, [resolve(process.argv[1])])
|
||||
app.setAsDefaultProtocolClient('itmss', process.execPath, [resolve(process.argv[1])])
|
||||
app.setAsDefaultProtocolClient('musics', process.execPath, [resolve(process.argv[1])])
|
||||
app.setAsDefaultProtocolClient('music', process.execPath, [resolve(process.argv[1])])
|
||||
}
|
||||
} else {
|
||||
app.setAsDefaultProtocolClient('cider') // Custom AME Protocol
|
||||
app.setAsDefaultProtocolClient('ame') // Custom AME Protocol
|
||||
app.setAsDefaultProtocolClient('itms') // iTunes HTTP Protocol
|
||||
app.setAsDefaultProtocolClient('itmss') // iTunes HTTPS Protocol
|
||||
app.setAsDefaultProtocolClient('musics') // macOS Client Protocol
|
||||
app.setAsDefaultProtocolClient('music') // macOS Client Protocol
|
||||
}
|
||||
|
||||
app.on('open-url', (event, url) => {
|
||||
event.preventDefault()
|
||||
if (url.includes('ame://') || url.includes('itms://') || url.includes('itmss://') || url.includes('musics://') || url.includes('music://')) {
|
||||
CiderBase.LinkHandler(url)
|
||||
}
|
||||
})
|
||||
|
||||
app.on('second-instance', (_e, argv) => {
|
||||
console.warn(`[InstanceHandler][SecondInstanceHandler] Second Instance Started with args: [${argv.join(', ')}]`)
|
||||
|
||||
// Checks if first instance is authorized and if second instance has protocol args
|
||||
argv.forEach((value) => {
|
||||
if (value.includes('ame://') || value.includes('itms://') || value.includes('itmss://') || value.includes('musics://') || value.includes('music://')) {
|
||||
console.warn(`[InstanceHandler][SecondInstanceHandler] Found Protocol!`)
|
||||
CiderBase.LinkHandler(value);
|
||||
}
|
||||
})
|
||||
|
||||
if (argv.includes("--force-quit")) {
|
||||
console.warn('[InstanceHandler][SecondInstanceHandler] Force Quit found. Quitting App.');
|
||||
// app.isQuiting = true
|
||||
app.quit()
|
||||
} else if (CiderBase.win && true) { // If a Second Instance has Been Started
|
||||
console.warn('[InstanceHandler][SecondInstanceHandler] Showing window.');
|
||||
app.win.show()
|
||||
app.win.focus()
|
||||
}
|
||||
})
|
||||
|
||||
if (!app.requestSingleInstanceLock() && true) {
|
||||
console.warn("[InstanceHandler] Existing Instance is Blocking Second Instance.");
|
||||
app.quit();
|
||||
// app.isQuiting = true
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue