Merge commit '23c7c603028edfaa006bdb24e0dbfbb2cdde5cc8' into feature/meilisearch
This commit is contained in:
commit
97c8b32d66
|
@ -53,7 +53,23 @@ return static function (App\Event\BuildStationMenu $e) {
|
||||||
'profile' => [
|
'profile' => [
|
||||||
'label' => __('Profile'),
|
'label' => __('Profile'),
|
||||||
'icon' => 'image',
|
'icon' => 'image',
|
||||||
'url' => $router->fromHere('stations:profile:index'),
|
'items' => [
|
||||||
|
[
|
||||||
|
'label' => __('View Profile'),
|
||||||
|
'url' => $router->fromHere('stations:profile:index'),
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'label' => __('Edit Profile'),
|
||||||
|
'url' => $router->fromHere('stations:profile:edit'),
|
||||||
|
'permission' => StationPermissions::Profile,
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'label' => __('Branding'),
|
||||||
|
'class' => 'text-muted',
|
||||||
|
'url' => $router->fromhere('stations:branding'),
|
||||||
|
'permission' => StationPermissions::Profile,
|
||||||
|
],
|
||||||
|
],
|
||||||
],
|
],
|
||||||
'public' => [
|
'public' => [
|
||||||
'label' => __('Public Page'),
|
'label' => __('Public Page'),
|
||||||
|
|
|
@ -254,7 +254,8 @@ final class Queue
|
||||||
return $playlist->getIsEnabled() &&
|
return $playlist->getIsEnabled() &&
|
||||||
$this->scheduler->isPlaylistScheduledToPlayNow(
|
$this->scheduler->isPlaylistScheduledToPlayNow(
|
||||||
$playlist,
|
$playlist,
|
||||||
$expectedPlayTime
|
$expectedPlayTime,
|
||||||
|
true
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -104,7 +104,8 @@ final class Scheduler
|
||||||
|
|
||||||
public function isPlaylistScheduledToPlayNow(
|
public function isPlaylistScheduledToPlayNow(
|
||||||
Entity\StationPlaylist $playlist,
|
Entity\StationPlaylist $playlist,
|
||||||
CarbonInterface $now
|
CarbonInterface $now,
|
||||||
|
bool $excludeSpecialRules = false
|
||||||
): bool {
|
): bool {
|
||||||
$scheduleItems = $playlist->getScheduleItems();
|
$scheduleItems = $playlist->getScheduleItems();
|
||||||
|
|
||||||
|
@ -113,7 +114,7 @@ final class Scheduler
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
$scheduleItem = $this->getActiveScheduleFromCollection($scheduleItems, $now);
|
$scheduleItem = $this->getActiveScheduleFromCollection($scheduleItems, $now, $excludeSpecialRules);
|
||||||
return null !== $scheduleItem;
|
return null !== $scheduleItem;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -199,13 +200,14 @@ final class Scheduler
|
||||||
*/
|
*/
|
||||||
private function getActiveScheduleFromCollection(
|
private function getActiveScheduleFromCollection(
|
||||||
Collection $scheduleItems,
|
Collection $scheduleItems,
|
||||||
CarbonInterface $now
|
CarbonInterface $now,
|
||||||
|
bool $excludeSpecialRules = false
|
||||||
): ?Entity\StationSchedule {
|
): ?Entity\StationSchedule {
|
||||||
if ($scheduleItems->count() > 0) {
|
if ($scheduleItems->count() > 0) {
|
||||||
foreach ($scheduleItems as $scheduleItem) {
|
foreach ($scheduleItems as $scheduleItem) {
|
||||||
$scheduleName = (string)$scheduleItem;
|
$scheduleName = (string)$scheduleItem;
|
||||||
|
|
||||||
if ($this->shouldSchedulePlayNow($scheduleItem, $now)) {
|
if ($this->shouldSchedulePlayNow($scheduleItem, $now, $excludeSpecialRules)) {
|
||||||
$this->logger->debug(
|
$this->logger->debug(
|
||||||
sprintf(
|
sprintf(
|
||||||
'%s - Should Play Now',
|
'%s - Should Play Now',
|
||||||
|
@ -228,7 +230,8 @@ final class Scheduler
|
||||||
|
|
||||||
public function shouldSchedulePlayNow(
|
public function shouldSchedulePlayNow(
|
||||||
Entity\StationSchedule $schedule,
|
Entity\StationSchedule $schedule,
|
||||||
CarbonInterface $now
|
CarbonInterface $now,
|
||||||
|
bool $excludeSpecialRules = false
|
||||||
): bool {
|
): bool {
|
||||||
$startTime = Entity\StationSchedule::getDateTime($schedule->getStartTime(), $now);
|
$startTime = Entity\StationSchedule::getDateTime($schedule->getStartTime(), $now);
|
||||||
$endTime = Entity\StationSchedule::getDateTime($schedule->getEndTime(), $now);
|
$endTime = Entity\StationSchedule::getDateTime($schedule->getEndTime(), $now);
|
||||||
|
@ -277,7 +280,7 @@ final class Scheduler
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach ($comparePeriods as $dateRange) {
|
foreach ($comparePeriods as $dateRange) {
|
||||||
if ($this->shouldPlayInSchedulePeriod($schedule, $dateRange, $now)) {
|
if ($this->shouldPlayInSchedulePeriod($schedule, $dateRange, $now, $excludeSpecialRules)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -288,7 +291,8 @@ final class Scheduler
|
||||||
private function shouldPlayInSchedulePeriod(
|
private function shouldPlayInSchedulePeriod(
|
||||||
Entity\StationSchedule $schedule,
|
Entity\StationSchedule $schedule,
|
||||||
DateRange $dateRange,
|
DateRange $dateRange,
|
||||||
CarbonInterface $now
|
CarbonInterface $now,
|
||||||
|
bool $excludeSpecialRules = false
|
||||||
): bool {
|
): bool {
|
||||||
if (!$dateRange->contains($now)) {
|
if (!$dateRange->contains($now)) {
|
||||||
return false;
|
return false;
|
||||||
|
@ -306,6 +310,11 @@ final class Scheduler
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Skip the remaining checks if we're doing a "still scheduled to play" Queue check.
|
||||||
|
if ($excludeSpecialRules) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
// Handle "Play Single Track" advanced setting.
|
// Handle "Play Single Track" advanced setting.
|
||||||
if (
|
if (
|
||||||
$playlist->backendPlaySingleTrack()
|
$playlist->backendPlaySingleTrack()
|
||||||
|
|
Loading…
Reference in New Issue