diff --git a/src/backend/scrobblers/AbstractHistoricalScrobbleClient.ts b/src/backend/scrobblers/AbstractHistoricalScrobbleClient.ts index 35b45100..11d10a26 100644 --- a/src/backend/scrobblers/AbstractHistoricalScrobbleClient.ts +++ b/src/backend/scrobblers/AbstractHistoricalScrobbleClient.ts @@ -21,6 +21,7 @@ export default abstract class AbstractHistoricalScrobbleClient extends AbstractS syncedReason?: string; syncError?: ErrorIsh; override preloadScrobbles: boolean = false; + protected addScrobbleToHistorical: boolean = true; protected abstract doHydrateHistoricalScrobbles(opts: {allowFailures?: boolean, signal?: AbortSignal }): Promise; @@ -181,7 +182,9 @@ export default abstract class AbstractHistoricalScrobbleClient extends AbstractS public async scrobble(playObj: PlayObject, opts?: { delay?: number | false, signal?: AbortSignal }): Promise { const res = await super.scrobble(playObj, opts); - await this.createHistoricalPlays([playToRepositoryCreatePlayHistoricalOpts({play: res})]); + if(this.addScrobbleToHistorical) { + await this.createHistoricalPlays([playToRepositoryCreatePlayHistoricalOpts({play: res})]); + } return res; } } \ No newline at end of file diff --git a/src/backend/scrobblers/RockskyScrobbler.ts b/src/backend/scrobblers/RockskyScrobbler.ts index ec50e6f7..6df46984 100644 --- a/src/backend/scrobblers/RockskyScrobbler.ts +++ b/src/backend/scrobblers/RockskyScrobbler.ts @@ -33,6 +33,13 @@ export default class RockskyScrobbler extends AbstractHistoricalScrobbleClient { declare config: RockSkyClientConfig; protected configDir: string; + // because rocksky scrobble peristence is async, does not return a TID, and may be modified server-side + // we don't want to add our scrobble payload as a source-of-truth historical play because it may end up + // looking different when we sync historical from car/api call + // + // we already keep a copy of what was scrobbled in the play table and that should be enough to prevent dupes + // without having to result to historical querying + protected override addScrobbleToHistorical: boolean = false; constructor(name: any, config: RockSkyClientConfig, options: InternalConfigOptional & { [key: string]: any }, notifier: Notifiers, emitter: EventEmitter, logger: Logger) { super('rocksky', name, config, notifier, emitter, logger);