Backend implementation of filter media type
This commit is contained in:
parent
7e6f3bd17e
commit
873c626096
2 changed files with 6 additions and 5 deletions
|
@ -131,6 +131,7 @@ export class Store {
|
||||||
"enabled": false,
|
"enabled": false,
|
||||||
"scrobble_after": 50,
|
"scrobble_after": 50,
|
||||||
"filter_loop": false,
|
"filter_loop": false,
|
||||||
|
"filter_types": [],
|
||||||
"secrets": {
|
"secrets": {
|
||||||
"username": "",
|
"username": "",
|
||||||
"key": ""
|
"key": ""
|
||||||
|
|
|
@ -34,10 +34,10 @@ export default class lastfm {
|
||||||
this.initializeLastFM("", this._apiCredentials)
|
this.initializeLastFM("", this._apiCredentials)
|
||||||
}
|
}
|
||||||
|
|
||||||
onReady(win: Electron.BrowserWindow): void {
|
onReady(_win: Electron.BrowserWindow): void {
|
||||||
|
|
||||||
// Register the ipcMain handlers
|
// Register the ipcMain handlers
|
||||||
this._utils.getIPCMain().handle('lastfm:url', (event: any) => {
|
this._utils.getIPCMain().handle('lastfm:url', (_event: any) => {
|
||||||
// console.debug('lastfm:url', event)
|
// console.debug('lastfm:url', event)
|
||||||
return this._lfm.getAuthenticationUrl({"cb": "cider://auth/lastfm"})
|
return this._lfm.getAuthenticationUrl({"cb": "cider://auth/lastfm"})
|
||||||
})
|
})
|
||||||
|
@ -47,7 +47,7 @@ export default class lastfm {
|
||||||
this.authenticateLastFM(token)
|
this.authenticateLastFM(token)
|
||||||
})
|
})
|
||||||
|
|
||||||
this._utils.getIPCMain().on('lastfm:disconnect', (event: any) => {
|
this._utils.getIPCMain().on('lastfm:disconnect', (_event: any) => {
|
||||||
this._lfm.setSessionCredentials(null, null);
|
this._lfm.setSessionCredentials(null, null);
|
||||||
this._authenticated = false;
|
this._authenticated = false;
|
||||||
console.debug('[lastfm] [disconnect] Disconnected')
|
console.debug('[lastfm] [disconnect] Disconnected')
|
||||||
|
@ -170,7 +170,7 @@ export default class lastfm {
|
||||||
* @private
|
* @private
|
||||||
*/
|
*/
|
||||||
private scrobbleTrack(attributes: any): void {
|
private scrobbleTrack(attributes: any): void {
|
||||||
if (!this._authenticated || !attributes || (this._utils.getStoreValue("connectivity.lastfm.filter_loop") && this._scrobbleCache.track === attributes.lfmTrack.name)) return;
|
if (!this._authenticated || !attributes || this._utils.getStoreValue("connectivity.lastfm.filter_types")[attributes.playParams.kind] || (this._utils.getStoreValue("connectivity.lastfm.filter_loop") && this._scrobbleCache.track === attributes.lfmTrack.name)) return;
|
||||||
|
|
||||||
if (this._scrobbleDelay) {
|
if (this._scrobbleDelay) {
|
||||||
clearTimeout(this._scrobbleDelay);
|
clearTimeout(this._scrobbleDelay);
|
||||||
|
@ -208,7 +208,7 @@ export default class lastfm {
|
||||||
}
|
}
|
||||||
|
|
||||||
private updateNowPlayingTrack(attributes: any): void {
|
private updateNowPlayingTrack(attributes: any): void {
|
||||||
if (!this._authenticated || !attributes || (this._utils.getStoreValue("connectivity.lastfm.filter_loop") && this._nowPlayingCache.track === attributes.lfmTrack.name)) return;
|
if (!this._authenticated || !attributes || this._utils.getStoreValue("connectivity.lastfm.filter_types")[attributes.playParams.kind] || (this._utils.getStoreValue("connectivity.lastfm.filter_loop") && this._nowPlayingCache.track === attributes.lfmTrack.name)) return;
|
||||||
|
|
||||||
const nowPlaying = {
|
const nowPlaying = {
|
||||||
'artist': attributes.lfmTrack.artist.name,
|
'artist': attributes.lfmTrack.artist.name,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue