Implement smart default fallbacks for no-disconnect restarts.

This commit is contained in:
Buster "Silver Eagle" Neece 2022-01-26 12:27:31 -06:00
parent 120c51733e
commit f8e2e7ce1d
No known key found for this signature in database
GPG Key ID: 9FC8B9E008872109
3 changed files with 13 additions and 1 deletions

View File

@ -970,7 +970,7 @@ class ConfigWriter implements EventSubscriberInterface
): string {
$charset = $station->getBackendConfig()->getCharset();
$format = $mount->getAutodjFormatEnum() ?? StreamFormats::Mp3;
$format = $mount->getAutodjFormatEnum() ?? StreamFormats::default();
$output_format = $this->getOutputFormatString(
$format,
$mount->getAutodjBitrate() ?? 128

View File

@ -32,4 +32,9 @@ enum StreamFormats: string
default => false,
};
}
public static function default(): self
{
return self::Mp3;
}
}

View File

@ -6,6 +6,7 @@ namespace App\Radio\Frontend;
use App\Entity;
use App\Radio\CertificateLocator;
use App\Radio\Enums\StreamFormats;
use App\Utilities;
use App\Xml\Writer;
use Exception;
@ -211,6 +212,12 @@ class Icecast extends AbstractFrontend
if (!empty($mount_row->getFallbackMount())) {
$mount['fallback-mount'] = $mount_row->getFallbackMount();
$mount['fallback-override'] = 1;
} elseif ($mount_row->getEnableAutodj()) {
$autoDjFormat = $mount_row->getAutodjFormatEnum() ?? StreamFormats::default();
$autoDjBitrate = $mount_row->getAutodjBitrate();
$mount['fallback-mount'] = '/fallback-[' . $autoDjBitrate . '].' . $autoDjFormat->getExtension();
$mount['fallback-override'] = 1;
}
if ($mount_row->getMaxListenerDuration()) {