using System.Threading;
using System.Threading.Tasks;
using Jellyfin.LiveTv.Timers;
using MediaBrowser.Controller.LiveTv;
using Microsoft.Extensions.Hosting;
namespace Jellyfin.LiveTv.Recordings;
///
/// responsible for Live TV recordings.
///
public sealed class RecordingsHost : IHostedService
{
private readonly IRecordingsManager _recordingsManager;
private readonly TimerManager _timerManager;
///
/// Initializes a new instance of the class.
///
/// The .
/// The .
public RecordingsHost(IRecordingsManager recordingsManager, TimerManager timerManager)
{
_recordingsManager = recordingsManager;
_timerManager = timerManager;
}
///
public Task StartAsync(CancellationToken cancellationToken)
{
_timerManager.RestartTimers();
return _recordingsManager.CreateRecordingFolders();
}
///
public Task StopAsync(CancellationToken cancellationToken) => Task.CompletedTask;
}