From a2c371ec60f8da649887f72d9ee38a8f3a85365a Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Tue, 15 Sep 2015 23:55:26 -0400 Subject: [PATCH] rework collection editor --- MediaBrowser.Api/Dlna/DlnaServerService.cs | 1 - .../Serialization/JsonSerializer.cs | 4 +- .../Channels/IChannelFactory.cs | 14 - .../Channels/IChannelManager.cs | 2 +- .../MediaBrowser.Controller.csproj | 1 - .../Channels/DlnaChannelFactory.cs | 526 +++++++++--------- MediaBrowser.Dlna/Main/DlnaEntryPoint.cs | 2 - .../Encoder/MediaEncoder.cs | 3 - .../Configuration/ServerConfiguration.cs | 4 - MediaBrowser.Model/Dlna/ConditionProcessor.cs | 1 - .../Omdb/OmdbImageProvider.cs | 3 +- .../Channels/ChannelManager.cs | 21 +- .../Security/AuthorizationContext.cs | 41 -- .../Sync/SyncManager.cs | 2 - .../ApplicationHost.cs | 2 +- .../MediaBrowser.WebDashboard.csproj | 3 - 16 files changed, 271 insertions(+), 359 deletions(-) delete mode 100644 MediaBrowser.Controller/Channels/IChannelFactory.cs diff --git a/MediaBrowser.Api/Dlna/DlnaServerService.cs b/MediaBrowser.Api/Dlna/DlnaServerService.cs index 4f5e2ab25..4e7b1a7d5 100644 --- a/MediaBrowser.Api/Dlna/DlnaServerService.cs +++ b/MediaBrowser.Api/Dlna/DlnaServerService.cs @@ -108,7 +108,6 @@ namespace MediaBrowser.Api.Dlna private readonly IConnectionManager _connectionManager; private readonly IMediaReceiverRegistrar _mediaReceiverRegistrar; - // TODO: Add utf-8 private const string XMLContentType = "text/xml; charset=UTF-8"; public DlnaServerService(IDlnaManager dlnaManager, IContentDirectory contentDirectory, IConnectionManager connectionManager, IMediaReceiverRegistrar mediaReceiverRegistrar) diff --git a/MediaBrowser.Common.Implementations/Serialization/JsonSerializer.cs b/MediaBrowser.Common.Implementations/Serialization/JsonSerializer.cs index 2c93f0549..a758a0c1e 100644 --- a/MediaBrowser.Common.Implementations/Serialization/JsonSerializer.cs +++ b/MediaBrowser.Common.Implementations/Serialization/JsonSerializer.cs @@ -1,7 +1,7 @@ -using MediaBrowser.Model.Serialization; +using MediaBrowser.Common.IO; +using MediaBrowser.Model.Serialization; using System; using System.IO; -using MediaBrowser.Common.IO; namespace MediaBrowser.Common.Implementations.Serialization { diff --git a/MediaBrowser.Controller/Channels/IChannelFactory.cs b/MediaBrowser.Controller/Channels/IChannelFactory.cs deleted file mode 100644 index c7ed92586..000000000 --- a/MediaBrowser.Controller/Channels/IChannelFactory.cs +++ /dev/null @@ -1,14 +0,0 @@ -using System.Collections.Generic; - -namespace MediaBrowser.Controller.Channels -{ - public interface IChannelFactory - { - IEnumerable GetChannels(); - } - - public interface IFactoryChannel - { - - } -} \ No newline at end of file diff --git a/MediaBrowser.Controller/Channels/IChannelManager.cs b/MediaBrowser.Controller/Channels/IChannelManager.cs index 8d3e0f596..fec550df8 100644 --- a/MediaBrowser.Controller/Channels/IChannelManager.cs +++ b/MediaBrowser.Controller/Channels/IChannelManager.cs @@ -16,7 +16,7 @@ namespace MediaBrowser.Controller.Channels /// /// The channels. /// The factories. - void AddParts(IEnumerable channels, IEnumerable factories); + void AddParts(IEnumerable channels); /// /// Gets the channel download path. diff --git a/MediaBrowser.Controller/MediaBrowser.Controller.csproj b/MediaBrowser.Controller/MediaBrowser.Controller.csproj index dffb29f93..ea6e98ea6 100644 --- a/MediaBrowser.Controller/MediaBrowser.Controller.csproj +++ b/MediaBrowser.Controller/MediaBrowser.Controller.csproj @@ -77,7 +77,6 @@ - diff --git a/MediaBrowser.Dlna/Channels/DlnaChannelFactory.cs b/MediaBrowser.Dlna/Channels/DlnaChannelFactory.cs index f26ceff90..315313c04 100644 --- a/MediaBrowser.Dlna/Channels/DlnaChannelFactory.cs +++ b/MediaBrowser.Dlna/Channels/DlnaChannelFactory.cs @@ -18,325 +18,325 @@ using System.Threading.Tasks; namespace MediaBrowser.Dlna.Channels { - public class DlnaChannelFactory : IChannelFactory, IDisposable - { - private readonly IServerConfigurationManager _config; - private readonly ILogger _logger; - private readonly IHttpClient _httpClient; + //public class DlnaChannelFactory : IChannelFactory, IDisposable + //{ + // private readonly IServerConfigurationManager _config; + // private readonly ILogger _logger; + // private readonly IHttpClient _httpClient; - private readonly IDeviceDiscovery _deviceDiscovery; + // private readonly IDeviceDiscovery _deviceDiscovery; - private readonly SemaphoreSlim _syncLock = new SemaphoreSlim(1, 1); - private List _servers = new List(); + // private readonly SemaphoreSlim _syncLock = new SemaphoreSlim(1, 1); + // private List _servers = new List(); - public static DlnaChannelFactory Instance; + // public static DlnaChannelFactory Instance; - private Func> _localServersLookup; + // private Func> _localServersLookup; - public DlnaChannelFactory(IServerConfigurationManager config, IHttpClient httpClient, ILogger logger, IDeviceDiscovery deviceDiscovery) - { - _config = config; - _httpClient = httpClient; - _logger = logger; - _deviceDiscovery = deviceDiscovery; - Instance = this; - } + // public DlnaChannelFactory(IServerConfigurationManager config, IHttpClient httpClient, ILogger logger, IDeviceDiscovery deviceDiscovery) + // { + // _config = config; + // _httpClient = httpClient; + // _logger = logger; + // _deviceDiscovery = deviceDiscovery; + // Instance = this; + // } - internal void Start(Func> localServersLookup) - { - _localServersLookup = localServersLookup; + // internal void Start(Func> localServersLookup) + // { + // _localServersLookup = localServersLookup; - //deviceDiscovery.DeviceDiscovered += deviceDiscovery_DeviceDiscovered; - _deviceDiscovery.DeviceLeft += deviceDiscovery_DeviceLeft; - } + // //deviceDiscovery.DeviceDiscovered += deviceDiscovery_DeviceDiscovered; + // _deviceDiscovery.DeviceLeft += deviceDiscovery_DeviceLeft; + // } - async void deviceDiscovery_DeviceDiscovered(object sender, SsdpMessageEventArgs e) - { - string usn; - if (!e.Headers.TryGetValue("USN", out usn)) usn = string.Empty; + // async void deviceDiscovery_DeviceDiscovered(object sender, SsdpMessageEventArgs e) + // { + // string usn; + // if (!e.Headers.TryGetValue("USN", out usn)) usn = string.Empty; - string nt; - if (!e.Headers.TryGetValue("NT", out nt)) nt = string.Empty; + // string nt; + // if (!e.Headers.TryGetValue("NT", out nt)) nt = string.Empty; - string location; - if (!e.Headers.TryGetValue("Location", out location)) location = string.Empty; + // string location; + // if (!e.Headers.TryGetValue("Location", out location)) location = string.Empty; - if (!IsValid(nt, usn)) - { - return; - } + // if (!IsValid(nt, usn)) + // { + // return; + // } - if (_localServersLookup != null) - { - if (_localServersLookup().Any(i => usn.IndexOf(i, StringComparison.OrdinalIgnoreCase) != -1)) - { - // Don't add the local Dlna server to this - return; - } - } + // if (_localServersLookup != null) + // { + // if (_localServersLookup().Any(i => usn.IndexOf(i, StringComparison.OrdinalIgnoreCase) != -1)) + // { + // // Don't add the local Dlna server to this + // return; + // } + // } - if (GetExistingServers(usn).Any()) - { - return; - } + // if (GetExistingServers(usn).Any()) + // { + // return; + // } - await _syncLock.WaitAsync().ConfigureAwait(false); + // await _syncLock.WaitAsync().ConfigureAwait(false); - try - { - if (GetExistingServers(usn).Any()) - { - return; - } + // try + // { + // if (GetExistingServers(usn).Any()) + // { + // return; + // } - var device = await Device.CreateuPnpDeviceAsync(new Uri(location), _httpClient, _config, _logger) - .ConfigureAwait(false); + // var device = await Device.CreateuPnpDeviceAsync(new Uri(location), _httpClient, _config, _logger) + // .ConfigureAwait(false); - if (!_servers.Any(i => string.Equals(i.Properties.UUID, device.Properties.UUID, StringComparison.OrdinalIgnoreCase))) - { - _servers.Add(device); - } - } - catch (Exception ex) - { + // if (!_servers.Any(i => string.Equals(i.Properties.UUID, device.Properties.UUID, StringComparison.OrdinalIgnoreCase))) + // { + // _servers.Add(device); + // } + // } + // catch (Exception ex) + // { - } - finally - { - _syncLock.Release(); - } - } + // } + // finally + // { + // _syncLock.Release(); + // } + // } - async void deviceDiscovery_DeviceLeft(object sender, SsdpMessageEventArgs e) - { - string usn; - if (!e.Headers.TryGetValue("USN", out usn)) usn = String.Empty; + // async void deviceDiscovery_DeviceLeft(object sender, SsdpMessageEventArgs e) + // { + // string usn; + // if (!e.Headers.TryGetValue("USN", out usn)) usn = String.Empty; - string nt; - if (!e.Headers.TryGetValue("NT", out nt)) nt = String.Empty; + // string nt; + // if (!e.Headers.TryGetValue("NT", out nt)) nt = String.Empty; - if (!IsValid(nt, usn)) - { - return; - } + // if (!IsValid(nt, usn)) + // { + // return; + // } - if (!GetExistingServers(usn).Any()) - { - return; - } + // if (!GetExistingServers(usn).Any()) + // { + // return; + // } - await _syncLock.WaitAsync().ConfigureAwait(false); + // await _syncLock.WaitAsync().ConfigureAwait(false); - try - { - var list = _servers.ToList(); + // try + // { + // var list = _servers.ToList(); - foreach (var device in GetExistingServers(usn).ToList()) - { - list.Remove(device); - } + // foreach (var device in GetExistingServers(usn).ToList()) + // { + // list.Remove(device); + // } - _servers = list; - } - finally - { - _syncLock.Release(); - } - } + // _servers = list; + // } + // finally + // { + // _syncLock.Release(); + // } + // } - private bool IsValid(string nt, string usn) - { - // It has to report that it's a media renderer - if (usn.IndexOf("ContentDirectory:", StringComparison.OrdinalIgnoreCase) == -1 && - nt.IndexOf("ContentDirectory:", StringComparison.OrdinalIgnoreCase) == -1 && - usn.IndexOf("MediaServer:", StringComparison.OrdinalIgnoreCase) == -1 && - nt.IndexOf("MediaServer:", StringComparison.OrdinalIgnoreCase) == -1) - { - return false; - } + // private bool IsValid(string nt, string usn) + // { + // // It has to report that it's a media renderer + // if (usn.IndexOf("ContentDirectory:", StringComparison.OrdinalIgnoreCase) == -1 && + // nt.IndexOf("ContentDirectory:", StringComparison.OrdinalIgnoreCase) == -1 && + // usn.IndexOf("MediaServer:", StringComparison.OrdinalIgnoreCase) == -1 && + // nt.IndexOf("MediaServer:", StringComparison.OrdinalIgnoreCase) == -1) + // { + // return false; + // } - return true; - } + // return true; + // } - private IEnumerable GetExistingServers(string usn) - { - return _servers - .Where(i => usn.IndexOf(i.Properties.UUID, StringComparison.OrdinalIgnoreCase) != -1); - } + // private IEnumerable GetExistingServers(string usn) + // { + // return _servers + // .Where(i => usn.IndexOf(i.Properties.UUID, StringComparison.OrdinalIgnoreCase) != -1); + // } - public IEnumerable GetChannels() - { - //if (_servers.Count > 0) - //{ - // var service = _servers[0].Properties.Services - // .FirstOrDefault(i => string.Equals(i.ServiceType, "urn:schemas-upnp-org:service:ContentDirectory:1", StringComparison.OrdinalIgnoreCase)); + // public IEnumerable GetChannels() + // { + // //if (_servers.Count > 0) + // //{ + // // var service = _servers[0].Properties.Services + // // .FirstOrDefault(i => string.Equals(i.ServiceType, "urn:schemas-upnp-org:service:ContentDirectory:1", StringComparison.OrdinalIgnoreCase)); - // var controlUrl = service == null ? null : (_servers[0].Properties.BaseUrl.TrimEnd('/') + "/" + service.ControlUrl.TrimStart('/')); + // // var controlUrl = service == null ? null : (_servers[0].Properties.BaseUrl.TrimEnd('/') + "/" + service.ControlUrl.TrimStart('/')); - // if (!string.IsNullOrEmpty(controlUrl)) - // { - // return new List - // { - // new ServerChannel(_servers.ToList(), _httpClient, _logger, controlUrl) - // }; - // } - //} + // // if (!string.IsNullOrEmpty(controlUrl)) + // // { + // // return new List + // // { + // // new ServerChannel(_servers.ToList(), _httpClient, _logger, controlUrl) + // // }; + // // } + // //} - return new List(); - } + // return new List(); + // } - public void Dispose() - { - if (_deviceDiscovery != null) - { - _deviceDiscovery.DeviceDiscovered -= deviceDiscovery_DeviceDiscovered; - _deviceDiscovery.DeviceLeft -= deviceDiscovery_DeviceLeft; - } - } - } + // public void Dispose() + // { + // if (_deviceDiscovery != null) + // { + // _deviceDiscovery.DeviceDiscovered -= deviceDiscovery_DeviceDiscovered; + // _deviceDiscovery.DeviceLeft -= deviceDiscovery_DeviceLeft; + // } + // } + //} - public class ServerChannel : IChannel, IFactoryChannel - { - private readonly IHttpClient _httpClient; - private readonly ILogger _logger; - public string ControlUrl { get; set; } - public List Servers { get; set; } + //public class ServerChannel : IChannel, IFactoryChannel + //{ + // private readonly IHttpClient _httpClient; + // private readonly ILogger _logger; + // public string ControlUrl { get; set; } + // public List Servers { get; set; } - public ServerChannel(IHttpClient httpClient, ILogger logger) - { - _httpClient = httpClient; - _logger = logger; - Servers = new List(); - } + // public ServerChannel(IHttpClient httpClient, ILogger logger) + // { + // _httpClient = httpClient; + // _logger = logger; + // Servers = new List(); + // } - public string Name - { - get { return "Devices"; } - } + // public string Name + // { + // get { return "Devices"; } + // } - public string Description - { - get { return string.Empty; } - } + // public string Description + // { + // get { return string.Empty; } + // } - public string DataVersion - { - get { return DateTime.UtcNow.Ticks.ToString(); } - } + // public string DataVersion + // { + // get { return DateTime.UtcNow.Ticks.ToString(); } + // } - public string HomePageUrl - { - get { return string.Empty; } - } + // public string HomePageUrl + // { + // get { return string.Empty; } + // } - public ChannelParentalRating ParentalRating - { - get { return ChannelParentalRating.GeneralAudience; } - } + // public ChannelParentalRating ParentalRating + // { + // get { return ChannelParentalRating.GeneralAudience; } + // } - public InternalChannelFeatures GetChannelFeatures() - { - return new InternalChannelFeatures - { - ContentTypes = new List - { - ChannelMediaContentType.Song, - ChannelMediaContentType.Clip - }, + // public InternalChannelFeatures GetChannelFeatures() + // { + // return new InternalChannelFeatures + // { + // ContentTypes = new List + // { + // ChannelMediaContentType.Song, + // ChannelMediaContentType.Clip + // }, - MediaTypes = new List - { - ChannelMediaType.Audio, - ChannelMediaType.Video, - ChannelMediaType.Photo - } - }; - } + // MediaTypes = new List + // { + // ChannelMediaType.Audio, + // ChannelMediaType.Video, + // ChannelMediaType.Photo + // } + // }; + // } - public bool IsEnabledFor(string userId) - { - return true; - } + // public bool IsEnabledFor(string userId) + // { + // return true; + // } - public async Task GetChannelItems(InternalChannelItemQuery query, CancellationToken cancellationToken) - { - IEnumerable items; + // public async Task GetChannelItems(InternalChannelItemQuery query, CancellationToken cancellationToken) + // { + // IEnumerable items; - if (string.IsNullOrWhiteSpace(query.FolderId)) - { - items = Servers.Select(i => new ChannelItemInfo - { - FolderType = ChannelFolderType.Container, - Id = GetServerId(i), - Name = i.Properties.Name, - Overview = i.Properties.ModelDescription, - Type = ChannelItemType.Folder - }); - } - else - { - var idParts = query.FolderId.Split('|'); - var folderId = idParts.Length == 2 ? idParts[1] : null; + // if (string.IsNullOrWhiteSpace(query.FolderId)) + // { + // items = Servers.Select(i => new ChannelItemInfo + // { + // FolderType = ChannelFolderType.Container, + // Id = GetServerId(i), + // Name = i.Properties.Name, + // Overview = i.Properties.ModelDescription, + // Type = ChannelItemType.Folder + // }); + // } + // else + // { + // var idParts = query.FolderId.Split('|'); + // var folderId = idParts.Length == 2 ? idParts[1] : null; - var result = await new ContentDirectoryBrowser(_httpClient, _logger).Browse(new ContentDirectoryBrowseRequest - { - Limit = query.Limit, - StartIndex = query.StartIndex, - ParentId = folderId, - ContentDirectoryUrl = ControlUrl + // var result = await new ContentDirectoryBrowser(_httpClient, _logger).Browse(new ContentDirectoryBrowseRequest + // { + // Limit = query.Limit, + // StartIndex = query.StartIndex, + // ParentId = folderId, + // ContentDirectoryUrl = ControlUrl - }, cancellationToken).ConfigureAwait(false); + // }, cancellationToken).ConfigureAwait(false); - items = result.Items.ToList(); - } + // items = result.Items.ToList(); + // } - var list = items.ToList(); - var count = list.Count; + // var list = items.ToList(); + // var count = list.Count; - list = ApplyPaging(list, query).ToList(); + // list = ApplyPaging(list, query).ToList(); - return new ChannelItemResult - { - Items = list, - TotalRecordCount = count - }; - } + // return new ChannelItemResult + // { + // Items = list, + // TotalRecordCount = count + // }; + // } - private string GetServerId(Device device) - { - return device.Properties.UUID.GetMD5().ToString("N"); - } + // private string GetServerId(Device device) + // { + // return device.Properties.UUID.GetMD5().ToString("N"); + // } - private IEnumerable ApplyPaging(IEnumerable items, InternalChannelItemQuery query) - { - if (query.StartIndex.HasValue) - { - items = items.Skip(query.StartIndex.Value); - } + // private IEnumerable ApplyPaging(IEnumerable items, InternalChannelItemQuery query) + // { + // if (query.StartIndex.HasValue) + // { + // items = items.Skip(query.StartIndex.Value); + // } - if (query.Limit.HasValue) - { - items = items.Take(query.Limit.Value); - } + // if (query.Limit.HasValue) + // { + // items = items.Take(query.Limit.Value); + // } - return items; - } + // return items; + // } - public Task GetChannelImage(ImageType type, CancellationToken cancellationToken) - { - // TODO: Implement - return Task.FromResult(new DynamicImageResponse - { - HasImage = false - }); - } + // public Task GetChannelImage(ImageType type, CancellationToken cancellationToken) + // { + // // TODO: Implement + // return Task.FromResult(new DynamicImageResponse + // { + // HasImage = false + // }); + // } - public IEnumerable GetSupportedChannelImages() - { - return new List - { - ImageType.Primary - }; - } - } + // public IEnumerable GetSupportedChannelImages() + // { + // return new List + // { + // ImageType.Primary + // }; + // } + //} } diff --git a/MediaBrowser.Dlna/Main/DlnaEntryPoint.cs b/MediaBrowser.Dlna/Main/DlnaEntryPoint.cs index bdb778cab..8c45757e7 100644 --- a/MediaBrowser.Dlna/Main/DlnaEntryPoint.cs +++ b/MediaBrowser.Dlna/Main/DlnaEntryPoint.cs @@ -81,8 +81,6 @@ namespace MediaBrowser.Dlna.Main ReloadComponents(); _config.NamedConfigurationUpdated += _config_NamedConfigurationUpdated; - - DlnaChannelFactory.Instance.Start(() => _registeredServerIds); } void _config_NamedConfigurationUpdated(object sender, ConfigurationUpdateEventArgs e) diff --git a/MediaBrowser.MediaEncoding/Encoder/MediaEncoder.cs b/MediaBrowser.MediaEncoding/Encoder/MediaEncoder.cs index e2543c841..01be4924a 100644 --- a/MediaBrowser.MediaEncoding/Encoder/MediaEncoder.cs +++ b/MediaBrowser.MediaEncoding/Encoder/MediaEncoder.cs @@ -483,9 +483,6 @@ namespace MediaBrowser.MediaEncoding.Encoder } } - // TODO: Output in webp for smaller sizes - // -f image2 -f webp - // Use ffmpeg to sample 100 (we can drop this if required using thumbnail=50 for 50 frames) frames and pick the best thumbnail. Have a fall back just in case. var args = useIFrame ? string.Format("-i {0} -threads 1 -v quiet -vframes 1 -vf \"{2},thumbnail=30\" -f image2 \"{1}\"", inputPath, "-", vf) : string.Format("-i {0} -threads 1 -v quiet -vframes 1 -vf \"{2}\" -f image2 \"{1}\"", inputPath, "-", vf); diff --git a/MediaBrowser.Model/Configuration/ServerConfiguration.cs b/MediaBrowser.Model/Configuration/ServerConfiguration.cs index 1fcad8c95..b137a8502 100644 --- a/MediaBrowser.Model/Configuration/ServerConfiguration.cs +++ b/MediaBrowser.Model/Configuration/ServerConfiguration.cs @@ -276,11 +276,7 @@ namespace MediaBrowser.Model.Configuration InsecureApps9 = new[] { - "Chromecast", - "iOS", "Unknown app", - "iPad", - "iPhone", "Windows Phone" }; diff --git a/MediaBrowser.Model/Dlna/ConditionProcessor.cs b/MediaBrowser.Model/Dlna/ConditionProcessor.cs index 793036f40..fd3df9c76 100644 --- a/MediaBrowser.Model/Dlna/ConditionProcessor.cs +++ b/MediaBrowser.Model/Dlna/ConditionProcessor.cs @@ -28,7 +28,6 @@ namespace MediaBrowser.Model.Dlna // TODO: Implement return true; case ProfileConditionValue.Has64BitOffsets: - // TODO: Implement return true; case ProfileConditionValue.IsAnamorphic: return IsConditionSatisfied(condition, isAnamorphic); diff --git a/MediaBrowser.Providers/Omdb/OmdbImageProvider.cs b/MediaBrowser.Providers/Omdb/OmdbImageProvider.cs index 7f804f9df..3f25f0f93 100644 --- a/MediaBrowser.Providers/Omdb/OmdbImageProvider.cs +++ b/MediaBrowser.Providers/Omdb/OmdbImageProvider.cs @@ -79,8 +79,7 @@ namespace MediaBrowser.Providers.Omdb public bool Supports(IHasImages item) { - // Save the http requests since we know it's not currently supported - // TODO: Check again periodically + // We'll hammer Omdb if we enable this if (item is Person) { return false; diff --git a/MediaBrowser.Server.Implementations/Channels/ChannelManager.cs b/MediaBrowser.Server.Implementations/Channels/ChannelManager.cs index 9edfc0c35..d7209fbdf 100644 --- a/MediaBrowser.Server.Implementations/Channels/ChannelManager.cs +++ b/MediaBrowser.Server.Implementations/Channels/ChannelManager.cs @@ -31,7 +31,6 @@ namespace MediaBrowser.Server.Implementations.Channels public class ChannelManager : IChannelManager, IDisposable { private IChannel[] _channels; - private IChannelFactory[] _factories; private readonly IUserManager _userManager; private readonly IUserDataManager _userDataManager; @@ -76,10 +75,9 @@ namespace MediaBrowser.Server.Implementations.Channels } } - public void AddParts(IEnumerable channels, IEnumerable factories) + public void AddParts(IEnumerable channels) { - _channels = channels.Where(i => !(i is IFactoryChannel)).ToArray(); - _factories = factories.ToArray(); + _channels = channels.ToArray(); } public string ChannelDownloadPath @@ -99,20 +97,7 @@ namespace MediaBrowser.Server.Implementations.Channels private IEnumerable GetAllChannels() { - return _factories - .SelectMany(i => - { - try - { - return i.GetChannels().ToList(); - } - catch (Exception ex) - { - _logger.ErrorException("Error getting channel list", ex); - return new List(); - } - }) - .Concat(_channels) + return _channels .OrderBy(i => i.Name); } diff --git a/MediaBrowser.Server.Implementations/HttpServer/Security/AuthorizationContext.cs b/MediaBrowser.Server.Implementations/HttpServer/Security/AuthorizationContext.cs index 80892b96c..ae5ce796e 100644 --- a/MediaBrowser.Server.Implementations/HttpServer/Security/AuthorizationContext.cs +++ b/MediaBrowser.Server.Implementations/HttpServer/Security/AuthorizationContext.cs @@ -69,47 +69,6 @@ namespace MediaBrowser.Server.Implementations.HttpServer.Security token = httpReq.QueryString["api_key"]; } - // Hack until iOS is updated - // TODO: Remove - if (string.IsNullOrWhiteSpace(client)) - { - var userAgent = httpReq.Headers["User-Agent"] ?? string.Empty; - - if (userAgent.IndexOf("mediabrowserios", StringComparison.OrdinalIgnoreCase) != -1 || - userAgent.IndexOf("iphone", StringComparison.OrdinalIgnoreCase) != -1 || - userAgent.IndexOf("ipad", StringComparison.OrdinalIgnoreCase) != -1) - { - client = "iOS"; - } - - else if (userAgent.IndexOf("crKey", StringComparison.OrdinalIgnoreCase) != -1) - { - client = "Chromecast"; - } - } - - // Hack until iOS is updated - // TODO: Remove - if (string.IsNullOrWhiteSpace(device)) - { - var userAgent = httpReq.Headers["User-Agent"] ?? string.Empty; - - if (userAgent.IndexOf("iPhone", StringComparison.OrdinalIgnoreCase) != -1) - { - device = "iPhone"; - } - - else if (userAgent.IndexOf("iPad", StringComparison.OrdinalIgnoreCase) != -1) - { - device = "iPad"; - } - - else if (userAgent.IndexOf("crKey", StringComparison.OrdinalIgnoreCase) != -1) - { - device = "Chromecast"; - } - } - var info = new AuthorizationInfo { Client = client, diff --git a/MediaBrowser.Server.Implementations/Sync/SyncManager.cs b/MediaBrowser.Server.Implementations/Sync/SyncManager.cs index 428ba5e20..15d196877 100644 --- a/MediaBrowser.Server.Implementations/Sync/SyncManager.cs +++ b/MediaBrowser.Server.Implementations/Sync/SyncManager.cs @@ -962,8 +962,6 @@ namespace MediaBrowser.Server.Implementations.Sync return false; } - // TODO: Make sure it hasn't been deleted - return true; } diff --git a/MediaBrowser.Server.Startup.Common/ApplicationHost.cs b/MediaBrowser.Server.Startup.Common/ApplicationHost.cs index ad2cd96b6..b55e727d6 100644 --- a/MediaBrowser.Server.Startup.Common/ApplicationHost.cs +++ b/MediaBrowser.Server.Startup.Common/ApplicationHost.cs @@ -790,7 +790,7 @@ namespace MediaBrowser.Server.Startup.Common SessionManager.AddParts(GetExports()); - ChannelManager.AddParts(GetExports(), GetExports()); + ChannelManager.AddParts(GetExports()); MediaSourceManager.AddParts(GetExports()); diff --git a/MediaBrowser.WebDashboard/MediaBrowser.WebDashboard.csproj b/MediaBrowser.WebDashboard/MediaBrowser.WebDashboard.csproj index ccac9d8d8..36c21efde 100644 --- a/MediaBrowser.WebDashboard/MediaBrowser.WebDashboard.csproj +++ b/MediaBrowser.WebDashboard/MediaBrowser.WebDashboard.csproj @@ -1005,9 +1005,6 @@ PreserveNewest - - PreserveNewest - PreserveNewest