Moved discord and lastfm config to connectivity

This commit is contained in:
Core 2022-06-22 23:34:54 +01:00
parent e3225e9ad5
commit 2abefe21a0
No known key found for this signature in database
GPG key ID: FE9BF1B547F8F3C6
4 changed files with 66 additions and 64 deletions

View file

@ -54,7 +54,7 @@ export default class lastfm {
})
this._utils.getIPCMain().on('lastfm:nowPlayingChange', (event: any, attributes: any) => {
if (this._utils.getStoreValue("lastfm.filter_loop")) return;
if (this._utils.getStoreValue("connectivity.lastfm.filter_loop")) return;
this.onNowPlayingItemDidChange(attributes)
})
}
@ -96,8 +96,8 @@ export default class lastfm {
'secret': api.secret,
});
if (this._utils.getStoreValue("lastfm.secrets.username") && this._utils.getStoreValue("lastfm.secrets.key")) {
this._lfm.setSessionCredentials(this._utils.getStoreValue("lastfm.secrets.username"), this._utils.getStoreValue("lastfm.secrets.key"));
if (this._utils.getStoreValue("connectivity.lastfm.secrets.username") && this._utils.getStoreValue("connectivity.lastfm.secrets.key")) {
this._lfm.setSessionCredentials(this._utils.getStoreValue("connectivity.lastfm.secrets.username"), this._utils.getStoreValue("connectivity.lastfm.secrets.key"));
this._authenticated = true;
} else {
this.authenticateLastFM(token)
@ -170,7 +170,7 @@ export default class lastfm {
* @private
*/
private scrobbleTrack(attributes: any): void {
if (!this._authenticated || !attributes || (this._utils.getStoreValue("lastfm.filter_loop") && this._scrobbleCache.track === attributes.lfmTrack.name)) return;
if (!this._authenticated || !attributes || (this._utils.getStoreValue("connectivity.lastfm.filter_loop") && this._scrobbleCache.track === attributes.lfmTrack.name)) return;
if (this._scrobbleDelay) {
clearTimeout(this._scrobbleDelay);
@ -204,11 +204,11 @@ export default class lastfm {
this._scrobbleCache = scrobble
}
});
}, Math.round(attributes.durationInMillis * Math.min((this._utils.getStoreValue("lastfm.scrobble_after") / 100), 0.8)))
}, Math.round(attributes.durationInMillis * Math.min((this._utils.getStoreValue("connectivity.lastfm.scrobble_after") / 100), 0.8)))
}
private updateNowPlayingTrack(attributes: any): void {
if (!this._authenticated || !attributes || (this._utils.getStoreValue("lastfm.filter_loop") && this._nowPlayingCache.track === attributes.lfmTrack.name)) return;
if (!this._authenticated || !attributes || (this._utils.getStoreValue("connectivity.lastfm.filter_loop") && this._nowPlayingCache.track === attributes.lfmTrack.name)) return;
const nowPlaying = {
'artist': attributes.lfmTrack.artist.name,