Исправление: том ./mods:/lampac/mods в compose и копии 10 модулей с enable:true; конфиг без SkipModules

This commit is contained in:
2026-10-02 12:11:49 +03:00
parent 8dcbc6bc52
commit 7b8e28b3bf
151 changed files with 68625 additions and 44 deletions
+130
View File
@@ -0,0 +1,130 @@
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Threading;
namespace Transcoding;
internal sealed class TranscodingJob : IDisposable
{
static readonly Serilog.ILogger Log = Serilog.Log.ForContext<TranscodingJob>();
private const int MaxLogLines = 200;
private readonly LinkedList<string> _log = new();
private readonly object _logSync = new();
private readonly CancellationTokenSource _cts = new();
private int _lastSegmentIndex = -1;
public TranscodingJob(string id, string streamId, string outputDirectory, Process process, TranscodingStartContext context)
{
Id = id;
StreamId = streamId;
OutputDirectory = outputDirectory;
Process = process;
Context = context;
StartedUtc = DateTime.UtcNow;
LastAccessUtc = StartedUtc;
}
public string Id { get; }
public string StreamId { get; }
public string OutputDirectory { get; }
public Process Process { get; }
public TranscodingStartContext Context { get; }
public DateTime StartedUtc { get; }
public DateTime LastAccessUtc { get; private set; }
public int? ExitCode { get; private set; }
public bool HasExited => Process.HasExited;
public CancellationToken CancellationToken => _cts.Token;
public void UpdateLastAccess() => LastAccessUtc = DateTime.UtcNow;
public int LastSegmentIndex => Volatile.Read(ref _lastSegmentIndex);
public void UpdateLastSegmentIndex(int segmentIndex)
{
if (segmentIndex < 0)
return;
while (true)
{
var current = Volatile.Read(ref _lastSegmentIndex);
if (segmentIndex <= current)
return;
if (Interlocked.CompareExchange(ref _lastSegmentIndex, segmentIndex, current) == current)
return;
}
}
public void AppendLog(string line)
{
if (string.IsNullOrWhiteSpace(line))
return;
lock (_logSync)
{
foreach (var part in line.Split('\n'))
{
string trimmed = part.TrimEnd('\r');
if (string.IsNullOrWhiteSpace(trimmed))
continue;
if (trimmed.Length > 2000)
trimmed = trimmed[..2000];
_log.AddLast(trimmed);
if (_log.Count > MaxLogLines)
_log.RemoveFirst();
}
}
}
public string[] SnapshotLog()
{
lock (_logSync)
return _log.ToArray();
}
public void SignalExit()
{
if (Process.HasExited)
ExitCode = Process.ExitCode;
}
public void StopBackground()
=> _cts.Cancel();
public void Dispose()
{
try
{
StopBackground();
}
catch (System.Exception ex)
{
Log.Error(ex, "CatchId={CatchId}", "id_p5i63hde");
}
try
{
Process.Dispose();
}
catch (System.Exception ex)
{
Log.Error(ex, "CatchId={CatchId}", "id_6fb2ahbb");
}
}
}
@@ -0,0 +1,25 @@
using System.Collections.Generic;
namespace Transcoding;
public sealed class TranscodingStartRequest
{
public string src { get; set; } = string.Empty;
public TranscodingAudioOptions audio { get; set; }
public TranscodingHlsOptions hls { get; set; }
public Dictionary<string, string> headers { get; set; }
public bool live { get; set; }
public bool? subtitles { get; set; }
}
public enum TranscodingJobState
{
Running,
Idle,
Stopped
}
File diff suppressed because it is too large Load Diff