mirror of
https://github.com/FoxxMD/multi-scrobbler.git
synced 2026-09-03 05:10:00 +03:00
refactor: Make scrobbled data transform responsibility of concrete scrobbler class
This commit is contained in:
@@ -158,8 +158,8 @@ export default abstract class AbstractScrobbleClient {
|
||||
return [validTime, log]
|
||||
}
|
||||
|
||||
addScrobbledTrack = (playObj: any, scrobbleResp: any) => {
|
||||
this.scrobbledPlayObjs.push({play: playObj, scrobble: this.formatPlayObj(scrobbleResp)});
|
||||
addScrobbledTrack = (playObj: PlayObject, scrobbledPlay: PlayObject) => {
|
||||
this.scrobbledPlayObjs.push({play: playObj, scrobble: scrobbledPlay});
|
||||
}
|
||||
|
||||
cleanSourceSearchTitle = (playObj: PlayObject) => {
|
||||
|
||||
@@ -179,7 +179,7 @@ export default class LastfmScrobbler extends AbstractScrobbleClient {
|
||||
this.initialized = false;
|
||||
throw new Error('Service reported daily scrobble limit exceeded! 😬 Disabling client');
|
||||
}
|
||||
this.addScrobbledTrack(playObj, {...rest, date: { uts: timestamp}, name: trackName});
|
||||
this.addScrobbledTrack(playObj, this.formatPlayObj({...rest, date: { uts: timestamp}, name: trackName}));
|
||||
if (newFromSource) {
|
||||
this.logger.info(`Scrobbled (New) => (${source}) ${buildTrackString(playObj)}`);
|
||||
} else {
|
||||
|
||||
@@ -436,7 +436,7 @@ export default class MalojaScrobbler extends AbstractScrobbleClient {
|
||||
} = {}} = response;
|
||||
scrobbleResponse = {...rest, album: mAlbum, time: mTime, duration: mDuration};
|
||||
}
|
||||
this.addScrobbledTrack(playObj, scrobbleResponse);
|
||||
this.addScrobbledTrack(playObj, this.formatPlayObj(scrobbleResponse));
|
||||
if (newFromSource) {
|
||||
this.logger.info(`Scrobbled (New) => (${source}) ${buildTrackString(playObj)}`);
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user