The Free Software Media System - Server Backend & API
3.2.22.4
Luke Pulverentidd7dc7dda305
diff --git a/Emby.Server.Implementations/LiveTv/TunerHosts/BaseTunerHost.cs b/Emby.Server.Implementations/LiveTv/TunerHosts/BaseTunerHost.csindex 10b7132a14..4b4f61d535 100644--- a/Emby.Server.Implementations/LiveTv/TunerHosts/BaseTunerHost.cs+++ b/Emby.Server.Implementations/LiveTv/TunerHosts/BaseTunerHost.cs@@ -10,9 +10,11 @@ using System.IO;using System.Linq;using System.Threading;using System.Threading.Tasks;+using MediaBrowser.Common.Extensions;using MediaBrowser.Controller.Configuration;using MediaBrowser.Controller.MediaEncoding;using MediaBrowser.Model.Dlna;+using MediaBrowser.Model.IO;using MediaBrowser.Model.Serialization;namespace Emby.Server.Implementations.LiveTv.TunerHosts@@ -23,16 +25,18 @@ namespace Emby.Server.Implementations.LiveTv.TunerHostsprotected readonly ILogger Logger;protected IJsonSerializer JsonSerializer;protected readonly IMediaEncoder MediaEncoder;+ protected readonly IFileSystem FileSystem;private readonly ConcurrentDictionary<string, ChannelCache> _channelCache =new ConcurrentDictionary<string, ChannelCache>(StringComparer.OrdinalIgnoreCase);- protected BaseTunerHost(IServerConfigurationManager config, ILogger logger, IJsonSerializer jsonSerializer, IMediaEncoder mediaEncoder)+ protected BaseTunerHost(IServerConfigurationManager config, ILogger logger, IJsonSerializer jsonSerializer, IMediaEncoder mediaEncoder, IFileSystem fileSystem){Config = config;Logger = logger;JsonSerializer = jsonSerializer;MediaEncoder = mediaEncoder;+ FileSystem = fileSystem;}protected abstract Task<List<ChannelInfo>> GetChannelsInternal(TunerHostInfo tuner, CancellationToken cancellationToken);@@ -81,16 +85,44 @@ namespace Emby.Server.Implementations.LiveTv.TunerHostsforeach (var host in hosts){+ var channelCacheFile = Path.Combine(Config.ApplicationPaths.CachePath, host.Id + "_channels");+try{var channels = await GetChannels(host, enableCache, cancellationToken).ConfigureAwait(false);var newChannels = channels.Where(i => !list.Any(l => string.Equals(i.Id, l.Id, StringComparison.OrdinalIgnoreCase))).ToList();list.AddRange(newChannels);++ if (!enableCache)+ {+ try+ {+ FileSystem.CreateDirectory(FileSystem.GetDirectoryName(channelCacheFile));+ JsonSerializer.SerializeToFile(channels, channelCacheFile);+ }+ catch (IOException)+ {++ }+ }}catch (Exception ex){Logger.ErrorException("Error getting channel list", ex);++ if (enableCache)+ {+ try+ {+ var channels = JsonSerializer.DeserializeFromFile<List<ChannelInfo>>(channelCacheFile);+ list.AddRange(channels);+ }+ catch (IOException)+ {++ }+ }}}diff --git a/Emby.Server.Implementations/LiveTv/TunerHosts/HdHomerun/HdHomerunHost.cs b/Emby.Server.Implementations/LiveTv/TunerHosts/HdHomerun/HdHomerunHost.csindex 153f86aed4..b6ba8b45c5 100644--- a/Emby.Server.Implementations/LiveTv/TunerHosts/HdHomerun/HdHomerunHost.cs+++ b/Emby.Server.Implementations/LiveTv/TunerHosts/HdHomerun/HdHomerunHost.cs@@ -27,17 +27,14 @@ namespace Emby.Server.Implementations.LiveTv.TunerHosts.HdHomerunpublic class HdHomerunHost : BaseTunerHost, ITunerHost, IConfigurableTunerHost{private readonly IHttpClient _httpClient;- private readonly IFileSystem _fileSystem;private readonly IServerApplicationHost _appHost;private readonly ISocketFactory _socketFactory;private readonly INetworkManager _networkManager;private readonly IEnvironmentInfo _environment;- public HdHomerunHost(IServerConfigurationManager config, ILogger logger, IJsonSerializer jsonSerializer, IMediaEncoder mediaEncoder, IHttpClient httpClient, IFileSystem fileSystem, IServerApplicationHost appHost, ISocketFactory socketFactory, INetworkManager networkManager, IEnvironmentInfo environment)- : base(config, logger, jsonSerializer, mediaEncoder)+ public HdHomerunHost(IServerConfigurationManager config, ILogger logger, IJsonSerializer jsonSerializer, IMediaEncoder mediaEncoder, IFileSystem fileSystem, IHttpClient httpClient, IServerApplicationHost appHost, ISocketFactory socketFactory, INetworkManager networkManager, IEnvironmentInfo environment) : base(config, logger, jsonSerializer, mediaEncoder, fileSystem){_httpClient = httpClient;- _fileSystem = fileSystem;_appHost = appHost;_socketFactory = socketFactory;_networkManager = networkManager;@@ -509,7 +506,7 @@ namespace Emby.Server.Implementations.LiveTv.TunerHosts.HdHomerunif (hdhomerunChannel != null && hdhomerunChannel.IsLegacyTuner){- return new HdHomerunUdpStream(mediaSource, streamId, new LegacyHdHomerunChannelCommands(hdhomerunChannel.Url), modelInfo.TunerCount, _fileSystem, _httpClient, Logger, Config.ApplicationPaths, _appHost, _socketFactory, _networkManager, _environment);+ return new HdHomerunUdpStream(mediaSource, streamId, new LegacyHdHomerunChannelCommands(hdhomerunChannel.Url), modelInfo.TunerCount, FileSystem, _httpClient, Logger, Config.ApplicationPaths, _appHost, _socketFactory, _networkManager, _environment);}// The UDP method is not working reliably on OSX, and on BSD it hasn't been tested yet@@ -529,10 +526,10 @@ namespace Emby.Server.Implementations.LiveTv.TunerHosts.HdHomerun}mediaSource.Path = httpUrl;- return new HdHomerunHttpStream(mediaSource, streamId, _fileSystem, _httpClient, Logger, Config.ApplicationPaths, _appHost, _environment);+ return new HdHomerunHttpStream(mediaSource, streamId, FileSystem, _httpClient, Logger, Config.ApplicationPaths, _appHost, _environment);}- return new HdHomerunUdpStream(mediaSource, streamId, new HdHomerunChannelCommands(hdhomerunChannel.Number, profile), modelInfo.TunerCount, _fileSystem, _httpClient, Logger, Config.ApplicationPaths, _appHost, _socketFactory, _networkManager, _environment);+ return new HdHomerunUdpStream(mediaSource, streamId, new HdHomerunChannelCommands(hdhomerunChannel.Number, profile), modelInfo.TunerCount, FileSystem, _httpClient, Logger, Config.ApplicationPaths, _appHost, _socketFactory, _networkManager, _environment);}public async Task Validate(TunerHostInfo info)diff --git a/Emby.Server.Implementations/LiveTv/TunerHosts/M3UTunerHost.cs b/Emby.Server.Implementations/LiveTv/TunerHosts/M3UTunerHost.csindex 8bf7a052e9..af4c7f3e7f 100644--- a/Emby.Server.Implementations/LiveTv/TunerHosts/M3UTunerHost.cs+++ b/Emby.Server.Implementations/LiveTv/TunerHosts/M3UTunerHost.cs@@ -25,15 +25,12 @@ namespace Emby.Server.Implementations.LiveTv.TunerHosts{public class M3UTunerHost : BaseTunerHost, ITunerHost, IConfigurableTunerHost{- private readonly IFileSystem _fileSystem;private readonly IHttpClient _httpClient;private readonly IServerApplicationHost _appHost;private readonly IEnvironmentInfo _environment;- public M3UTunerHost(IServerConfigurationManager config, ILogger logger, IJsonSerializer jsonSerializer, IMediaEncoder mediaEncoder, IFileSystem fileSystem, IHttpClient httpClient, IServerApplicationHost appHost, IEnvironmentInfo environment)- : base(config, logger, jsonSerializer, mediaEncoder)+ public M3UTunerHost(IServerConfigurationManager config, ILogger logger, IJsonSerializer jsonSerializer, IMediaEncoder mediaEncoder, IFileSystem fileSystem, IHttpClient httpClient, IServerApplicationHost appHost, IEnvironmentInfo environment) : base(config, logger, jsonSerializer, mediaEncoder, fileSystem){- _fileSystem = fileSystem;_httpClient = httpClient;_appHost = appHost;_environment = environment;@@ -51,7 +48,7 @@ namespace Emby.Server.Implementations.LiveTv.TunerHostsprotected override async Task<List<ChannelInfo>> GetChannelsInternal(TunerHostInfo info, CancellationToken cancellationToken){- var result = await new M3uParser(Logger, _fileSystem, _httpClient, _appHost).Parse(info.Url, ChannelIdPrefix, info.Id, !info.EnableTvgId, cancellationToken).ConfigureAwait(false);+ var result = await new M3uParser(Logger, FileSystem, _httpClient, _appHost).Parse(info.Url, ChannelIdPrefix, info.Id, !info.EnableTvgId, cancellationToken).ConfigureAwait(false);return result.Cast<ChannelInfo>().ToList();}@@ -76,13 +73,13 @@ namespace Emby.Server.Implementations.LiveTv.TunerHosts{var sources = await GetChannelStreamMediaSources(info, channelId, cancellationToken).ConfigureAwait(false);- var liveStream = new LiveStream(sources.First(), _environment, _fileSystem);+ var liveStream = new LiveStream(sources.First(), _environment, FileSystem);return liveStream;}public async Task Validate(TunerHostInfo info){- using (var stream = await new M3uParser(Logger, _fileSystem, _httpClient, _appHost).GetListingsStream(info.Url, CancellationToken.None).ConfigureAwait(false))+ using (var stream = await new M3uParser(Logger, FileSystem, _httpClient, _appHost).GetListingsStream(info.Url, CancellationToken.None).ConfigureAwait(false)){}diff --git a/MediaBrowser.Api/UserLibrary/UserLibraryService.cs b/MediaBrowser.Api/UserLibrary/UserLibraryService.csindex 3b638208b5..4bb3de8826 100644--- a/MediaBrowser.Api/UserLibrary/UserLibraryService.cs+++ b/MediaBrowser.Api/UserLibrary/UserLibraryService.cs@@ -224,7 +224,7 @@ namespace MediaBrowser.Api.UserLibrary[ApiMember(Name = "ParentId", Description = "Specify this to localize the search to a specific item or folder. Omit to use the root", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "GET")]public string ParentId { get; set; }- [ApiMember(Name = "Fields", Description = "Optional. Specify additional fields of information to return in the output. This allows multiple, comma delimeted. Options: Budget, Chapters, DateCreated, Genres, HomePageUrl, IndexOptions, MediaStreams, Overview, ParentId, Path, People, ProviderIds, PrimaryImageAspectRatio, Revenue, SortName, Studios, Taglines", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "GET", AllowMultiple = true)]+ [ApiMember(Name = "Fields", Description = "Optional. Specify additional fields of information to return in the output. This allows multiple, comma delimeted. Options: Chapters, DateCreated, Genres, HomePageUrl, IndexOptions, MediaStreams, Overview, ParentId, Path, People, ProviderIds, PrimaryImageAspectRatio, SortName, Studios, Taglines", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "GET", AllowMultiple = true)]public string Fields { get; set; }[ApiMember(Name = "IncludeItemTypes", Description = "Optional. If specified, results will be filtered based on item type. This allows multiple, comma delimeted.", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "GET", AllowMultiple = true)]diff --git a/SharedVersion.cs b/SharedVersion.csindex 957ba736c0..8565e17505 100644--- a/SharedVersion.cs+++ b/SharedVersion.cs@@ -1,3 +1,3 @@using System.Reflection;-[assembly: AssemblyVersion("3.2.22.3")]+[assembly: AssemblyVersion("3.2.22.4")]