Browse Source

Address comments

Bond_009 5 years ago
parent
commit
3161e85f76

+ 12 - 15
Emby.Dlna/Didl/DidlBuilder.cs

@@ -782,22 +782,26 @@ namespace Emby.Dlna.Didl
 
 
         private void AddPeople(BaseItem item, XmlWriter writer)
         private void AddPeople(BaseItem item, XmlWriter writer)
         {
         {
+            if (!item.SupportsPeople)
+            {
+                return;
+            }
+
             var types = new[]
             var types = new[]
             {
             {
                 PersonType.Director,
                 PersonType.Director,
                 PersonType.Writer,
                 PersonType.Writer,
                 PersonType.Producer,
                 PersonType.Producer,
                 PersonType.Composer,
                 PersonType.Composer,
-                "Creator"
+                "creator"
             };
             };
 
 
-            var people = _libraryManager.GetPeople(item);
-
-            var index = 0;
-
-            // Seeing some LG models locking up due content with large lists of people
-            // The actual issue might just be due to processing a more metadata than it can handle
-            var limit = 6;
+            var people = _libraryManager.GetPeople(
+                new InternalPeopleQuery
+                {
+                    ItemId = item.Id,
+                    Limit = 6
+                });
 
 
             foreach (var actor in people)
             foreach (var actor in people)
             {
             {
@@ -805,13 +809,6 @@ namespace Emby.Dlna.Didl
                     ?? PersonType.Actor;
                     ?? PersonType.Actor;
 
 
                 AddValue(writer, "upnp", type.ToLowerInvariant(), actor.Name, NS_UPNP);
                 AddValue(writer, "upnp", type.ToLowerInvariant(), actor.Name, NS_UPNP);
-
-                index++;
-
-                if (index >= limit)
-                {
-                    break;
-                }
             }
             }
         }
         }
 
 

+ 3 - 3
Emby.Dlna/PlayTo/Device.cs

@@ -604,8 +604,7 @@ namespace Emby.Dlna.PlayTo
                 Properties.BaseUrl,
                 Properties.BaseUrl,
                 service,
                 service,
                 command.Name,
                 command.Name,
-                avCommands.BuildPost(command,
-                service.ServiceType),
+                avCommands.BuildPost(command, service.ServiceType),
                 cancellationToken: cancellationToken).ConfigureAwait(false);
                 cancellationToken: cancellationToken).ConfigureAwait(false);
 
 
             if (result == null || result.Document == null)
             if (result == null || result.Document == null)
@@ -647,7 +646,8 @@ namespace Emby.Dlna.PlayTo
                 Properties.BaseUrl,
                 Properties.BaseUrl,
                 service,
                 service,
                 command.Name,
                 command.Name,
-                rendererCommands.BuildPost(command, service.ServiceType)).ConfigureAwait(false);
+                rendererCommands.BuildPost(command, service.ServiceType),
+                cancellationToken: cancellationToken).ConfigureAwait(false);
 
 
             if (result == null || result.Document == null)
             if (result == null || result.Document == null)
             {
             {

+ 3 - 3
Emby.Dlna/PlayTo/PlayToController.cs

@@ -96,7 +96,7 @@ namespace Emby.Dlna.PlayTo
             _device.OnDeviceUnavailable = OnDeviceUnavailable;
             _device.OnDeviceUnavailable = OnDeviceUnavailable;
             _device.PlaybackStart += OnDevicePlaybackStart;
             _device.PlaybackStart += OnDevicePlaybackStart;
             _device.PlaybackProgress += OnDevicePlaybackProgress;
             _device.PlaybackProgress += OnDevicePlaybackProgress;
-            _device.PlaybackStopped += DevicePlaybackStopped;
+            _device.PlaybackStopped += OnDevicePlaybackStopped;
             _device.MediaChanged += OnDeviceMediaChanged;
             _device.MediaChanged += OnDeviceMediaChanged;
 
 
             _device.Start();
             _device.Start();
@@ -162,7 +162,7 @@ namespace Emby.Dlna.PlayTo
             }
             }
         }
         }
 
 
-        private async void DevicePlaybackStopped(object sender, PlaybackStoppedEventArgs e)
+        private async void OnDevicePlaybackStopped(object sender, PlaybackStoppedEventArgs e)
         {
         {
             if (_disposed)
             if (_disposed)
             {
             {
@@ -633,7 +633,7 @@ namespace Emby.Dlna.PlayTo
 
 
             _device.PlaybackStart -= OnDevicePlaybackStart;
             _device.PlaybackStart -= OnDevicePlaybackStart;
             _device.PlaybackProgress -= OnDevicePlaybackProgress;
             _device.PlaybackProgress -= OnDevicePlaybackProgress;
-            _device.PlaybackStopped -= DevicePlaybackStopped;
+            _device.PlaybackStopped -= OnDevicePlaybackStopped;
             _device.MediaChanged -= OnDeviceMediaChanged;
             _device.MediaChanged -= OnDeviceMediaChanged;
             _deviceDiscovery.DeviceLeft -= OnDeviceDiscoveryDeviceLeft;
             _deviceDiscovery.DeviceLeft -= OnDeviceDiscoveryDeviceLeft;
             _device.OnDeviceUnavailable = null;
             _device.OnDeviceUnavailable = null;

+ 10 - 0
Emby.Server.Implementations/Data/SqliteItemRepository.cs

@@ -5011,6 +5011,11 @@ where AncestorIdText not null and ItemValues.Value not null and ItemValues.Type
 
 
             commandText += " order by ListOrder";
             commandText += " order by ListOrder";
 
 
+            if (query.Limit > 0)
+            {
+                commandText += "LIMIT " + query.Limit;
+            }
+
             using (var connection = GetConnection(true))
             using (var connection = GetConnection(true))
             {
             {
                 var list = new List<string>();
                 var list = new List<string>();
@@ -5049,6 +5054,11 @@ where AncestorIdText not null and ItemValues.Value not null and ItemValues.Type
 
 
             commandText += " order by ListOrder";
             commandText += " order by ListOrder";
 
 
+            if (query.Limit > 0)
+            {
+                commandText += "LIMIT " + query.Limit;
+            }
+
             using (var connection = GetConnection(true))
             using (var connection = GetConnection(true))
             {
             {
                 var list = new List<PersonInfo>();
                 var list = new List<PersonInfo>();

+ 7 - 0
MediaBrowser.Controller/Entities/InternalPeopleQuery.cs

@@ -4,11 +4,18 @@ namespace MediaBrowser.Controller.Entities
 {
 {
     public class InternalPeopleQuery
     public class InternalPeopleQuery
     {
     {
+        public int Limit { get; set; }
+
         public Guid ItemId { get; set; }
         public Guid ItemId { get; set; }
+
         public string[] PersonTypes { get; set; }
         public string[] PersonTypes { get; set; }
+
         public string[] ExcludePersonTypes { get; set; }
         public string[] ExcludePersonTypes { get; set; }
+
         public int? MaxListOrder { get; set; }
         public int? MaxListOrder { get; set; }
+
         public Guid AppearsInItemId { get; set; }
         public Guid AppearsInItemId { get; set; }
+
         public string NameContains { get; set; }
         public string NameContains { get; set; }
 
 
         public InternalPeopleQuery()
         public InternalPeopleQuery()