OrbiSubs panel: start/stop via systemd, per-channel SRT output, T13 as a panel channel
El panel genera /etc/orbisubs/<id>.env, arranca o para las instancias y mira 12 s que queden andando; si no, vuelve a lo anterior. Salida SRT por canal (listener o caller, latency, passphrase, CC1/CC3 y servicios 708, UDP internos puerto+10000). Ingesta numerada con la hora: al reiniciar, la secuencia volvía a 0 y el ASR se trababa. Tope de 2 canales andando (gpu02) y throttle de arranques. Tarea 079.
This commit is contained in:
@@ -9,7 +9,8 @@
|
||||
const SLUG_RE = /^[a-z0-9][a-z0-9-]{0,30}$/;
|
||||
// Puertos del CT que no puede tomar ningún canal (ssh, smtp local, nginx, este panel).
|
||||
const RESERVED = new Set([22, 25, 80, 443, Number(process.env.PORT) || 4700]);
|
||||
const CC608 = ['CC1', 'CC2', 'CC3', 'CC4'];
|
||||
// El codificador de la 078 escribe CC1 (campo 1) y CC3 (campo 2); CC2/CC4 no.
|
||||
const CC608 = ['CC1', 'CC3'];
|
||||
const LANGS = ['es', 'en', 'pt'];
|
||||
|
||||
class ValidationError extends Error {
|
||||
@@ -47,6 +48,8 @@ function host(v, field, label) {
|
||||
function passphrase(v, field) {
|
||||
const s = str(v);
|
||||
if (s && (s.length < 10 || s.length > 79)) bad('La passphrase SRT tiene que tener entre 10 y 79 caracteres', field);
|
||||
// Va en una URL y en la línea de comando del servicio: sin espacios ni caracteres de URL.
|
||||
if (s && !/^[A-Za-z0-9._~!*+,;:@%-]+$/.test(s)) bad('La passphrase SRT no puede tener espacios, comillas, &, ?, # ni /', field);
|
||||
return s;
|
||||
}
|
||||
|
||||
@@ -63,7 +66,7 @@ function input(i = {}) {
|
||||
passphrase: passphrase(i.passphrase, 'in_passphrase'),
|
||||
};
|
||||
if (out.streamid.length > 512 || /[\s&]/.test(out.streamid)) bad('streamid: sin espacios ni &, hasta 512 caracteres', 'in_streamid');
|
||||
if (mode === 'listener' && RESERVED.has(out.port)) bad(`El puerto ${out.port} lo usa el sistema`, 'in_port');
|
||||
if (mode === 'listener' && (RESERVED.has(out.port) || out.port < 1024)) bad(`El puerto ${out.port} lo usa el sistema`, 'in_port');
|
||||
return Object.assign(out, avPick(i));
|
||||
}
|
||||
if (kind === 'udp') {
|
||||
@@ -121,18 +124,22 @@ function channel(body = {}) {
|
||||
},
|
||||
srt: { enabled: !!srt.enabled },
|
||||
};
|
||||
if (cfg.tr.langs.length && cfg.asr.lang === 'en') bad('El audio ya es inglés: no hace falta traducir a inglés', 'tr_langs');
|
||||
// El traductor (orbisubs_tr.py) está armado para español de Chile → inglés.
|
||||
if (cfg.tr.langs.length && cfg.asr.lang !== 'es') bad('Por ahora la traducción es solo de español a inglés', 'tr_en');
|
||||
|
||||
if (cfg.srt.enabled) {
|
||||
const mode = str(srt.mode) === 'caller' ? 'caller' : 'listener';
|
||||
Object.assign(cfg.srt, {
|
||||
mode,
|
||||
host: mode === 'caller' ? host(srt.host, 'srt_host', 'Destino de la salida SRT') : '',
|
||||
port: int(srt.port, 'srt_port', 1024, 65534, 'Puerto de la salida SRT'),
|
||||
// Hasta 55000: los UDP internos hacia srt-live-transmit van en puerto + 10000.
|
||||
port: int(srt.port, 'srt_port', 1024, 55000, 'Puerto de la salida SRT'),
|
||||
latency_ms: int(srt.latency_ms === '' || srt.latency_ms == null ? 200 : srt.latency_ms, 'srt_latency', 20, 8000, 'Latency de la salida (ms)'),
|
||||
passphrase: passphrase(srt.passphrase, 'srt_passphrase'),
|
||||
delay_s: num(srt.delay_s ?? 24, 'srt_delay', 5, 60, 'Retraso fijo del video (s)'),
|
||||
cc608: {}, cc708: {},
|
||||
// HLS de prueba con -c copy desde la salida SRT (/hls/<id>-cc/, como OrbiOrigin; 078).
|
||||
test: !!srt.test,
|
||||
});
|
||||
// Qué idioma va en cada canal 608 y servicio 708. Vacío = ese idioma no va.
|
||||
const langsOut = [cfg.asr.lang, ...cfg.tr.langs];
|
||||
@@ -140,7 +147,7 @@ function channel(body = {}) {
|
||||
for (const l of langsOut) {
|
||||
const v608 = str((srt.cc608 || {})[l]);
|
||||
if (v608) {
|
||||
if (!CC608.includes(v608)) bad(`608 de ${l}: CC1 a CC4`, 'srt_cc608');
|
||||
if (!CC608.includes(v608)) bad(`608 de ${l}: CC1 o CC3`, 'srt_cc608');
|
||||
if (used608.has(v608)) bad(`${v608} está repetido entre idiomas`, 'srt_cc608');
|
||||
used608.add(v608); cfg.srt.cc608[l] = v608;
|
||||
}
|
||||
@@ -167,6 +174,9 @@ function portsOf(cfg) {
|
||||
if (cfg.srt && cfg.srt.enabled && cfg.srt.mode === 'listener') {
|
||||
out.push({ port: cfg.srt.port, what: 'salida SRT' }, { port: cfg.srt.port + 1, what: 'prueba interna de la salida SRT' });
|
||||
}
|
||||
if (cfg.srt && cfg.srt.enabled) {
|
||||
out.push({ port: cfg.srt.port + 10000, what: 'UDP interno de la salida SRT' }, { port: cfg.srt.port + 10001, what: 'UDP interno de la salida SRT' });
|
||||
}
|
||||
return out;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user