diff --git a/Emby.Dlna/Didl/DidlBuilder.cs b/Emby.Dlna/Didl/DidlBuilder.cs index 255f2c9882..b37bc30610 100644 --- a/Emby.Dlna/Didl/DidlBuilder.cs +++ b/Emby.Dlna/Didl/DidlBuilder.cs @@ -782,22 +782,26 @@ namespace Emby.Dlna.Didl private void AddPeople(BaseItem item, XmlWriter writer) { + if (!item.SupportsPeople) + { + return; + } + var types = new[] { PersonType.Director, PersonType.Writer, PersonType.Producer, 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) { @@ -805,13 +809,6 @@ namespace Emby.Dlna.Didl ?? PersonType.Actor; AddValue(writer, "upnp", type.ToLowerInvariant(), actor.Name, NS_UPNP); - - index++; - - if (index >= limit) - { - break; - } } } diff --git a/Emby.Dlna/PlayTo/Device.cs b/Emby.Dlna/PlayTo/Device.cs index 5ccf88be25..a06c863fd0 100644 --- a/Emby.Dlna/PlayTo/Device.cs +++ b/Emby.Dlna/PlayTo/Device.cs @@ -604,8 +604,7 @@ namespace Emby.Dlna.PlayTo Properties.BaseUrl, service, command.Name, - avCommands.BuildPost(command, - service.ServiceType), + avCommands.BuildPost(command, service.ServiceType), cancellationToken: cancellationToken).ConfigureAwait(false); if (result == null || result.Document == null) @@ -647,7 +646,8 @@ namespace Emby.Dlna.PlayTo Properties.BaseUrl, service, command.Name, - rendererCommands.BuildPost(command, service.ServiceType)).ConfigureAwait(false); + rendererCommands.BuildPost(command, service.ServiceType), + cancellationToken: cancellationToken).ConfigureAwait(false); if (result == null || result.Document == null) { diff --git a/Emby.Dlna/PlayTo/PlayToController.cs b/Emby.Dlna/PlayTo/PlayToController.cs index 9ee6986b43..43e9830540 100644 --- a/Emby.Dlna/PlayTo/PlayToController.cs +++ b/Emby.Dlna/PlayTo/PlayToController.cs @@ -96,7 +96,7 @@ namespace Emby.Dlna.PlayTo _device.OnDeviceUnavailable = OnDeviceUnavailable; _device.PlaybackStart += OnDevicePlaybackStart; _device.PlaybackProgress += OnDevicePlaybackProgress; - _device.PlaybackStopped += DevicePlaybackStopped; + _device.PlaybackStopped += OnDevicePlaybackStopped; _device.MediaChanged += OnDeviceMediaChanged; _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) { @@ -633,7 +633,7 @@ namespace Emby.Dlna.PlayTo _device.PlaybackStart -= OnDevicePlaybackStart; _device.PlaybackProgress -= OnDevicePlaybackProgress; - _device.PlaybackStopped -= DevicePlaybackStopped; + _device.PlaybackStopped -= OnDevicePlaybackStopped; _device.MediaChanged -= OnDeviceMediaChanged; _deviceDiscovery.DeviceLeft -= OnDeviceDiscoveryDeviceLeft; _device.OnDeviceUnavailable = null; diff --git a/Emby.Server.Implementations/Data/SqliteItemRepository.cs b/Emby.Server.Implementations/Data/SqliteItemRepository.cs index e3242f7b4f..e360b790c6 100644 --- a/Emby.Server.Implementations/Data/SqliteItemRepository.cs +++ b/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"; + if (query.Limit > 0) + { + commandText += "LIMIT " + query.Limit; + } + using (var connection = GetConnection(true)) { var list = new List(); @@ -5049,6 +5054,11 @@ where AncestorIdText not null and ItemValues.Value not null and ItemValues.Type commandText += " order by ListOrder"; + if (query.Limit > 0) + { + commandText += "LIMIT " + query.Limit; + } + using (var connection = GetConnection(true)) { var list = new List(); diff --git a/MediaBrowser.Controller/Entities/InternalPeopleQuery.cs b/MediaBrowser.Controller/Entities/InternalPeopleQuery.cs index 1613531b5c..41d8a4c83e 100644 --- a/MediaBrowser.Controller/Entities/InternalPeopleQuery.cs +++ b/MediaBrowser.Controller/Entities/InternalPeopleQuery.cs @@ -4,11 +4,18 @@ namespace MediaBrowser.Controller.Entities { public class InternalPeopleQuery { + public int Limit { get; set; } + public Guid ItemId { get; set; } + public string[] PersonTypes { get; set; } + public string[] ExcludePersonTypes { get; set; } + public int? MaxListOrder { get; set; } + public Guid AppearsInItemId { get; set; } + public string NameContains { get; set; } public InternalPeopleQuery()