diff --git a/src/homepage/service.ts b/src/homepage/service.ts index 2b582ec..f77380e 100644 --- a/src/homepage/service.ts +++ b/src/homepage/service.ts @@ -94,36 +94,9 @@ export class HomepageService extends BaseService { } this.lastPoll = newPoll; - this.scheduleSongEndPoll(newPoll.tidal_current); return newPoll; } - private scheduleSongEndPoll(tidal: TidalGetCurrent | null): void { - this.clearSongEndPoll(); - - if (!tidal || tidal.status === "paused") { - return; - } - - const remainingSeconds = tidal.durationInSeconds - tidal.currentInSeconds; - if (remainingSeconds > 0) { - this.songEndTimeout = setTimeout( - () => { - this.songEndTimeout = null; - this.getFullInformation(); - }, - (remainingSeconds + 1) * 1000, - ); - } - } - - private clearSongEndPoll(): void { - if (this.songEndTimeout) { - clearTimeout(this.songEndTimeout); - this.songEndTimeout = null; - } - } - listenForClientChange(): void { this.sseService.onClientChange((clientChange: SseClientChangeEvent) => { if (clientChange.clientCount === 0) { @@ -149,6 +122,5 @@ export class HomepageService extends BaseService { if (this.pollingInterval) { clearInterval(this.pollingInterval); } - this.clearSongEndPoll(); } }