From f031bb744b00d139a71036678abd6586e6595cb5 Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Sat, 3 May 2014 19:38:23 -0400 Subject: [PATCH] add new web client sidebar --- MediaBrowser.Controller/Channels/IChannel.cs | 5 ++++ .../Channels/IChannelManager.cs | 3 ++- MediaBrowser.Dlna/Didl/DidlBuilder.cs | 4 +-- MediaBrowser.Model/Querying/NextUpQuery.cs | 12 +++++++++ .../Channels/ChannelManager.cs | 27 ++++++++++++++++--- .../EntryPoints/Notifications/Notifier.cs | 12 ++++----- .../Localization/Server/server.json | 5 +++- .../ApplicationHost.cs | 2 +- .../MediaBrowser.WebDashboard.csproj | 24 +++++++++++++++++ 9 files changed, 80 insertions(+), 14 deletions(-) diff --git a/MediaBrowser.Controller/Channels/IChannel.cs b/MediaBrowser.Controller/Channels/IChannel.cs index 0c4be86306..ca4b7f551a 100644 --- a/MediaBrowser.Controller/Channels/IChannel.cs +++ b/MediaBrowser.Controller/Channels/IChannel.cs @@ -61,6 +61,11 @@ namespace MediaBrowser.Controller.Channels IEnumerable GetSupportedChannelImages(); } + public interface IChannelFactory + { + IEnumerable GetChannels(); + } + public class ChannelInfo { /// diff --git a/MediaBrowser.Controller/Channels/IChannelManager.cs b/MediaBrowser.Controller/Channels/IChannelManager.cs index b34e77415f..05f9afcf00 100644 --- a/MediaBrowser.Controller/Channels/IChannelManager.cs +++ b/MediaBrowser.Controller/Channels/IChannelManager.cs @@ -13,7 +13,8 @@ namespace MediaBrowser.Controller.Channels /// Adds the parts. /// /// The channels. - void AddParts(IEnumerable channels); + /// The factories. + void AddParts(IEnumerable channels, IEnumerable factories); /// /// Gets the channels. diff --git a/MediaBrowser.Dlna/Didl/DidlBuilder.cs b/MediaBrowser.Dlna/Didl/DidlBuilder.cs index b5129fdb49..7c627104b4 100644 --- a/MediaBrowser.Dlna/Didl/DidlBuilder.cs +++ b/MediaBrowser.Dlna/Didl/DidlBuilder.cs @@ -414,11 +414,11 @@ namespace MediaBrowser.Dlna.Didl { classType = "object.container.album.musicAlbum"; } - if (item is MusicArtist) + else if (item is MusicArtist) { classType = "object.container.person.musicArtist"; } - if (item is Series || item is Season || item is BoxSet || item is CollectionFolder) + else if (item is Series || item is Season || item is BoxSet) { classType = "object.container.album.videoAlbum"; } diff --git a/MediaBrowser.Model/Querying/NextUpQuery.cs b/MediaBrowser.Model/Querying/NextUpQuery.cs index cdce2e3073..913fae4d91 100644 --- a/MediaBrowser.Model/Querying/NextUpQuery.cs +++ b/MediaBrowser.Model/Querying/NextUpQuery.cs @@ -9,6 +9,12 @@ namespace MediaBrowser.Model.Querying /// The user id. public string UserId { get; set; } + /// + /// Gets or sets the parent identifier. + /// + /// The parent identifier. + public string ParentId { get; set; } + /// /// Gets or sets the series id. /// @@ -42,6 +48,12 @@ namespace MediaBrowser.Model.Querying /// The user id. public string UserId { get; set; } + /// + /// Gets or sets the parent identifier. + /// + /// The parent identifier. + public string ParentId { get; set; } + /// /// Skips over a given number of items within the results. Use for paging. /// diff --git a/MediaBrowser.Server.Implementations/Channels/ChannelManager.cs b/MediaBrowser.Server.Implementations/Channels/ChannelManager.cs index e028065c3d..dc3a04769b 100644 --- a/MediaBrowser.Server.Implementations/Channels/ChannelManager.cs +++ b/MediaBrowser.Server.Implementations/Channels/ChannelManager.cs @@ -23,6 +23,7 @@ namespace MediaBrowser.Server.Implementations.Channels public class ChannelManager : IChannelManager { private IChannel[] _channels; + private IChannelFactory[] _factories; private List _channelEntities = new List(); private readonly IUserManager _userManager; @@ -44,9 +45,29 @@ namespace MediaBrowser.Server.Implementations.Channels _userDataManager = userDataManager; } - public void AddParts(IEnumerable channels) + public void AddParts(IEnumerable channels, IEnumerable factories) { _channels = channels.ToArray(); + _factories = factories.ToArray(); + } + + 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) + .OrderBy(i => i.Name); } public Task> GetChannels(ChannelQuery query, CancellationToken cancellationToken) @@ -82,7 +103,7 @@ namespace MediaBrowser.Server.Implementations.Channels public async Task RefreshChannels(IProgress progress, CancellationToken cancellationToken) { - var allChannelsList = _channels.ToList(); + var allChannelsList = GetAllChannels().ToList(); var list = new List(); @@ -380,7 +401,7 @@ namespace MediaBrowser.Server.Implementations.Channels internal IChannel GetChannelProvider(Channel channel) { - return _channels.First(i => string.Equals(i.Name, channel.OriginalChannelName, StringComparison.OrdinalIgnoreCase)); + return GetAllChannels().First(i => string.Equals(i.Name, channel.OriginalChannelName, StringComparison.OrdinalIgnoreCase)); } private IEnumerable ApplyFilters(IEnumerable items, IEnumerable filters, User user) diff --git a/MediaBrowser.Server.Implementations/EntryPoints/Notifications/Notifier.cs b/MediaBrowser.Server.Implementations/EntryPoints/Notifications/Notifier.cs index 1e3f8b0b05..cc32217118 100644 --- a/MediaBrowser.Server.Implementations/EntryPoints/Notifications/Notifier.cs +++ b/MediaBrowser.Server.Implementations/EntryPoints/Notifications/Notifier.cs @@ -81,7 +81,7 @@ namespace MediaBrowser.Server.Implementations.EntryPoints.Notifications notification.Variables["Version"] = e.Argument.versionStr; notification.Variables["ReleaseNotes"] = e.Argument.description; - + await SendNotification(notification).ConfigureAwait(false); } @@ -164,7 +164,7 @@ namespace MediaBrowser.Server.Implementations.EntryPoints.Notifications var item = e.MediaInfo; - if (e.Item !=null && e.Item.Parent == null) + if (e.Item != null && e.Item.Parent == null) { // Don't report theme song or local trailer playback // TODO: This will also cause movie specials to not be reported @@ -185,7 +185,7 @@ namespace MediaBrowser.Server.Implementations.EntryPoints.Notifications await SendNotification(notification).ConfigureAwait(false); } - + private string GetPlaybackNotificationType(string mediaType) { if (string.Equals(mediaType, MediaType.Audio, StringComparison.OrdinalIgnoreCase)) @@ -218,7 +218,7 @@ namespace MediaBrowser.Server.Implementations.EntryPoints.Notifications }; notification.Variables["Name"] = item.Name; - + await SendNotification(notification).ConfigureAwait(false); } } @@ -260,7 +260,7 @@ namespace MediaBrowser.Server.Implementations.EntryPoints.Notifications async void _installationManager_PluginUninstalled(object sender, GenericEventArgs e) { var type = NotificationType.PluginUninstalled.ToString(); - + var plugin = e.Argument; var notification = new NotificationRequest @@ -270,7 +270,7 @@ namespace MediaBrowser.Server.Implementations.EntryPoints.Notifications notification.Variables["Name"] = plugin.Name; notification.Variables["Version"] = plugin.Version.ToString(); - + await SendNotification(notification).ConfigureAwait(false); } diff --git a/MediaBrowser.Server.Implementations/Localization/Server/server.json b/MediaBrowser.Server.Implementations/Localization/Server/server.json index 8e2fa18b99..0c99b3a573 100644 --- a/MediaBrowser.Server.Implementations/Localization/Server/server.json +++ b/MediaBrowser.Server.Implementations/Localization/Server/server.json @@ -624,5 +624,8 @@ "ButtonMute": "Mute", "HeaderLatestMedia": "Latest Media", "OptionNoSubtitles": "No Subtitles", - "OptionSpecialFeatures": "Special Features" + "OptionSpecialFeatures": "Special Features", + "HeaderCollections": "Collections", + "HeaderChannels": "Channels", + "HeaderMyLibrary": "My Library" } \ No newline at end of file diff --git a/MediaBrowser.ServerApplication/ApplicationHost.cs b/MediaBrowser.ServerApplication/ApplicationHost.cs index 0740feece7..555899f3ba 100644 --- a/MediaBrowser.ServerApplication/ApplicationHost.cs +++ b/MediaBrowser.ServerApplication/ApplicationHost.cs @@ -712,7 +712,7 @@ namespace MediaBrowser.ServerApplication SessionManager.AddParts(GetExports()); - ChannelManager.AddParts(GetExports()); + ChannelManager.AddParts(GetExports(), GetExports()); NotificationManager.AddParts(GetExports(), GetExports()); } diff --git a/MediaBrowser.WebDashboard/MediaBrowser.WebDashboard.csproj b/MediaBrowser.WebDashboard/MediaBrowser.WebDashboard.csproj index 03c77c2276..540e54f3b7 100644 --- a/MediaBrowser.WebDashboard/MediaBrowser.WebDashboard.csproj +++ b/MediaBrowser.WebDashboard/MediaBrowser.WebDashboard.csproj @@ -211,6 +211,30 @@ PreserveNewest + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + PreserveNewest