Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix some warnings #2741

Merged
merged 13 commits into from Apr 3, 2020
27 changes: 12 additions & 15 deletions Emby.Dlna/Didl/DidlBuilder.cs
Expand Up @@ -782,36 +782,33 @@ private void WriteObjectClass(XmlWriter writer, BaseItem item, StubType? stubTyp

private void AddPeople(BaseItem item, XmlWriter writer)
mark-monteiro marked this conversation as resolved.
Show resolved Hide resolved
{
if (!item.SupportsPeople)
{
return;
}

var types = new[]
{
PersonType.Director,
PersonType.Writer,
PersonType.Producer,
PersonType.Composer,
"Creator"
"creator"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder why it's not a PersonType.Creator?..

Copy link
Member Author

@Bond-009 Bond-009 Apr 3, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Doesn't exist

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cannot we create one?

};

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
Bond-009 marked this conversation as resolved.
Show resolved Hide resolved
});

foreach (var actor in people)
JustAMan marked this conversation as resolved.
Show resolved Hide resolved
{
var type = types.FirstOrDefault(i => string.Equals(i, actor.Type, StringComparison.OrdinalIgnoreCase) || string.Equals(i, actor.Role, StringComparison.OrdinalIgnoreCase))
?? PersonType.Actor;

AddValue(writer, "upnp", type.ToLowerInvariant(), actor.Name, NS_UPNP);

index++;

if (index >= limit)
{
break;
}
}
}

Expand Down
6 changes: 3 additions & 3 deletions Emby.Dlna/PlayTo/Device.cs
Expand Up @@ -604,8 +604,7 @@ private async Task GetMute(CancellationToken cancellationToken)
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)
Expand Down Expand Up @@ -647,7 +646,8 @@ private async Task<uBaseObject> GetMediaInfo(TransportCommands avCommands, Cance
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)
{
Expand Down
6 changes: 3 additions & 3 deletions Emby.Dlna/PlayTo/PlayToController.cs
Expand Up @@ -96,7 +96,7 @@ public void Init(Device device)
_device.OnDeviceUnavailable = OnDeviceUnavailable;
_device.PlaybackStart += OnDevicePlaybackStart;
_device.PlaybackProgress += OnDevicePlaybackProgress;
_device.PlaybackStopped += DevicePlaybackStopped;
_device.PlaybackStopped += OnDevicePlaybackStopped;
_device.MediaChanged += OnDeviceMediaChanged;

_device.Start();
Expand Down Expand Up @@ -162,7 +162,7 @@ private async void OnDeviceMediaChanged(object sender, MediaChangedEventArgs e)
}
}

private async void DevicePlaybackStopped(object sender, PlaybackStoppedEventArgs e)
private async void OnDevicePlaybackStopped(object sender, PlaybackStoppedEventArgs e)
{
if (_disposed)
{
Expand Down Expand Up @@ -633,7 +633,7 @@ protected virtual void Dispose(bool disposing)

_device.PlaybackStart -= OnDevicePlaybackStart;
_device.PlaybackProgress -= OnDevicePlaybackProgress;
_device.PlaybackStopped -= DevicePlaybackStopped;
_device.PlaybackStopped -= OnDevicePlaybackStopped;
_device.MediaChanged -= OnDeviceMediaChanged;
_deviceDiscovery.DeviceLeft -= OnDeviceDiscoveryDeviceLeft;
_device.OnDeviceUnavailable = null;
Expand Down
10 changes: 10 additions & 0 deletions Emby.Server.Implementations/Data/SqliteItemRepository.cs
Expand Up @@ -5011,6 +5011,11 @@ public List<string> GetPeopleNames(InternalPeopleQuery query)

commandText += " order by ListOrder";

if (query.Limit > 0)
{
commandText += "LIMIT " + query.Limit;
Bond-009 marked this conversation as resolved.
Show resolved Hide resolved
}

using (var connection = GetConnection(true))
{
var list = new List<string>();
Expand Down Expand Up @@ -5049,6 +5054,11 @@ public List<PersonInfo> GetPeople(InternalPeopleQuery query)

commandText += " order by ListOrder";

if (query.Limit > 0)
{
commandText += "LIMIT " + query.Limit;
}

using (var connection = GetConnection(true))
{
var list = new List<PersonInfo>();
Expand Down
7 changes: 7 additions & 0 deletions MediaBrowser.Controller/Entities/InternalPeopleQuery.cs
Expand Up @@ -4,11 +4,18 @@ namespace MediaBrowser.Controller.Entities
{
public class InternalPeopleQuery
{
public int Limit { get; set; }
mark-monteiro marked this conversation as resolved.
Show resolved Hide resolved

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()
Expand Down