Merge fd2a0896c0
into a1cd71922f
This commit is contained in:
commit
f0b3df0485
|
@ -90,6 +90,27 @@
|
|||
</template>
|
||||
</form-group-field>
|
||||
|
||||
<form-group-field
|
||||
v-if="enableAdvancedFeatures"
|
||||
id="edit_form_backend_dj_port_secondary"
|
||||
class="col-md-6"
|
||||
:field="v$.backend_config.dj_port_secondary"
|
||||
input-type="number"
|
||||
:input-attrs="{ min: '0' }"
|
||||
advanced
|
||||
:label="$gettext('Customize DJ/Streamer Port Secondary')"
|
||||
>
|
||||
<template #description>
|
||||
{{
|
||||
$gettext('No other program can be using this port. Leave blank to automatically assign a port.')
|
||||
}}
|
||||
<br>
|
||||
{{
|
||||
$gettext('Note: the port after this one will automatically be used for legacy connections.')
|
||||
}}
|
||||
</template>
|
||||
</form-group-field>
|
||||
|
||||
<form-group-field
|
||||
id="edit_form_backend_dj_buffer"
|
||||
class="col-md-6"
|
||||
|
|
|
@ -39,6 +39,18 @@ class StationBackendConfiguration extends AbstractStationConfiguration
|
|||
$this->set(self::DJ_PORT, $port);
|
||||
}
|
||||
|
||||
public const DJ_PORT_SECONDARY = 'dj_port_decondary';
|
||||
|
||||
public function getDjPortSecondary(): ?int
|
||||
{
|
||||
return Types::intOrNull($this->get(self::DJ_PORT_SECONDARY));
|
||||
}
|
||||
|
||||
public function setDjPortSecondary(?int $port): void
|
||||
{
|
||||
$this->set(self::DJ_PORT_SECONDARY, $port);
|
||||
}
|
||||
|
||||
public const TELNET_PORT = 'telnet_port';
|
||||
|
||||
public function getTelnetPort(): ?int
|
||||
|
|
|
@ -59,6 +59,27 @@ final class Liquidsoap extends AbstractLocalAdapter
|
|||
return $frontendPort + 5;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the port used for a second DJs/Streamers to connect to LiquidSoap for broadcasting.
|
||||
*
|
||||
* @param Station $station
|
||||
*
|
||||
* @return int The port number to use for this station.
|
||||
*/
|
||||
public function getStreamPortSecondary(Station $station): int
|
||||
{
|
||||
$djPortSecondary = $station->getBackendConfig()->getDjPortSecondary();
|
||||
if (null !== $djPortSecondary) {
|
||||
return $djPortSecondary;
|
||||
}
|
||||
|
||||
// Default to frontend port + 7
|
||||
$frontendConfig = $station->getFrontendConfig();
|
||||
$frontendPort = $frontendConfig->getPort() ?? (8000 + (($station->getId() - 1) * 10));
|
||||
|
||||
return $frontendPort + 7;
|
||||
}
|
||||
|
||||
/**
|
||||
* Execute the specified remote command on LiquidSoap via the telnet API.
|
||||
*
|
||||
|
|
|
@ -1030,7 +1030,41 @@ final class ConfigWriter implements EventSubscriberInterface
|
|||
|
||||
# Live Broadcasting
|
||||
live = input.harbor({$harborParams})
|
||||
LIQ
|
||||
);
|
||||
|
||||
|
||||
// Live Secondary Port
|
||||
$streamPortSecondary = $this->liquidsoap->getStreamPortSecondary($station);
|
||||
// Paramètres pour live Secondary
|
||||
$harborSecondary_params = [
|
||||
'"' . self::cleanUpString($dj_mount) . '"', // Assurez-vous que $dj_mount est défini correctement
|
||||
'id = "input_streamer_live_secondary"', // ID unique pour live1
|
||||
'port = ' . $streamPortSecondary, // Utilisation de getStreamPort1 pour le port
|
||||
'auth = dj_auth', // Authentification, assurez-vous que 'dj_auth' est correctement défini
|
||||
'icy = true', // Paramètres ICY
|
||||
'icy_metadata_charset = "' . $charset . '"', // Charset pour les métadonnées ICY, assurez-vous que $charset est défini
|
||||
'metadata_charset = "' . $charset . '"', // Charset pour les métadonnées, assurez-vous que $charset est défini
|
||||
'on_connect = live_connected', // Action à la connexion
|
||||
'on_disconnect = live_disconnected', // Action à la déconnexion
|
||||
];
|
||||
|
||||
// Ajouter des paramètres de buffer si nécessaire
|
||||
$djBuffer = $settings->getDjBuffer(); // Assurez-vous que $settings est défini et a une méthode getDjBuffer
|
||||
if (0 !== $djBuffer) {
|
||||
$harborSecondary_params[] = 'buffer = ' . self::toFloat($djBuffer);
|
||||
$harborSecondary_params[] = 'max = ' . self::toFloat(max($djBuffer + 5, 10));
|
||||
}
|
||||
|
||||
// Concaténer les paramètres pour former la chaîne de configuration live1
|
||||
$harborSecondaryParams = implode(', ', $harborSecondary_params);
|
||||
|
||||
// Ajout de la configuration live1 au fichier de configuration LiquidSoap
|
||||
// Assurez-vous que cette ligne est placée au bon endroit dans votre script pour écrire dans le fichier de configuration
|
||||
$event->appendBlock("live1 = input.harbor({$harbor1Params})\n");
|
||||
|
||||
$event->appendBlock(
|
||||
<<<LIQ
|
||||
def insert_missing(m) =
|
||||
if m == [] then
|
||||
[("title", "{$liveBroadcastText}"), ("is_live", "true")]
|
||||
|
@ -1039,8 +1073,9 @@ final class ConfigWriter implements EventSubscriberInterface
|
|||
end
|
||||
end
|
||||
live = metadata.map(insert_missing, live)
|
||||
live1 = metadata.map(insert_missing, live1)
|
||||
|
||||
radio = fallback(id="live_fallback", track_sensitive=false, replay_metadata=true, [live, radio])
|
||||
radio = fallback(id="live_fallback", track_sensitive=false, replay_metadata=true, [live, live1, radio])
|
||||
|
||||
# Skip non-live track when live DJ goes live.
|
||||
def check_live() =
|
||||
|
|
|
@ -289,6 +289,12 @@ final class Configuration
|
|||
$station->setBackendConfig($backendConfig);
|
||||
}
|
||||
|
||||
$djPortSecondary = $backendConfig->getDjPortSecondary();
|
||||
if ($force || null === $djPortSecondary) {
|
||||
$backendConfig->setDjPortSecondary($basePort + 7);
|
||||
$station->setBackendConfig($backendConfig);
|
||||
}
|
||||
|
||||
$telnetPort = $backendConfig->getTelnetPort();
|
||||
if ($force || null === $telnetPort) {
|
||||
$backendConfig->setTelnetPort($basePort + 4);
|
||||
|
@ -374,6 +380,11 @@ final class Configuration
|
|||
$usedPorts[$port] = $stationReference;
|
||||
$usedPorts[$port + 1] = $stationReference;
|
||||
}
|
||||
if (!empty($backendConfig['dj_port_secondary'])) {
|
||||
$port = (int)$backendConfig['dj_port_secondary'];
|
||||
$usedPorts[$port] = $stationReference;
|
||||
$usedPorts[$port + 1] = $stationReference;
|
||||
}
|
||||
if (!empty($backendConfig['telnet_port'])) {
|
||||
$port = (int)$backendConfig['telnet_port'];
|
||||
$usedPorts[$port] = $stationReference;
|
||||
|
|
|
@ -32,6 +32,7 @@ final class StationPortCheckerValidator extends ConstraintValidator
|
|||
$portsToCheck = [
|
||||
'frontend_config_port' => $frontendConfig->getPort(),
|
||||
'backend_config_dj_port' => $backendConfig->getDjPort(),
|
||||
'backend_config_dj_port_secondary' => $backendConfig->getDjPortSecondary(),
|
||||
'backend_config_telnet_port' => $backendConfig->getTelnetPort(),
|
||||
];
|
||||
|
||||
|
|
Loading…
Reference in New Issue