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.
32 lines
948 B
32 lines
948 B
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Threading;
|
|
using System.Threading.Tasks;
|
|
using MediaBrowser.Controller.LiveTv;
|
|
using Microsoft.Extensions.Hosting;
|
|
|
|
namespace Jellyfin.LiveTv.EmbyTV;
|
|
|
|
/// <summary>
|
|
/// <see cref="IHostedService"/> responsible for initializing Live TV.
|
|
/// </summary>
|
|
public sealed class LiveTvHost : IHostedService
|
|
{
|
|
private readonly EmbyTV _service;
|
|
|
|
/// <summary>
|
|
/// Initializes a new instance of the <see cref="LiveTvHost"/> class.
|
|
/// </summary>
|
|
/// <param name="services">The available <see cref="ILiveTvService"/>s.</param>
|
|
public LiveTvHost(IEnumerable<ILiveTvService> services)
|
|
{
|
|
_service = services.OfType<EmbyTV>().First();
|
|
}
|
|
|
|
/// <inheritdoc />
|
|
public Task StartAsync(CancellationToken cancellationToken) => _service.Start();
|
|
|
|
/// <inheritdoc />
|
|
public Task StopAsync(CancellationToken cancellationToken) => Task.CompletedTask;
|
|
}
|