瀏覽代碼

fix channel query by category

Luke Pulverenti 11 年之前
父節點
當前提交
ca5989cb17

+ 6 - 0
MediaBrowser.Model/Dto/BaseItemDto.cs

@@ -133,6 +133,12 @@ namespace MediaBrowser.Model.Dto
         /// <value>The custom rating.</value>
         public string CustomRating { get; set; }
 
+        /// <summary>
+        /// Gets or sets the channel identifier.
+        /// </summary>
+        /// <value>The channel identifier.</value>
+        public string ChannelId { get; set; }
+        
         /// <summary>
         /// Gets or sets the overview.
         /// </summary>

+ 5 - 0
MediaBrowser.Server.Implementations/Channels/ChannelManager.cs

@@ -385,6 +385,11 @@ namespace MediaBrowser.Server.Implementations.Channels
 
         private async Task<BaseItem> GetChannelItemEntity(ChannelItemInfo info, string internalChannnelId, CancellationToken cancellationToken)
         {
+            if (string.IsNullOrEmpty(internalChannnelId))
+            {
+                throw new ArgumentNullException("internalChannnelId");
+            }
+
             BaseItem item;
             Guid id;
             var isNew = false;

+ 8 - 0
MediaBrowser.Server.Implementations/Dto/DtoService.cs

@@ -1,5 +1,6 @@
 using MediaBrowser.Common.Extensions;
 using MediaBrowser.Common.IO;
+using MediaBrowser.Controller.Channels;
 using MediaBrowser.Controller.Configuration;
 using MediaBrowser.Controller.Drawing;
 using MediaBrowser.Controller.Dto;
@@ -1140,6 +1141,13 @@ namespace MediaBrowser.Server.Implementations.Dto
             {
                 dto.MediaSources = GetMediaSources(tvChannel);
             }
+
+            var channelItem = item as IChannelItem;
+
+            if (channelItem != null)
+            {
+                dto.ChannelId = channelItem.ChannelId;
+            }
         }
 
         public List<MediaSourceInfo> GetMediaSources(BaseItem item)

+ 9 - 1
MediaBrowser.Server.Implementations/Session/WebSocketController.cs

@@ -14,7 +14,7 @@ using System.Threading.Tasks;
 
 namespace MediaBrowser.Server.Implementations.Session
 {
-    public class WebSocketController : ISessionController
+    public class WebSocketController : ISessionController, IDisposable
     {
         public SessionInfo Session { get; private set; }
         public IReadOnlyList<IWebSocketConnection> Sockets { get; private set; }
@@ -244,5 +244,13 @@ namespace MediaBrowser.Server.Implementations.Session
 
             return Task.WhenAll(tasks);
         }
+
+        public void Dispose()
+        {
+            foreach (var socket in Sockets.ToList())
+            {
+                socket.Closed -= connection_Closed;
+            }
+        }
     }
 }