Merge remote-tracking branch 'origin/develop' into develop
# Conflicts: # src/main/plugins/lastfm.ts
This commit is contained in:
commit
5b360e74fa
1 changed files with 40 additions and 37 deletions
|
@ -79,7 +79,7 @@ export default class LastFMPlugin {
|
||||||
}
|
}
|
||||||
|
|
||||||
private scrobbleSong(attributes: any) {
|
private scrobbleSong(attributes: any) {
|
||||||
if(this._timer) clearTimeout(this._timer);
|
if (this._timer) clearTimeout(this._timer);
|
||||||
var self = this;
|
var self = this;
|
||||||
this._timer = setTimeout(async () => {
|
this._timer = setTimeout(async () => {
|
||||||
const currentAttributes = attributes;
|
const currentAttributes = attributes;
|
||||||
|
@ -118,7 +118,8 @@ export default class LastFMPlugin {
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
return console.log('[LastFM] Did not add ', attributes.name, '—', artist, 'because now playing a other song.');
|
return console.log('[LastFM] Did not add ', attributes.name, '—', artist, 'because now playing a other song.');
|
||||||
}},Math.round(attributes.durationInMillis * (self._store.lastfm.scrobble_after / 100)));
|
}
|
||||||
|
}, Math.round(attributes.durationInMillis * (self._store.lastfm.scrobble_after / 100)));
|
||||||
}
|
}
|
||||||
|
|
||||||
private async updateNowPlayingSong(attributes: any) {
|
private async updateNowPlayingSong(attributes: any) {
|
||||||
|
@ -155,7 +156,7 @@ export default class LastFMPlugin {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private async getPrimaryArtist (attributes: any) {
|
private async getPrimaryArtist(attributes: any) {
|
||||||
const songId = attributes.playParams.catalogId || attributes.playParams.id
|
const songId = attributes.playParams.catalogId || attributes.playParams.id
|
||||||
|
|
||||||
if (!this._store.lastfm.enabledRemoveFeaturingArtists || !songId) return attributes.artistName;
|
if (!this._store.lastfm.enabledRemoveFeaturingArtists || !songId) return attributes.artistName;
|
||||||
|
@ -258,17 +259,19 @@ export default class LastFMPlugin {
|
||||||
*/
|
*/
|
||||||
onPlaybackStateDidChange(attributes: object): void {
|
onPlaybackStateDidChange(attributes: object): void {
|
||||||
this.updateNowPlayingSong(attributes)
|
this.updateNowPlayingSong(attributes)
|
||||||
this.scrobbleSong(attributes)
|
// this.scrobbleSong(attributes)
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Runs on song change
|
* Runs on song change
|
||||||
* @param attributes Music Attributes
|
* @param attributes Music Attributes
|
||||||
*/
|
*/
|
||||||
nowPlayingItemDidChangeLastFM(attributes: object): void {
|
lfmItemChange(attributes: any): void {
|
||||||
if (!this._store.lastfm.filterLoop){
|
attributes.status = true
|
||||||
|
if (!this._store.lastfm.filterLoop) {
|
||||||
this._lastfm.cachedNowPlayingAttributes = false;
|
this._lastfm.cachedNowPlayingAttributes = false;
|
||||||
this._lastfm.cachedAttributes = false}
|
this._lastfm.cachedAttributes = false
|
||||||
|
}
|
||||||
this.updateNowPlayingSong(attributes)
|
this.updateNowPlayingSong(attributes)
|
||||||
this.scrobbleSong(attributes)
|
this.scrobbleSong(attributes)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue