Address comments

This commit is contained in:
Bond_009 2020-04-03 17:30:01 +02:00
parent f6c9a44703
commit 3161e85f76
5 changed files with 35 additions and 21 deletions

View File

@ -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 people = _libraryManager.GetPeople(
new InternalPeopleQuery
var index = 0; {
ItemId = item.Id,
// Seeing some LG models locking up due content with large lists of people Limit = 6
// The actual issue might just be due to processing a more metadata than it can handle });
var 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;
}
} }
} }

View File

@ -604,8 +604,7 @@ namespace Emby.Dlna.PlayTo
Properties.BaseUrl, Properties.BaseUrl,
service, service,
command.Name, command.Name,
avCommands.BuildPost(command, avCommands.BuildPost(command, service.ServiceType),
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)
{ {

View File

@ -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;

View File

@ -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>();

View File

@ -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()