Compare commits

..

No commits in common. "0a2d6a558c92fb992521f91631ead5f52e294d49" and "6ba5df6be96d7d4b5f8dc2e379a53be2bd32959a" have entirely different histories.

2 changed files with 3 additions and 29 deletions

View File

@ -69,7 +69,7 @@ public class RecordingSchedulerTask : IScheduledTask
new TaskTriggerInfo
{
Type = TaskTriggerInfo.TriggerInterval,
IntervalTicks = TimeSpan.FromSeconds(30).Ticks
IntervalTicks = TimeSpan.FromMinutes(2).Ticks
}
};
}

View File

@ -14,7 +14,6 @@ using Jellyfin.Plugin.SRFPlay.Api.Models;
using Jellyfin.Plugin.SRFPlay.Api.Models.PlayV3;
using Jellyfin.Plugin.SRFPlay.Services.Interfaces;
using MediaBrowser.Controller;
using MediaBrowser.Controller.MediaEncoding;
using Microsoft.Extensions.Logging;
namespace Jellyfin.Plugin.SRFPlay.Services;
@ -30,11 +29,9 @@ public class RecordingService : IRecordingService, IDisposable
private readonly IStreamUrlResolver _streamUrlResolver;
private readonly IMediaCompositionFetcher _mediaCompositionFetcher;
private readonly IServerApplicationHost _appHost;
private readonly IMediaEncoder _mediaEncoder;
private readonly ConcurrentDictionary<string, Process> _activeProcesses = new();
private static readonly JsonSerializerOptions _jsonOptions = new() { WriteIndented = true };
private readonly SemaphoreSlim _persistLock = new(1, 1);
private readonly SemaphoreSlim _processLock = new(1, 1);
private List<RecordingEntry> _recordings = new();
private bool _loaded;
private bool _disposed;
@ -48,15 +45,13 @@ public class RecordingService : IRecordingService, IDisposable
/// <param name="streamUrlResolver">The stream URL resolver.</param>
/// <param name="mediaCompositionFetcher">The media composition fetcher.</param>
/// <param name="appHost">The application host.</param>
/// <param name="mediaEncoder">The media encoder for ffmpeg path.</param>
public RecordingService(
ILogger<RecordingService> logger,
ISRFApiClientFactory apiClientFactory,
IStreamProxyService proxyService,
IStreamUrlResolver streamUrlResolver,
IMediaCompositionFetcher mediaCompositionFetcher,
IServerApplicationHost appHost,
IMediaEncoder mediaEncoder)
IServerApplicationHost appHost)
{
_logger = logger;
_apiClientFactory = apiClientFactory;
@ -64,7 +59,6 @@ public class RecordingService : IRecordingService, IDisposable
_streamUrlResolver = streamUrlResolver;
_mediaCompositionFetcher = mediaCompositionFetcher;
_appHost = appHost;
_mediaEncoder = mediaEncoder;
}
private string GetDataFilePath()
@ -306,25 +300,6 @@ public class RecordingService : IRecordingService, IDisposable
/// <inheritdoc />
public async Task ProcessRecordingsAsync(CancellationToken cancellationToken)
{
// Prevent overlapping scheduler runs from spawning duplicate ffmpeg processes
if (!await _processLock.WaitAsync(0).ConfigureAwait(false))
{
_logger.LogDebug("ProcessRecordingsAsync already running, skipping");
return;
}
try
{
await ProcessRecordingsCoreAsync(cancellationToken).ConfigureAwait(false);
}
finally
{
_processLock.Release();
}
}
private async Task ProcessRecordingsCoreAsync(CancellationToken cancellationToken)
{
await LoadRecordingsAsync().ConfigureAwait(false);
@ -441,7 +416,7 @@ public class RecordingService : IRecordingService, IDisposable
{
StartInfo = new ProcessStartInfo
{
FileName = _mediaEncoder.EncoderPath,
FileName = "ffmpeg",
Arguments = $"-y -i \"{inputUrl}\" -c copy -movflags +faststart \"{outputPath}\"",
UseShellExecute = false,
RedirectStandardInput = true,
@ -535,7 +510,6 @@ public class RecordingService : IRecordingService, IDisposable
}
_persistLock.Dispose();
_processLock.Dispose();
}
_disposed = true;