From c9311c9e7e048eadb1abb62a1904098adb740a76 Mon Sep 17 00:00:00 2001 From: Patrick Barron Date: Tue, 6 Feb 2024 16:23:18 -0500 Subject: Use IHostedService for Live TV --- src/Jellyfin.LiveTv/EmbyTV/EntryPoint.cs | 21 --------------------- src/Jellyfin.LiveTv/EmbyTV/LiveTvHost.cs | 31 +++++++++++++++++++++++++++++++ 2 files changed, 31 insertions(+), 21 deletions(-) delete mode 100644 src/Jellyfin.LiveTv/EmbyTV/EntryPoint.cs create mode 100644 src/Jellyfin.LiveTv/EmbyTV/LiveTvHost.cs (limited to 'src') diff --git a/src/Jellyfin.LiveTv/EmbyTV/EntryPoint.cs b/src/Jellyfin.LiveTv/EmbyTV/EntryPoint.cs deleted file mode 100644 index e750c05ac8..0000000000 --- a/src/Jellyfin.LiveTv/EmbyTV/EntryPoint.cs +++ /dev/null @@ -1,21 +0,0 @@ -#pragma warning disable CS1591 - -using System.Threading.Tasks; -using MediaBrowser.Controller.Plugins; - -namespace Jellyfin.LiveTv.EmbyTV -{ - public sealed class EntryPoint : IServerEntryPoint - { - /// - public Task RunAsync() - { - return EmbyTV.Current.Start(); - } - - /// - public void Dispose() - { - } - } -} diff --git a/src/Jellyfin.LiveTv/EmbyTV/LiveTvHost.cs b/src/Jellyfin.LiveTv/EmbyTV/LiveTvHost.cs new file mode 100644 index 0000000000..dc15d53ffa --- /dev/null +++ b/src/Jellyfin.LiveTv/EmbyTV/LiveTvHost.cs @@ -0,0 +1,31 @@ +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; + +/// +/// responsible for initializing Live TV. +/// +public sealed class LiveTvHost : IHostedService +{ + private readonly EmbyTV _service; + + /// + /// Initializes a new instance of the class. + /// + /// The available s. + public LiveTvHost(IEnumerable services) + { + _service = services.OfType().First(); + } + + /// + public Task StartAsync(CancellationToken cancellationToken) => _service.Start(); + + /// + public Task StopAsync(CancellationToken cancellationToken) => Task.CompletedTask; +} -- cgit v1.2.3