Merge pull request #10838 from barronpm/livetv-project

Move Live TV code to Jellyfin.LiveTv
pull/10426/head^2
Cody Robibero 5 months ago committed by GitHub
commit 82df226246
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -15,7 +15,6 @@ using System.Security.Cryptography.X509Certificates;
using System.Threading.Tasks;
using Emby.Naming.Common;
using Emby.Photos;
using Emby.Server.Implementations.Channels;
using Emby.Server.Implementations.Collections;
using Emby.Server.Implementations.Configuration;
using Emby.Server.Implementations.Cryptography;
@ -25,7 +24,6 @@ using Emby.Server.Implementations.Dto;
using Emby.Server.Implementations.HttpServer.Security;
using Emby.Server.Implementations.IO;
using Emby.Server.Implementations.Library;
using Emby.Server.Implementations.LiveTv;
using Emby.Server.Implementations.Localization;
using Emby.Server.Implementations.Playlists;
using Emby.Server.Implementations.Plugins;
@ -504,8 +502,6 @@ namespace Emby.Server.Implementations
serviceCollection.AddSingleton(_xmlSerializer);
serviceCollection.AddSingleton<IStreamHelper, StreamHelper>();
serviceCollection.AddSingleton<ICryptoProvider, CryptographyProvider>();
serviceCollection.AddSingleton<ISocketFactory, SocketFactory>();
@ -557,8 +553,6 @@ namespace Emby.Server.Implementations
serviceCollection.AddTransient(provider => new Lazy<ILiveTvManager>(provider.GetRequiredService<ILiveTvManager>));
serviceCollection.AddSingleton<IDtoService, DtoService>();
serviceCollection.AddSingleton<IChannelManager, ChannelManager>();
serviceCollection.AddSingleton<ISessionManager, SessionManager>();
serviceCollection.AddSingleton<ICollectionManager, CollectionManager>();
@ -567,9 +561,6 @@ namespace Emby.Server.Implementations
serviceCollection.AddSingleton<ISyncPlayManager, SyncPlayManager>();
serviceCollection.AddSingleton<LiveTvDtoService>();
serviceCollection.AddSingleton<ILiveTvManager, LiveTvManager>();
serviceCollection.AddSingleton<IUserViewManager, UserViewManager>();
serviceCollection.AddSingleton<IChapterManager, ChapterManager>();

@ -22,7 +22,6 @@
<ItemGroup>
<PackageReference Include="DiscUtils.Udf" />
<PackageReference Include="Jellyfin.XmlTv" />
<PackageReference Include="Microsoft.Data.Sqlite" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection" />
<PackageReference Include="Microsoft.Extensions.Caching.Memory" />

@ -11,14 +11,15 @@ using System.Linq;
using System.Text.Json;
using System.Threading;
using System.Threading.Tasks;
using EasyCaching.Core.Configurations;
using Jellyfin.Data.Entities;
using Jellyfin.Data.Enums;
using Jellyfin.Extensions.Json;
using MediaBrowser.Common.Configuration;
using MediaBrowser.Common.Extensions;
using MediaBrowser.Controller;
using MediaBrowser.Controller.Entities;
using MediaBrowser.Controller.Library;
using MediaBrowser.Controller.LiveTv;
using MediaBrowser.Controller.MediaEncoding;
using MediaBrowser.Controller.Persistence;
using MediaBrowser.Controller.Providers;
@ -37,6 +38,7 @@ namespace Emby.Server.Implementations.Library
// Do not use a pipe here because Roku http requests to the server will fail, without any explicit error message.
private const char LiveStreamIdDelimeter = '_';
private readonly IServerApplicationHost _appHost;
private readonly IItemRepository _itemRepo;
private readonly IUserManager _userManager;
private readonly ILibraryManager _libraryManager;
@ -55,6 +57,7 @@ namespace Emby.Server.Implementations.Library
private IMediaSourceProvider[] _providers;
public MediaSourceManager(
IServerApplicationHost appHost,
IItemRepository itemRepo,
IApplicationPaths applicationPaths,
ILocalizationManager localizationManager,
@ -66,6 +69,7 @@ namespace Emby.Server.Implementations.Library
IMediaEncoder mediaEncoder,
IDirectoryService directoryService)
{
_appHost = appHost;
_itemRepo = itemRepo;
_userManager = userManager;
_libraryManager = libraryManager;
@ -799,6 +803,35 @@ namespace Emby.Server.Implementations.Library
return result.Item1;
}
public async Task<List<MediaSourceInfo>> GetRecordingStreamMediaSources(ActiveRecordingInfo info, CancellationToken cancellationToken)
{
var stream = new MediaSourceInfo
{
EncoderPath = _appHost.GetApiUrlForLocalAccess() + "/LiveTv/LiveRecordings/" + info.Id + "/stream",
EncoderProtocol = MediaProtocol.Http,
Path = info.Path,
Protocol = MediaProtocol.File,
Id = info.Id,
SupportsDirectPlay = false,
SupportsDirectStream = true,
SupportsTranscoding = true,
IsInfiniteStream = true,
RequiresOpening = false,
RequiresClosing = false,
BufferMs = 0,
IgnoreDts = true,
IgnoreIndex = true
};
await new LiveStreamHelper(_mediaEncoder, _logger, _appPaths)
.AddMediaInfoWithProbe(stream, false, false, cancellationToken).ConfigureAwait(false);
return new List<MediaSourceInfo>
{
stream
};
}
public async Task CloseLiveStream(string id)
{
ArgumentException.ThrowIfNullOrEmpty(id);

@ -6,6 +6,8 @@ using Emby.Server.Implementations.Session;
using Jellyfin.Api.WebSocketListeners;
using Jellyfin.Drawing;
using Jellyfin.Drawing.Skia;
using Jellyfin.LiveTv;
using Jellyfin.LiveTv.Channels;
using Jellyfin.Server.Implementations;
using Jellyfin.Server.Implementations.Activity;
using Jellyfin.Server.Implementations.Devices;
@ -16,15 +18,18 @@ using Jellyfin.Server.Implementations.Users;
using MediaBrowser.Controller;
using MediaBrowser.Controller.Authentication;
using MediaBrowser.Controller.BaseItemManager;
using MediaBrowser.Controller.Channels;
using MediaBrowser.Controller.Devices;
using MediaBrowser.Controller.Drawing;
using MediaBrowser.Controller.Events;
using MediaBrowser.Controller.Library;
using MediaBrowser.Controller.LiveTv;
using MediaBrowser.Controller.Lyrics;
using MediaBrowser.Controller.Net;
using MediaBrowser.Controller.Security;
using MediaBrowser.Controller.Trickplay;
using MediaBrowser.Model.Activity;
using MediaBrowser.Model.IO;
using MediaBrowser.Providers.Lyric;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
@ -96,6 +101,11 @@ namespace Jellyfin.Server
serviceCollection.AddScoped<IAuthenticationManager, AuthenticationManager>();
serviceCollection.AddSingleton<LiveTvDtoService>();
serviceCollection.AddSingleton<ILiveTvManager, LiveTvManager>();
serviceCollection.AddSingleton<IChannelManager, ChannelManager>();
serviceCollection.AddSingleton<IStreamHelper, StreamHelper>();
foreach (var type in GetExportTypes<ILyricProvider>())
{
serviceCollection.AddSingleton(typeof(ILyricProvider), type);
@ -117,6 +127,9 @@ namespace Jellyfin.Server
// Jellyfin.Server.Implementations
yield return typeof(JellyfinDbContext).Assembly;
// Jellyfin.LiveTv
yield return typeof(LiveTvManager).Assembly;
}
}
}

@ -58,6 +58,7 @@
<ProjectReference Include="..\src\Jellyfin.Drawing\Jellyfin.Drawing.csproj" />
<ProjectReference Include="..\Emby.Server.Implementations\Emby.Server.Implementations.csproj" />
<ProjectReference Include="..\src\Jellyfin.Drawing.Skia\Jellyfin.Drawing.Skia.csproj" />
<ProjectReference Include="..\src\Jellyfin.LiveTv\Jellyfin.LiveTv.csproj" />
<ProjectReference Include="..\Jellyfin.Server.Implementations\Jellyfin.Server.Implementations.csproj" />
<ProjectReference Include="..\src\Jellyfin.MediaEncoding.Hls\Jellyfin.MediaEncoding.Hls.csproj" />
</ItemGroup>

@ -87,6 +87,10 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Jellyfin.MediaEncoding.Hls.
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Jellyfin.MediaEncoding.Keyframes.Tests", "tests\Jellyfin.MediaEncoding.Keyframes.Tests\Jellyfin.MediaEncoding.Keyframes.Tests.csproj", "{24960660-DE6C-47BF-AEEF-CEE8F19FE6C2}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Jellyfin.LiveTv.Tests", "tests\Jellyfin.LiveTv.Tests\Jellyfin.LiveTv.Tests.csproj", "{C4F71272-C6BE-4C30-BE0D-4E6ED651D6D3}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Jellyfin.LiveTv", "src\Jellyfin.LiveTv\Jellyfin.LiveTv.csproj", "{8C6B2B13-58A4-4506-9DAB-1F882A093FE0}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@ -233,6 +237,14 @@ Global
{24960660-DE6C-47BF-AEEF-CEE8F19FE6C2}.Debug|Any CPU.Build.0 = Debug|Any CPU
{24960660-DE6C-47BF-AEEF-CEE8F19FE6C2}.Release|Any CPU.ActiveCfg = Release|Any CPU
{24960660-DE6C-47BF-AEEF-CEE8F19FE6C2}.Release|Any CPU.Build.0 = Release|Any CPU
{C4F71272-C6BE-4C30-BE0D-4E6ED651D6D3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{C4F71272-C6BE-4C30-BE0D-4E6ED651D6D3}.Debug|Any CPU.Build.0 = Debug|Any CPU
{C4F71272-C6BE-4C30-BE0D-4E6ED651D6D3}.Release|Any CPU.ActiveCfg = Release|Any CPU
{C4F71272-C6BE-4C30-BE0D-4E6ED651D6D3}.Release|Any CPU.Build.0 = Release|Any CPU
{8C6B2B13-58A4-4506-9DAB-1F882A093FE0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{8C6B2B13-58A4-4506-9DAB-1F882A093FE0}.Debug|Any CPU.Build.0 = Debug|Any CPU
{8C6B2B13-58A4-4506-9DAB-1F882A093FE0}.Release|Any CPU.ActiveCfg = Release|Any CPU
{8C6B2B13-58A4-4506-9DAB-1F882A093FE0}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
@ -259,6 +271,8 @@ Global
{08FFF49B-F175-4807-A2B5-73B0EBD9F716} = {C9F0AB5D-F4D7-40C8-A353-3305C86D6D4C}
{154872D9-6C12-4007-96E3-8F70A58386CE} = {C9F0AB5D-F4D7-40C8-A353-3305C86D6D4C}
{0A3FCC4D-C714-4072-B90F-E374A15F9FF9} = {C9F0AB5D-F4D7-40C8-A353-3305C86D6D4C}
{C4F71272-C6BE-4C30-BE0D-4E6ED651D6D3} = {FBBB5129-006E-4AD7-BAD5-8B7CA1D10ED6}
{8C6B2B13-58A4-4506-9DAB-1F882A093FE0} = {C9F0AB5D-F4D7-40C8-A353-3305C86D6D4C}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {3448830C-EBDC-426C-85CD-7BBB9651A7FE}

@ -8,6 +8,7 @@ using System.Threading;
using System.Threading.Tasks;
using Jellyfin.Data.Entities;
using MediaBrowser.Controller.Entities;
using MediaBrowser.Controller.LiveTv;
using MediaBrowser.Controller.Persistence;
using MediaBrowser.Model.Dto;
using MediaBrowser.Model.Entities;
@ -116,6 +117,14 @@ namespace MediaBrowser.Controller.Library
/// <returns>An instance of <see cref="ILiveStream"/>.</returns>
public ILiveStream GetLiveStreamInfoByUniqueId(string uniqueId);
/// <summary>
/// Gets the media sources for an active recording.
/// </summary>
/// <param name="info">The <see cref="ActiveRecordingInfo"/>.</param>
/// <param name="cancellationToken">The <see cref="CancellationToken"/>.</param>
/// <returns>A task containing the <see cref="MediaSourceInfo"/>'s for the recording.</returns>
Task<List<MediaSourceInfo>> GetRecordingStreamMediaSources(ActiveRecordingInfo info, CancellationToken cancellationToken);
/// <summary>
/// Closes the media source.
/// </summary>

@ -8,7 +8,7 @@ using MediaBrowser.Controller.Entities;
using MediaBrowser.Controller.Library;
using MediaBrowser.Model.Dto;
namespace Emby.Server.Implementations.Channels
namespace Jellyfin.LiveTv.Channels
{
/// <summary>
/// A media source provider for channels.

@ -7,7 +7,7 @@ using MediaBrowser.Controller.Entities;
using MediaBrowser.Controller.Providers;
using MediaBrowser.Model.Entities;
namespace Emby.Server.Implementations.Channels
namespace Jellyfin.LiveTv.Channels
{
/// <summary>
/// An image provider for channels.

@ -34,7 +34,7 @@ using MusicAlbum = MediaBrowser.Controller.Entities.Audio.MusicAlbum;
using Season = MediaBrowser.Controller.Entities.TV.Season;
using Series = MediaBrowser.Controller.Entities.TV.Series;
namespace Emby.Server.Implementations.Channels
namespace Jellyfin.LiveTv.Channels
{
/// <summary>
/// The LiveTV channel manager.

@ -8,7 +8,7 @@ using MediaBrowser.Controller.Entities;
using MediaBrowser.Controller.Library;
using Microsoft.Extensions.Logging;
namespace Emby.Server.Implementations.Channels
namespace Jellyfin.LiveTv.Channels
{
/// <summary>
/// A task to remove all non-installed channels from the database.

@ -9,7 +9,7 @@ using MediaBrowser.Model.Globalization;
using MediaBrowser.Model.Tasks;
using Microsoft.Extensions.Logging;
namespace Emby.Server.Implementations.Channels
namespace Jellyfin.LiveTv.Channels
{
/// <summary>
/// The "Refresh Channels" scheduled task.

@ -5,7 +5,6 @@ using System.IO;
using System.Net.Http;
using System.Threading;
using System.Threading.Tasks;
using Jellyfin.Api.Helpers;
using MediaBrowser.Common.Net;
using MediaBrowser.Controller.Library;
using MediaBrowser.Controller.Streaming;
@ -13,7 +12,7 @@ using MediaBrowser.Model.Dto;
using MediaBrowser.Model.IO;
using Microsoft.Extensions.Logging;
namespace Emby.Server.Implementations.LiveTv.EmbyTV
namespace Jellyfin.LiveTv.EmbyTV
{
public sealed class DirectRecorder : IRecorder
{

@ -14,14 +14,12 @@ using System.Text;
using System.Threading;
using System.Threading.Tasks;
using System.Xml;
using Emby.Server.Implementations.Library;
using Jellyfin.Data.Enums;
using Jellyfin.Data.Events;
using Jellyfin.Extensions;
using MediaBrowser.Common.Configuration;
using MediaBrowser.Common.Extensions;
using MediaBrowser.Common.Progress;
using MediaBrowser.Controller;
using MediaBrowser.Controller.Configuration;
using MediaBrowser.Controller.Dto;
using MediaBrowser.Controller.Entities;
@ -39,7 +37,7 @@ using MediaBrowser.Model.MediaInfo;
using MediaBrowser.Model.Providers;
using Microsoft.Extensions.Logging;
namespace Emby.Server.Implementations.LiveTv.EmbyTV
namespace Jellyfin.LiveTv.EmbyTV
{
public sealed class EmbyTV : ILiveTvService, ISupportsDirectStreamProvider, ISupportsNewTimerIds, IDisposable
{
@ -47,7 +45,6 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
private const int TunerDiscoveryDurationMs = 3000;
private readonly IServerApplicationHost _appHost;
private readonly ILogger<EmbyTV> _logger;
private readonly IHttpClientFactory _httpClientFactory;
private readonly IServerConfigurationManager _config;
@ -76,7 +73,6 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
private bool _disposed;
public EmbyTV(
IServerApplicationHost appHost,
IStreamHelper streamHelper,
IMediaSourceManager mediaSourceManager,
ILogger<EmbyTV> logger,
@ -91,7 +87,6 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
{
Current = this;
_appHost = appHost;
_logger = logger;
_httpClientFactory = httpClientFactory;
_config = config;
@ -1021,35 +1016,6 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV
throw new NotImplementedException();
}
public async Task<List<MediaSourceInfo>> GetRecordingStreamMediaSources(ActiveRecordingInfo info, CancellationToken cancellationToken)
{
var stream = new MediaSourceInfo
{
EncoderPath = _appHost.GetApiUrlForLocalAccess() + "/LiveTv/LiveRecordings/" + info.Id + "/stream",
EncoderProtocol = MediaProtocol.Http,
Path = info.Path,
Protocol = MediaProtocol.File,
Id = info.Id,
SupportsDirectPlay = false,
SupportsDirectStream = true,
SupportsTranscoding = true,
IsInfiniteStream = true,
RequiresOpening = false,
RequiresClosing = false,
BufferMs = 0,
IgnoreDts = true,
IgnoreIndex = true
};
await new LiveStreamHelper(_mediaEncoder, _logger, _config.CommonApplicationPaths)
.AddMediaInfoWithProbe(stream, false, false, cancellationToken).ConfigureAwait(false);
return new List<MediaSourceInfo>
{
stream
};
}
public Task CloseLiveStream(string id, CancellationToken cancellationToken)
{
return Task.CompletedTask;

@ -23,7 +23,7 @@ using MediaBrowser.Model.Dto;
using MediaBrowser.Model.IO;
using Microsoft.Extensions.Logging;
namespace Emby.Server.Implementations.LiveTv.EmbyTV
namespace Jellyfin.LiveTv.EmbyTV
{
public class EncodedRecorder : IRecorder
{

@ -3,7 +3,7 @@
using System.Threading.Tasks;
using MediaBrowser.Controller.Plugins;
namespace Emby.Server.Implementations.LiveTv.EmbyTV
namespace Jellyfin.LiveTv.EmbyTV
{
public sealed class EntryPoint : IServerEntryPoint
{

@ -4,7 +4,7 @@ using System;
using System.Collections.Generic;
using MediaBrowser.Controller.LiveTv;
namespace Emby.Server.Implementations.LiveTv.EmbyTV
namespace Jellyfin.LiveTv.EmbyTV
{
internal class EpgChannelData
{

@ -6,7 +6,7 @@ using System.Threading.Tasks;
using MediaBrowser.Controller.Library;
using MediaBrowser.Model.Dto;
namespace Emby.Server.Implementations.LiveTv.EmbyTV
namespace Jellyfin.LiveTv.EmbyTV
{
public interface IRecorder : IDisposable
{

@ -9,7 +9,7 @@ using System.Text.Json;
using Jellyfin.Extensions.Json;
using Microsoft.Extensions.Logging;
namespace Emby.Server.Implementations.LiveTv.EmbyTV
namespace Jellyfin.LiveTv.EmbyTV
{
public class ItemDataProvider<T>
where T : class

@ -1,7 +1,7 @@
using MediaBrowser.Common.Configuration;
using MediaBrowser.Model.Configuration;
namespace Emby.Server.Implementations.LiveTv.EmbyTV
namespace Jellyfin.LiveTv.EmbyTV
{
/// <summary>
/// Class containing extension methods for working with the nfo configuration.

@ -5,7 +5,7 @@ using System.Globalization;
using System.Text;
using MediaBrowser.Controller.LiveTv;
namespace Emby.Server.Implementations.LiveTv.EmbyTV
namespace Jellyfin.LiveTv.EmbyTV
{
internal static class RecordingHelper
{

@ -4,7 +4,7 @@ using System;
using MediaBrowser.Controller.LiveTv;
using Microsoft.Extensions.Logging;
namespace Emby.Server.Implementations.LiveTv.EmbyTV
namespace Jellyfin.LiveTv.EmbyTV
{
public class SeriesTimerManager : ItemDataProvider<SeriesTimerInfo>
{

@ -10,7 +10,7 @@ using MediaBrowser.Controller.LiveTv;
using MediaBrowser.Model.LiveTv;
using Microsoft.Extensions.Logging;
namespace Emby.Server.Implementations.LiveTv.EmbyTV
namespace Jellyfin.LiveTv.EmbyTV
{
public class TimerManager : ItemDataProvider<TimerInfo>
{

@ -1,5 +1,6 @@
#nullable disable
#pragma warning disable CA1711
#pragma warning disable CS1591
using System;
@ -10,7 +11,7 @@ using System.Threading.Tasks;
using MediaBrowser.Controller.Library;
using MediaBrowser.Model.Dto;
namespace Emby.Server.Implementations.Library
namespace Jellyfin.LiveTv
{
public sealed class ExclusiveLiveStream : ILiveStream
{

@ -0,0 +1,23 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
</PropertyGroup>
<ItemGroup>
<AssemblyAttribute Include="System.Runtime.CompilerServices.InternalsVisibleToAttribute">
<_Parameter1>Jellyfin.LiveTv.Tests</_Parameter1>
</AssemblyAttribute>
</ItemGroup>
<ItemGroup>
<PackageReference Include="Jellyfin.XmlTv" />
<PackageReference Include="System.Linq.Async" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\MediaBrowser.Model\MediaBrowser.Model.csproj" />
<ProjectReference Include="..\..\MediaBrowser.Controller\MediaBrowser.Controller.csproj" />
<ProjectReference Include="..\..\MediaBrowser.Common\MediaBrowser.Common.csproj" />
</ItemGroup>
</Project>

@ -16,9 +16,9 @@ using System.Text;
using System.Text.Json;
using System.Threading;
using System.Threading.Tasks;
using Emby.Server.Implementations.LiveTv.Listings.SchedulesDirectDtos;
using Jellyfin.Extensions;
using Jellyfin.Extensions.Json;
using Jellyfin.LiveTv.Listings.SchedulesDirectDtos;
using MediaBrowser.Common.Net;
using MediaBrowser.Controller.Authentication;
using MediaBrowser.Controller.LiveTv;
@ -27,7 +27,7 @@ using MediaBrowser.Model.Entities;
using MediaBrowser.Model.LiveTv;
using Microsoft.Extensions.Logging;
namespace Emby.Server.Implementations.LiveTv.Listings
namespace Jellyfin.LiveTv.Listings
{
public class SchedulesDirect : IListingsProvider, IDisposable
{
@ -613,6 +613,7 @@ namespace Emby.Server.Implementations.LiveTv.Listings
// Response is automatically disposed in the calling function,
// so dispose manually if not returning.
#pragma warning disable IDISP016, IDISP017
response.Dispose();
if (!enableRetry || (int)response.StatusCode >= 500)
{
@ -621,6 +622,7 @@ namespace Emby.Server.Implementations.LiveTv.Listings
null,
response.StatusCode);
}
#pragma warning restore IDISP016, IDISP017
_tokens.Clear();
options.Headers.TryAddWithoutValidation("token", await GetToken(providerInfo, cancellationToken).ConfigureAwait(false));

@ -1,6 +1,6 @@
using System.Text.Json.Serialization;
namespace Emby.Server.Implementations.LiveTv.Listings.SchedulesDirectDtos
namespace Jellyfin.LiveTv.Listings.SchedulesDirectDtos
{
/// <summary>
/// Broadcaster dto.

@ -1,6 +1,6 @@
using System.Text.Json.Serialization;
namespace Emby.Server.Implementations.LiveTv.Listings.SchedulesDirectDtos
namespace Jellyfin.LiveTv.Listings.SchedulesDirectDtos
{
/// <summary>
/// Caption dto.

@ -1,6 +1,6 @@
using System.Text.Json.Serialization;
namespace Emby.Server.Implementations.LiveTv.Listings.SchedulesDirectDtos
namespace Jellyfin.LiveTv.Listings.SchedulesDirectDtos
{
/// <summary>
/// Cast dto.

@ -2,7 +2,7 @@ using System;
using System.Collections.Generic;
using System.Text.Json.Serialization;
namespace Emby.Server.Implementations.LiveTv.Listings.SchedulesDirectDtos
namespace Jellyfin.LiveTv.Listings.SchedulesDirectDtos
{
/// <summary>
/// Channel dto.

@ -1,6 +1,6 @@
using System.Text.Json.Serialization;
namespace Emby.Server.Implementations.LiveTv.Listings.SchedulesDirectDtos
namespace Jellyfin.LiveTv.Listings.SchedulesDirectDtos
{
/// <summary>
/// Content rating dto.

@ -1,6 +1,6 @@
using System.Text.Json.Serialization;
namespace Emby.Server.Implementations.LiveTv.Listings.SchedulesDirectDtos
namespace Jellyfin.LiveTv.Listings.SchedulesDirectDtos
{
/// <summary>
/// Crew dto.

@ -2,7 +2,7 @@ using System;
using System.Collections.Generic;
using System.Text.Json.Serialization;
namespace Emby.Server.Implementations.LiveTv.Listings.SchedulesDirectDtos
namespace Jellyfin.LiveTv.Listings.SchedulesDirectDtos
{
/// <summary>
/// Day dto.

@ -1,6 +1,6 @@
using System.Text.Json.Serialization;
namespace Emby.Server.Implementations.LiveTv.Listings.SchedulesDirectDtos
namespace Jellyfin.LiveTv.Listings.SchedulesDirectDtos
{
/// <summary>
/// Description 1_000 dto.

@ -1,6 +1,6 @@
using System.Text.Json.Serialization;
namespace Emby.Server.Implementations.LiveTv.Listings.SchedulesDirectDtos
namespace Jellyfin.LiveTv.Listings.SchedulesDirectDtos
{
/// <summary>
/// Description 100 dto.

@ -2,7 +2,7 @@ using System;
using System.Collections.Generic;
using System.Text.Json.Serialization;
namespace Emby.Server.Implementations.LiveTv.Listings.SchedulesDirectDtos
namespace Jellyfin.LiveTv.Listings.SchedulesDirectDtos
{
/// <summary>
/// Descriptions program dto.

@ -1,6 +1,6 @@
using System.Text.Json.Serialization;
namespace Emby.Server.Implementations.LiveTv.Listings.SchedulesDirectDtos
namespace Jellyfin.LiveTv.Listings.SchedulesDirectDtos
{
/// <summary>
/// Event details dto.

@ -1,6 +1,6 @@
using System.Text.Json.Serialization;
namespace Emby.Server.Implementations.LiveTv.Listings.SchedulesDirectDtos
namespace Jellyfin.LiveTv.Listings.SchedulesDirectDtos
{
/// <summary>
/// Gracenote dto.

@ -2,7 +2,7 @@ using System;
using System.Collections.Generic;
using System.Text.Json.Serialization;
namespace Emby.Server.Implementations.LiveTv.Listings.SchedulesDirectDtos
namespace Jellyfin.LiveTv.Listings.SchedulesDirectDtos
{
/// <summary>
/// Headends dto.

@ -1,6 +1,6 @@
using System.Text.Json.Serialization;
namespace Emby.Server.Implementations.LiveTv.Listings.SchedulesDirectDtos
namespace Jellyfin.LiveTv.Listings.SchedulesDirectDtos
{
/// <summary>
/// Image data dto.

@ -1,6 +1,6 @@
using System.Text.Json.Serialization;
namespace Emby.Server.Implementations.LiveTv.Listings.SchedulesDirectDtos
namespace Jellyfin.LiveTv.Listings.SchedulesDirectDtos
{
/// <summary>
/// The lineup dto.

@ -2,7 +2,7 @@ using System;
using System.Collections.Generic;
using System.Text.Json.Serialization;
namespace Emby.Server.Implementations.LiveTv.Listings.SchedulesDirectDtos
namespace Jellyfin.LiveTv.Listings.SchedulesDirectDtos
{
/// <summary>
/// Lineups dto.

@ -1,6 +1,6 @@
using System.Text.Json.Serialization;
namespace Emby.Server.Implementations.LiveTv.Listings.SchedulesDirectDtos
namespace Jellyfin.LiveTv.Listings.SchedulesDirectDtos
{
/// <summary>
/// Logo dto.

@ -1,6 +1,6 @@
using System.Text.Json.Serialization;
namespace Emby.Server.Implementations.LiveTv.Listings.SchedulesDirectDtos
namespace Jellyfin.LiveTv.Listings.SchedulesDirectDtos
{
/// <summary>
/// Map dto.

@ -1,6 +1,6 @@
using System.Text.Json.Serialization;
namespace Emby.Server.Implementations.LiveTv.Listings.SchedulesDirectDtos
namespace Jellyfin.LiveTv.Listings.SchedulesDirectDtos
{
/// <summary>
/// Metadata dto.

@ -1,6 +1,6 @@
using System.Text.Json.Serialization;
namespace Emby.Server.Implementations.LiveTv.Listings.SchedulesDirectDtos
namespace Jellyfin.LiveTv.Listings.SchedulesDirectDtos
{
/// <summary>
/// Metadata programs dto.

@ -1,7 +1,7 @@
using System;
using System.Text.Json.Serialization;
namespace Emby.Server.Implementations.LiveTv.Listings.SchedulesDirectDtos
namespace Jellyfin.LiveTv.Listings.SchedulesDirectDtos
{
/// <summary>
/// Metadata schedule dto.

@ -2,7 +2,7 @@ using System;
using System.Collections.Generic;
using System.Text.Json.Serialization;
namespace Emby.Server.Implementations.LiveTv.Listings.SchedulesDirectDtos
namespace Jellyfin.LiveTv.Listings.SchedulesDirectDtos
{
/// <summary>
/// Movie dto.

@ -1,6 +1,6 @@
using System.Text.Json.Serialization;
namespace Emby.Server.Implementations.LiveTv.Listings.SchedulesDirectDtos
namespace Jellyfin.LiveTv.Listings.SchedulesDirectDtos
{
/// <summary>
/// Multipart dto.

@ -2,7 +2,7 @@ using System;
using System.Collections.Generic;
using System.Text.Json.Serialization;
namespace Emby.Server.Implementations.LiveTv.Listings.SchedulesDirectDtos
namespace Jellyfin.LiveTv.Listings.SchedulesDirectDtos
{
/// <summary>
/// Program details dto.

@ -2,7 +2,7 @@ using System;
using System.Collections.Generic;
using System.Text.Json.Serialization;
namespace Emby.Server.Implementations.LiveTv.Listings.SchedulesDirectDtos
namespace Jellyfin.LiveTv.Listings.SchedulesDirectDtos
{
/// <summary>
/// Program dto.

@ -1,6 +1,6 @@
using System.Text.Json.Serialization;
namespace Emby.Server.Implementations.LiveTv.Listings.SchedulesDirectDtos
namespace Jellyfin.LiveTv.Listings.SchedulesDirectDtos
{
/// <summary>
/// Quality rating dto.

@ -1,6 +1,6 @@
using System.Text.Json.Serialization;
namespace Emby.Server.Implementations.LiveTv.Listings.SchedulesDirectDtos
namespace Jellyfin.LiveTv.Listings.SchedulesDirectDtos
{
/// <summary>
/// Rating dto.

@ -1,6 +1,6 @@
using System.Text.Json.Serialization;
namespace Emby.Server.Implementations.LiveTv.Listings.SchedulesDirectDtos
namespace Jellyfin.LiveTv.Listings.SchedulesDirectDtos
{
/// <summary>
/// Recommendation dto.

@ -2,7 +2,7 @@ using System;
using System.Collections.Generic;
using System.Text.Json.Serialization;
namespace Emby.Server.Implementations.LiveTv.Listings.SchedulesDirectDtos
namespace Jellyfin.LiveTv.Listings.SchedulesDirectDtos
{
/// <summary>
/// Request schedule for channel dto.

@ -2,7 +2,7 @@ using System;
using System.Collections.Generic;
using System.Text.Json.Serialization;
namespace Emby.Server.Implementations.LiveTv.Listings.SchedulesDirectDtos
namespace Jellyfin.LiveTv.Listings.SchedulesDirectDtos
{
/// <summary>
/// Show image dto.

@ -2,7 +2,7 @@ using System;
using System.Collections.Generic;
using System.Text.Json.Serialization;
namespace Emby.Server.Implementations.LiveTv.Listings.SchedulesDirectDtos
namespace Jellyfin.LiveTv.Listings.SchedulesDirectDtos
{
/// <summary>
/// Station dto.

@ -1,6 +1,6 @@
using System.Text.Json.Serialization;
namespace Emby.Server.Implementations.LiveTv.Listings.SchedulesDirectDtos
namespace Jellyfin.LiveTv.Listings.SchedulesDirectDtos
{
/// <summary>
/// Title dto.

@ -1,7 +1,7 @@
using System;
using System.Text.Json.Serialization;
namespace Emby.Server.Implementations.LiveTv.Listings.SchedulesDirectDtos
namespace Jellyfin.LiveTv.Listings.SchedulesDirectDtos
{
/// <summary>
/// The token dto.

@ -23,7 +23,7 @@ using MediaBrowser.Model.IO;
using MediaBrowser.Model.LiveTv;
using Microsoft.Extensions.Logging;
namespace Emby.Server.Implementations.LiveTv.Listings
namespace Jellyfin.LiveTv.Listings
{
public class XmlTvListingsProvider : IListingsProvider
{

@ -2,7 +2,7 @@ using System.Collections.Generic;
using MediaBrowser.Common.Configuration;
using MediaBrowser.Model.LiveTv;
namespace Emby.Server.Implementations.LiveTv
namespace Jellyfin.LiveTv
{
/// <summary>
/// <see cref="IConfigurationFactory" /> implementation for <see cref="LiveTvOptions" />.

@ -20,7 +20,7 @@ using MediaBrowser.Model.Entities;
using MediaBrowser.Model.LiveTv;
using Microsoft.Extensions.Logging;
namespace Emby.Server.Implementations.LiveTv
namespace Jellyfin.LiveTv
{
public class LiveTvDtoService
{

@ -9,7 +9,6 @@ using System.Linq;
using System.Text.Json;
using System.Threading;
using System.Threading.Tasks;
using Emby.Server.Implementations.Library;
using Jellyfin.Data.Entities;
using Jellyfin.Data.Enums;
using Jellyfin.Data.Events;
@ -34,7 +33,7 @@ using MediaBrowser.Model.Querying;
using MediaBrowser.Model.Tasks;
using Microsoft.Extensions.Logging;
namespace Emby.Server.Implementations.LiveTv
namespace Jellyfin.LiveTv
{
/// <summary>
/// Class LiveTvManager.
@ -231,7 +230,9 @@ namespace Emby.Server.Implementations.LiveTv
_logger.LogInformation("Opening channel stream from {0}, external channel Id: {1}", service.Name, channel.ExternalId);
MediaSourceInfo info;
#pragma warning disable CA1859 // TODO: Analyzer bug?
ILiveStream liveStream;
#pragma warning restore CA1859
if (service is ISupportsDirectStreamProvider supportsManagedStream)
{
liveStream = await supportsManagedStream.GetChannelStreamWithDirectStreamProvider(channel.ExternalId, mediaSourceId, currentLiveStreams, cancellationToken).ConfigureAwait(false);

@ -16,7 +16,7 @@ using MediaBrowser.Model.Dto;
using MediaBrowser.Model.MediaInfo;
using Microsoft.Extensions.Logging;
namespace Emby.Server.Implementations.LiveTv
namespace Jellyfin.LiveTv
{
public class LiveTvMediaSourceProvider : IMediaSourceProvider
{
@ -61,7 +61,7 @@ namespace Emby.Server.Implementations.LiveTv
{
if (activeRecordingInfo is not null)
{
sources = await EmbyTV.EmbyTV.Current.GetRecordingStreamMediaSources(activeRecordingInfo, cancellationToken)
sources = await _mediaSourceManager.GetRecordingStreamMediaSources(activeRecordingInfo, cancellationToken)
.ConfigureAwait(false);
}
else

@ -15,7 +15,7 @@ using MediaBrowser.Controller.Session;
using MediaBrowser.Model.Session;
using Microsoft.Extensions.Logging;
namespace Emby.Server.Implementations.EntryPoints
namespace Jellyfin.LiveTv
{
public sealed class RecordingNotifier : IServerEntryPoint
{

@ -7,7 +7,7 @@ using MediaBrowser.Controller.LiveTv;
using MediaBrowser.Model.LiveTv;
using MediaBrowser.Model.Tasks;
namespace Emby.Server.Implementations.LiveTv
namespace Jellyfin.LiveTv
{
/// <summary>
/// The "Refresh Guide" scheduled task.

@ -7,7 +7,7 @@ using System.Threading;
using System.Threading.Tasks;
using MediaBrowser.Model.IO;
namespace Emby.Server.Implementations.IO
namespace Jellyfin.LiveTv
{
public class StreamHelper : IStreamHelper
{

@ -19,7 +19,7 @@ using MediaBrowser.Model.IO;
using MediaBrowser.Model.LiveTv;
using Microsoft.Extensions.Logging;
namespace Emby.Server.Implementations.LiveTv.TunerHosts
namespace Jellyfin.LiveTv.TunerHosts
{
public abstract class BaseTunerHost
{

@ -1,6 +1,6 @@
#nullable disable
namespace Emby.Server.Implementations.LiveTv.TunerHosts.HdHomerun
namespace Jellyfin.LiveTv.TunerHosts.HdHomerun
{
internal class Channels
{

@ -2,7 +2,7 @@
using System;
namespace Emby.Server.Implementations.LiveTv.TunerHosts.HdHomerun
namespace Jellyfin.LiveTv.TunerHosts.HdHomerun
{
internal class DiscoverResponse
{

@ -3,7 +3,7 @@
using System;
using System.Collections.Generic;
namespace Emby.Server.Implementations.LiveTv.TunerHosts.HdHomerun
namespace Jellyfin.LiveTv.TunerHosts.HdHomerun
{
public class HdHomerunChannelCommands : IHdHomerunChannelCommands
{

@ -30,7 +30,7 @@ using MediaBrowser.Model.MediaInfo;
using MediaBrowser.Model.Net;
using Microsoft.Extensions.Logging;
namespace Emby.Server.Implementations.LiveTv.TunerHosts.HdHomerun
namespace Jellyfin.LiveTv.TunerHosts.HdHomerun
{
public class HdHomerunHost : BaseTunerHost, ITunerHost, IConfigurableTunerHost
{
@ -143,7 +143,7 @@ namespace Emby.Server.Implementations.LiveTv.TunerHosts.HdHomerun
if (!throwAllExceptions && ex.StatusCode.HasValue && ex.StatusCode.Value == HttpStatusCode.NotFound)
{
const string DefaultValue = "HDHR";
var response = new DiscoverResponse
var discoverResponse = new DiscoverResponse
{
ModelNumber = DefaultValue
};
@ -152,11 +152,11 @@ namespace Emby.Server.Implementations.LiveTv.TunerHosts.HdHomerun
// HDHR4 doesn't have this api
lock (_modelCache)
{
_modelCache[cacheKey] = response;
_modelCache[cacheKey] = discoverResponse;
}
}
return response;
return discoverResponse;
}
throw;

@ -14,7 +14,7 @@ using System.Threading.Tasks;
using MediaBrowser.Common;
using MediaBrowser.Controller.LiveTv;
namespace Emby.Server.Implementations.LiveTv.TunerHosts.HdHomerun
namespace Jellyfin.LiveTv.TunerHosts.HdHomerun
{
public sealed class HdHomerunManager : IDisposable
{

@ -1,5 +1,6 @@
#nullable disable
#pragma warning disable CA1711
#pragma warning disable CS1591
using System;
@ -19,7 +20,7 @@ using MediaBrowser.Model.LiveTv;
using MediaBrowser.Model.MediaInfo;
using Microsoft.Extensions.Logging;
namespace Emby.Server.Implementations.LiveTv.TunerHosts.HdHomerun
namespace Jellyfin.LiveTv.TunerHosts.HdHomerun
{
public class HdHomerunUdpStream : LiveStream, IDirectStreamProvider
{

@ -2,7 +2,7 @@
using System.Collections.Generic;
namespace Emby.Server.Implementations.LiveTv.TunerHosts.HdHomerun
namespace Jellyfin.LiveTv.TunerHosts.HdHomerun
{
public interface IHdHomerunChannelCommands
{

@ -3,7 +3,7 @@
using System.Collections.Generic;
using System.Text.RegularExpressions;
namespace Emby.Server.Implementations.LiveTv.TunerHosts.HdHomerun
namespace Jellyfin.LiveTv.TunerHosts.HdHomerun
{
public partial class LegacyHdHomerunChannelCommands : IHdHomerunChannelCommands
{

@ -1,5 +1,6 @@
#nullable disable
#pragma warning disable CA1711
#pragma warning disable CS1591
using System;
@ -14,7 +15,7 @@ using MediaBrowser.Model.IO;
using MediaBrowser.Model.LiveTv;
using Microsoft.Extensions.Logging;
namespace Emby.Server.Implementations.LiveTv.TunerHosts
namespace Jellyfin.LiveTv.TunerHosts
{
public class LiveStream : ILiveStream
{

@ -24,7 +24,7 @@ using MediaBrowser.Model.MediaInfo;
using Microsoft.Extensions.Logging;
using Microsoft.Net.Http.Headers;
namespace Emby.Server.Implementations.LiveTv.TunerHosts
namespace Jellyfin.LiveTv.TunerHosts
{
public class M3UTunerHost : BaseTunerHost, ITunerHost, IConfigurableTunerHost
{

@ -18,7 +18,7 @@ using MediaBrowser.Model.IO;
using MediaBrowser.Model.LiveTv;
using Microsoft.Extensions.Logging;
namespace Emby.Server.Implementations.LiveTv.TunerHosts
namespace Jellyfin.LiveTv.TunerHosts
{
public partial class M3uParser
{

@ -1,3 +1,4 @@
#pragma warning disable CA1711
#pragma warning disable CS1591
using System;
@ -16,7 +17,7 @@ using MediaBrowser.Model.LiveTv;
using MediaBrowser.Model.MediaInfo;
using Microsoft.Extensions.Logging;
namespace Emby.Server.Implementations.LiveTv.TunerHosts
namespace Jellyfin.LiveTv.TunerHosts
{
public class SharedHttpStream : LiveStream, IDirectStreamProvider
{

@ -6,13 +6,13 @@ using System.Threading;
using System.Threading.Tasks;
using AutoFixture;
using AutoFixture.AutoMoq;
using Emby.Server.Implementations.LiveTv.TunerHosts.HdHomerun;
using Jellyfin.LiveTv.TunerHosts.HdHomerun;
using MediaBrowser.Model.LiveTv;
using Moq;
using Moq.Protected;
using Xunit;
namespace Jellyfin.Server.Implementations.Tests.LiveTv
namespace Jellyfin.LiveTv.Tests
{
public class HdHomerunHostTests
{

@ -1,9 +1,9 @@
using System;
using System.Text;
using Emby.Server.Implementations.LiveTv.TunerHosts.HdHomerun;
using Jellyfin.LiveTv.TunerHosts.HdHomerun;
using Xunit;
namespace Jellyfin.Server.Implementations.Tests.LiveTv
namespace Jellyfin.LiveTv.Tests
{
public class HdHomerunManagerTests
{

@ -0,0 +1,29 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
</PropertyGroup>
<ItemGroup>
<None Include="Test Data\**\*.*">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
</ItemGroup>
<ItemGroup>
<PackageReference Include="AutoFixture" />
<PackageReference Include="AutoFixture.AutoMoq" />
<PackageReference Include="Microsoft.NET.Test.Sdk" />
<PackageReference Include="Moq" />
<PackageReference Include="xunit" />
<PackageReference Include="xunit.runner.visualstudio">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Xunit.SkippableFact" />
<PackageReference Include="coverlet.collector" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\src\Jellyfin.LiveTv\Jellyfin.LiveTv.csproj" />
</ItemGroup>
</Project>

@ -6,13 +6,13 @@ using System.Threading;
using System.Threading.Tasks;
using AutoFixture;
using AutoFixture.AutoMoq;
using Emby.Server.Implementations.LiveTv.Listings;
using Jellyfin.LiveTv.Listings;
using MediaBrowser.Model.LiveTv;
using Moq;
using Moq.Protected;
using Xunit;
namespace Jellyfin.Server.Implementations.Tests.LiveTv.Listings;
namespace Jellyfin.LiveTv.Tests.Listings;
public class XmlTvListingsProviderTests
{

@ -1,9 +1,9 @@
using System;
using Emby.Server.Implementations.LiveTv.EmbyTV;
using Jellyfin.LiveTv.EmbyTV;
using MediaBrowser.Controller.LiveTv;
using Xunit;
namespace Jellyfin.Server.Implementations.Tests.LiveTv
namespace Jellyfin.LiveTv.Tests
{
public static class RecordingHelperTests
{

@ -2,11 +2,11 @@ using System;
using System.Collections.Generic;
using System.IO;
using System.Text.Json;
using Emby.Server.Implementations.LiveTv.Listings.SchedulesDirectDtos;
using Jellyfin.Extensions.Json;
using Jellyfin.LiveTv.Listings.SchedulesDirectDtos;
using Xunit;
namespace Jellyfin.Server.Implementations.Tests.LiveTv.SchedulesDirect
namespace Jellyfin.LiveTv.Tests.SchedulesDirect
{
public class SchedulesDirectDeserializeTests
{

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save