Scheduling fixes

This commit is contained in:
Duncan Tourolle 2026-03-07 16:24:29 +01:00
parent 6ba5df6be9
commit fb539d6a32
2 changed files with 8 additions and 3 deletions

View File

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

View File

@ -14,6 +14,7 @@ using Jellyfin.Plugin.SRFPlay.Api.Models;
using Jellyfin.Plugin.SRFPlay.Api.Models.PlayV3; using Jellyfin.Plugin.SRFPlay.Api.Models.PlayV3;
using Jellyfin.Plugin.SRFPlay.Services.Interfaces; using Jellyfin.Plugin.SRFPlay.Services.Interfaces;
using MediaBrowser.Controller; using MediaBrowser.Controller;
using MediaBrowser.Controller.MediaEncoding;
using Microsoft.Extensions.Logging; using Microsoft.Extensions.Logging;
namespace Jellyfin.Plugin.SRFPlay.Services; namespace Jellyfin.Plugin.SRFPlay.Services;
@ -29,6 +30,7 @@ public class RecordingService : IRecordingService, IDisposable
private readonly IStreamUrlResolver _streamUrlResolver; private readonly IStreamUrlResolver _streamUrlResolver;
private readonly IMediaCompositionFetcher _mediaCompositionFetcher; private readonly IMediaCompositionFetcher _mediaCompositionFetcher;
private readonly IServerApplicationHost _appHost; private readonly IServerApplicationHost _appHost;
private readonly IMediaEncoder _mediaEncoder;
private readonly ConcurrentDictionary<string, Process> _activeProcesses = new(); private readonly ConcurrentDictionary<string, Process> _activeProcesses = new();
private static readonly JsonSerializerOptions _jsonOptions = new() { WriteIndented = true }; private static readonly JsonSerializerOptions _jsonOptions = new() { WriteIndented = true };
private readonly SemaphoreSlim _persistLock = new(1, 1); private readonly SemaphoreSlim _persistLock = new(1, 1);
@ -45,13 +47,15 @@ public class RecordingService : IRecordingService, IDisposable
/// <param name="streamUrlResolver">The stream URL resolver.</param> /// <param name="streamUrlResolver">The stream URL resolver.</param>
/// <param name="mediaCompositionFetcher">The media composition fetcher.</param> /// <param name="mediaCompositionFetcher">The media composition fetcher.</param>
/// <param name="appHost">The application host.</param> /// <param name="appHost">The application host.</param>
/// <param name="mediaEncoder">The media encoder for ffmpeg path.</param>
public RecordingService( public RecordingService(
ILogger<RecordingService> logger, ILogger<RecordingService> logger,
ISRFApiClientFactory apiClientFactory, ISRFApiClientFactory apiClientFactory,
IStreamProxyService proxyService, IStreamProxyService proxyService,
IStreamUrlResolver streamUrlResolver, IStreamUrlResolver streamUrlResolver,
IMediaCompositionFetcher mediaCompositionFetcher, IMediaCompositionFetcher mediaCompositionFetcher,
IServerApplicationHost appHost) IServerApplicationHost appHost,
IMediaEncoder mediaEncoder)
{ {
_logger = logger; _logger = logger;
_apiClientFactory = apiClientFactory; _apiClientFactory = apiClientFactory;
@ -59,6 +63,7 @@ public class RecordingService : IRecordingService, IDisposable
_streamUrlResolver = streamUrlResolver; _streamUrlResolver = streamUrlResolver;
_mediaCompositionFetcher = mediaCompositionFetcher; _mediaCompositionFetcher = mediaCompositionFetcher;
_appHost = appHost; _appHost = appHost;
_mediaEncoder = mediaEncoder;
} }
private string GetDataFilePath() private string GetDataFilePath()
@ -416,7 +421,7 @@ public class RecordingService : IRecordingService, IDisposable
{ {
StartInfo = new ProcessStartInfo StartInfo = new ProcessStartInfo
{ {
FileName = "ffmpeg", FileName = _mediaEncoder.EncoderPath,
Arguments = $"-y -i \"{inputUrl}\" -c copy -movflags +faststart \"{outputPath}\"", Arguments = $"-y -i \"{inputUrl}\" -c copy -movflags +faststart \"{outputPath}\"",
UseShellExecute = false, UseShellExecute = false,
RedirectStandardInput = true, RedirectStandardInput = true,