Restore missing annotateNextSong fixes from cpeter1207 (#4373)
This commit is contained in:
parent
8b113ace37
commit
18eb64c61f
|
@ -94,14 +94,26 @@ class AutoDJ
|
|||
return $this->annotateNextSong($station, $asAutoDj, $iteration + 1);
|
||||
}
|
||||
|
||||
// Build adjusted "now" based on the currently playing song before annotating up the next one
|
||||
$adjustedNow = $this->getAdjustedNow(
|
||||
$station,
|
||||
$this->getNowFromCurrentSong($station),
|
||||
$queueRow->getDuration()
|
||||
);
|
||||
|
||||
$event = new AnnotateNextSong($queueRow, $asAutoDj);
|
||||
$this->dispatcher->dispatch($event);
|
||||
|
||||
// Refill station queue while taking into context that LS queues songs 40s before they are played
|
||||
$this->buildQueue($station, true, $adjustedNow);
|
||||
|
||||
return $event->buildAnnotations();
|
||||
}
|
||||
|
||||
public function buildQueue(
|
||||
Entity\Station $station,
|
||||
bool $force = false
|
||||
bool $force = false,
|
||||
CarbonInterface $nowOverride = null
|
||||
): void {
|
||||
$lock = $this->lockFactory->createAndAcquireLock(
|
||||
resource: 'autodj_queue_' . $station->getId(),
|
||||
|
@ -125,7 +137,7 @@ class AutoDJ
|
|||
);
|
||||
|
||||
// Adjust "now" time from current queue.
|
||||
$now = $this->getNowFromCurrentSong($station);
|
||||
$now = $nowOverride ?? $this->getNowFromCurrentSong($station);
|
||||
|
||||
$maxQueueLength = $station->getBackendConfig()->getAutoDjQueueLength();
|
||||
if ($maxQueueLength < 1) {
|
||||
|
|
Loading…
Reference in New Issue