You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
38 lines
1.2 KiB
38 lines
1.2 KiB
9 months ago
|
using System.Threading;
|
||
|
using System.Threading.Tasks;
|
||
9 months ago
|
using Jellyfin.LiveTv.Timers;
|
||
9 months ago
|
using MediaBrowser.Controller.LiveTv;
|
||
|
using Microsoft.Extensions.Hosting;
|
||
|
|
||
9 months ago
|
namespace Jellyfin.LiveTv.Recordings;
|
||
9 months ago
|
|
||
|
/// <summary>
|
||
9 months ago
|
/// <see cref="IHostedService"/> responsible for Live TV recordings.
|
||
9 months ago
|
/// </summary>
|
||
9 months ago
|
public sealed class RecordingsHost : IHostedService
|
||
9 months ago
|
{
|
||
9 months ago
|
private readonly IRecordingsManager _recordingsManager;
|
||
|
private readonly TimerManager _timerManager;
|
||
9 months ago
|
|
||
|
/// <summary>
|
||
9 months ago
|
/// Initializes a new instance of the <see cref="RecordingsHost"/> class.
|
||
9 months ago
|
/// </summary>
|
||
9 months ago
|
/// <param name="recordingsManager">The <see cref="IRecordingsManager"/>.</param>
|
||
|
/// <param name="timerManager">The <see cref="TimerManager"/>.</param>
|
||
9 months ago
|
public RecordingsHost(IRecordingsManager recordingsManager, TimerManager timerManager)
|
||
9 months ago
|
{
|
||
9 months ago
|
_recordingsManager = recordingsManager;
|
||
|
_timerManager = timerManager;
|
||
9 months ago
|
}
|
||
|
|
||
|
/// <inheritdoc />
|
||
9 months ago
|
public Task StartAsync(CancellationToken cancellationToken)
|
||
|
{
|
||
|
_timerManager.RestartTimers();
|
||
|
return _recordingsManager.CreateRecordingFolders();
|
||
|
}
|
||
9 months ago
|
|
||
|
/// <inheritdoc />
|
||
|
public Task StopAsync(CancellationToken cancellationToken) => Task.CompletedTask;
|
||
|
}
|