last.fm: made removing attributes from album default behaviour

This commit is contained in:
inalone 2022-02-22 11:03:18 +00:00 committed by GitHub
parent 1f7f2e2174
commit 68a28c0bab
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 4 additions and 16 deletions

View file

@ -331,7 +331,6 @@
"settings.option.connectivity.lastfmScrobble.delay": "Last.fm Scrobble Delay (%)", "settings.option.connectivity.lastfmScrobble.delay": "Last.fm Scrobble Delay (%)",
"settings.option.connectivity.lastfmScrobble.nowPlaying": "Enable Last.fm Now Playing", "settings.option.connectivity.lastfmScrobble.nowPlaying": "Enable Last.fm Now Playing",
"settings.option.connectivity.lastfmScrobble.removeFeatured": "Remove featuring artists from song title (Last.fm)", "settings.option.connectivity.lastfmScrobble.removeFeatured": "Remove featuring artists from song title (Last.fm)",
"settings.option.connectivity.lastfmScrobble.filterAlbumName": "Filter attributes from album name (Last.fm)",
"settings.option.connectivity.lastfmScrobble.filterLoop": "Filter looped track (Last.fm)", "settings.option.connectivity.lastfmScrobble.filterLoop": "Filter looped track (Last.fm)",
"settings.header.debug": "Debug", "settings.header.debug": "Debug",
"settings.option.debug.copy_log": "Copy logs to clipboard", "settings.option.debug.copy_log": "Copy logs to clipboard",

View file

@ -103,7 +103,6 @@ export class Store {
"scrobble_after": 30, "scrobble_after": 30,
"auth_token": "", "auth_token": "",
"enabledRemoveFeaturingArtists": true, "enabledRemoveFeaturingArtists": true,
"filterAlbumName": false,
"filterLoop": true, "filterLoop": true,
"NowPlaying": "true" "NowPlaying": "true"
}, },

View file

@ -93,6 +93,7 @@ export default class LastFMPlugin {
} }
const artist = await this.getPrimaryArtist(attributes) const artist = await this.getPrimaryArtist(attributes)
const album = this.getAlbumName(attributes)
if (currentAttributes.status && currentAttributes === attributes) { if (currentAttributes.status && currentAttributes === attributes) {
if (fs.existsSync(this.sessionPath)) { if (fs.existsSync(this.sessionPath)) {
@ -101,7 +102,7 @@ export default class LastFMPlugin {
self._lastfm.track.scrobble({ self._lastfm.track.scrobble({
'artist': artist, 'artist': artist,
'track': attributes.name, 'track': attributes.name,
'album': this.getAlbumName(attributes), 'album': album,
'albumArtist': artist, 'albumArtist': artist,
'timestamp': new Date().getTime() / 1000 'timestamp': new Date().getTime() / 1000
}, function (err: any, scrobbled: any) { }, function (err: any, scrobbled: any) {
@ -133,13 +134,14 @@ export default class LastFMPlugin {
if (fs.existsSync(this.sessionPath)) { if (fs.existsSync(this.sessionPath)) {
const artist = await this.getPrimaryArtist(attributes) const artist = await this.getPrimaryArtist(attributes)
const album = this.getAlbumName(attributes)
// update Now Playing // update Now Playing
if (attributes.status === true) { if (attributes.status === true) {
this._lastfm.track.updateNowPlaying({ this._lastfm.track.updateNowPlaying({
'artist': artist, 'artist': artist,
'track': attributes.name, 'track': attributes.name,
'album': this.getAlbumName(attributes), 'album': album,
'albumArtist': artist 'albumArtist': artist
}, function (err: any, nowPlaying: any) { }, function (err: any, nowPlaying: any) {
if (err) { if (err) {
@ -157,10 +159,6 @@ export default class LastFMPlugin {
} }
private getAlbumName(attributes: any): string { private getAlbumName(attributes: any): string {
if (!this._store.lastfm.filterAlbumName) {
return attributes.albumName;
}
return attributes.albumName.replace(/ - Single| - EP/g, ''); return attributes.albumName.replace(/ - Single| - EP/g, '');
} }

View file

@ -606,14 +606,6 @@
<input type="checkbox" v-model="app.cfg.lastfm.enabledRemoveFeaturingArtists" switch/> <input type="checkbox" v-model="app.cfg.lastfm.enabledRemoveFeaturingArtists" switch/>
</div> </div>
</div> </div>
<div class="md-option-line" v-show="app.cfg.lastfm.enabled">
<div class="md-option-segment">
{{$root.getLz('settings.option.connectivity.lastfmScrobble.filterAlbumName')}}
</div>
<div class="md-option-segment md-option-segment_auto">
<input type="checkbox" v-model="app.cfg.lastfm.filterAlbumName" switch/>
</div>
</div>
<div class="md-option-line" v-show="app.cfg.lastfm.enabled"> <div class="md-option-line" v-show="app.cfg.lastfm.enabled">
<div class="md-option-segment"> <div class="md-option-segment">
{{$root.getLz('settings.option.connectivity.lastfmScrobble.filterLoop')}} {{$root.getLz('settings.option.connectivity.lastfmScrobble.filterLoop')}}