last.fm: initial implementation of filterAlbumName
This commit is contained in:
parent
ddf8d05204
commit
1f7f2e2174
4 changed files with 20 additions and 3 deletions
|
@ -331,6 +331,7 @@
|
||||||
"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",
|
||||||
|
|
|
@ -103,6 +103,7 @@ 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"
|
||||||
},
|
},
|
||||||
|
|
|
@ -101,7 +101,7 @@ export default class LastFMPlugin {
|
||||||
self._lastfm.track.scrobble({
|
self._lastfm.track.scrobble({
|
||||||
'artist': artist,
|
'artist': artist,
|
||||||
'track': attributes.name,
|
'track': attributes.name,
|
||||||
'album': attributes.albumName,
|
'album': this.getAlbumName(attributes),
|
||||||
'albumArtist': artist,
|
'albumArtist': artist,
|
||||||
'timestamp': new Date().getTime() / 1000
|
'timestamp': new Date().getTime() / 1000
|
||||||
}, function (err: any, scrobbled: any) {
|
}, function (err: any, scrobbled: any) {
|
||||||
|
@ -139,7 +139,7 @@ export default class LastFMPlugin {
|
||||||
this._lastfm.track.updateNowPlaying({
|
this._lastfm.track.updateNowPlaying({
|
||||||
'artist': artist,
|
'artist': artist,
|
||||||
'track': attributes.name,
|
'track': attributes.name,
|
||||||
'album': attributes.albumName,
|
'album': this.getAlbumName(attributes),
|
||||||
'albumArtist': artist
|
'albumArtist': artist
|
||||||
}, function (err: any, nowPlaying: any) {
|
}, function (err: any, nowPlaying: any) {
|
||||||
if (err) {
|
if (err) {
|
||||||
|
@ -156,6 +156,14 @@ export default class LastFMPlugin {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private getAlbumName(attributes: any): string {
|
||||||
|
if (!this._store.lastfm.filterAlbumName) {
|
||||||
|
return attributes.albumName;
|
||||||
|
}
|
||||||
|
|
||||||
|
return attributes.albumName.replace(/ - Single| - EP/g, '');
|
||||||
|
}
|
||||||
|
|
||||||
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
|
||||||
|
|
||||||
|
|
|
@ -606,6 +606,14 @@
|
||||||
<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')}}
|
||||||
|
@ -617,7 +625,6 @@
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<div class="md-option-header">
|
<div class="md-option-header">
|
||||||
<span>{{$root.getLz('settings.header.debug')}}</span>
|
<span>{{$root.getLz('settings.header.debug')}}</span>
|
||||||
</div>
|
</div>
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue