limit number of people in dlna responses

This commit is contained in:
Luke Pulverenti 2016-10-18 14:23:41 -04:00
parent 5ad04bbb77
commit 2f17d160bc
8 changed files with 71 additions and 10 deletions

View File

@ -19,6 +19,7 @@ using System.Threading.Tasks;
using CommonIO; using CommonIO;
using MediaBrowser.Api.Playback.Progressive; using MediaBrowser.Api.Playback.Progressive;
using MediaBrowser.Controller.Configuration; using MediaBrowser.Controller.Configuration;
using MediaBrowser.Controller.Entities.TV;
using MediaBrowser.Server.Implementations.LiveTv.EmbyTV; using MediaBrowser.Server.Implementations.LiveTv.EmbyTV;
namespace MediaBrowser.Api.LiveTv namespace MediaBrowser.Api.LiveTv
@ -390,6 +391,7 @@ namespace MediaBrowser.Api.LiveTv
public bool? EnableUserData { get; set; } public bool? EnableUserData { get; set; }
public string SeriesTimerId { get; set; } public string SeriesTimerId { get; set; }
public string LibrarySeriesId { get; set; }
/// <summary> /// <summary>
/// Fields to return within the items, in addition to basic information /// Fields to return within the items, in addition to basic information
@ -990,6 +992,17 @@ namespace MediaBrowser.Api.LiveTv
query.SeriesTimerId = request.SeriesTimerId; query.SeriesTimerId = request.SeriesTimerId;
query.Genres = (request.Genres ?? String.Empty).Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries); query.Genres = (request.Genres ?? String.Empty).Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
if (!string.IsNullOrWhiteSpace(request.LibrarySeriesId))
{
query.IsSeries = true;
var series = _libraryManager.GetItemById(request.LibrarySeriesId) as Series;
if (series != null)
{
query.Name = series.Name;
}
}
var result = await _liveTvManager.GetPrograms(query, GetDtoOptions(request), CancellationToken.None).ConfigureAwait(false); var result = await _liveTvManager.GetPrograms(query, GetDtoOptions(request), CancellationToken.None).ConfigureAwait(false);
return ToOptimizedResult(result); return ToOptimizedResult(result);

View File

@ -696,16 +696,36 @@ namespace MediaBrowser.Dlna.Didl
private void AddPeople(BaseItem item, XmlElement element) private void AddPeople(BaseItem item, XmlElement element)
{ {
var types = new[] { PersonType.Director, PersonType.Writer, PersonType.Producer, PersonType.Composer, "Creator" }; var types = new[]
{
PersonType.Director,
PersonType.Writer,
PersonType.Producer,
PersonType.Composer,
"Creator"
};
var people = _libraryManager.GetPeople(item); 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 = 10;
foreach (var actor in people) foreach (var actor in people)
{ {
var type = types.FirstOrDefault(i => string.Equals(i, actor.Type, StringComparison.OrdinalIgnoreCase) || string.Equals(i, actor.Role, StringComparison.OrdinalIgnoreCase)) var type = types.FirstOrDefault(i => string.Equals(i, actor.Type, StringComparison.OrdinalIgnoreCase) || string.Equals(i, actor.Role, StringComparison.OrdinalIgnoreCase))
?? PersonType.Actor; ?? PersonType.Actor;
AddValue(element, "upnp", type.ToLower(), actor.Name, NS_UPNP); AddValue(element, "upnp", type.ToLower(), actor.Name, NS_UPNP);
index++;
if (index >= limit)
{
break;
}
} }
} }

View File

@ -16,6 +16,7 @@ namespace MediaBrowser.Model.LiveTv
public string RecordingEncodingFormat { get; set; } public string RecordingEncodingFormat { get; set; }
public bool EnableRecordingSubfolders { get; set; } public bool EnableRecordingSubfolders { get; set; }
public bool EnableOriginalAudioWithEncodedRecordings { get; set; } public bool EnableOriginalAudioWithEncodedRecordings { get; set; }
public bool EnableOriginalVideoWithEncodedRecordings { get; set; }
public List<TunerHostInfo> TunerHosts { get; set; } public List<TunerHostInfo> TunerHosts { get; set; }
public List<ListingsProviderInfo> ListingProviders { get; set; } public List<ListingsProviderInfo> ListingProviders { get; set; }

View File

@ -42,6 +42,7 @@ namespace MediaBrowser.Model.LiveTv
/// <value>The user identifier.</value> /// <value>The user identifier.</value>
public string UserId { get; set; } public string UserId { get; set; }
public string SeriesTimerId { get; set; } public string SeriesTimerId { get; set; }
public string Name { get; set; }
/// <summary> /// <summary>
/// The earliest date for which a program starts to return /// The earliest date for which a program starts to return

View File

@ -2840,7 +2840,11 @@ namespace MediaBrowser.Server.Implementations.Library
{ {
if (Environment.OSVersion.Platform == PlatformID.Win32NT) if (Environment.OSVersion.Platform == PlatformID.Win32NT)
{ {
return Directory.Exists(path); // We can't validate protocol-based paths, so just allow them
if (path.IndexOf("://", StringComparison.OrdinalIgnoreCase) == -1)
{
return Directory.Exists(path);
}
} }
// Without native support for unc, we cannot validate this when running under mono // Without native support for unc, we cannot validate this when running under mono

View File

@ -52,7 +52,7 @@ namespace MediaBrowser.Server.Implementations.LiveTv.EmbyTV
{ {
var format = _liveTvOptions.RecordingEncodingFormat; var format = _liveTvOptions.RecordingEncodingFormat;
if (string.Equals(format, "mkv", StringComparison.OrdinalIgnoreCase)) if (string.Equals(format, "mkv", StringComparison.OrdinalIgnoreCase) || _liveTvOptions.EnableOriginalVideoWithEncodedRecordings)
{ {
return "mkv"; return "mkv";
} }
@ -204,6 +204,11 @@ namespace MediaBrowser.Server.Implementations.LiveTv.EmbyTV
private bool EncodeVideo(MediaSourceInfo mediaSource) private bool EncodeVideo(MediaSourceInfo mediaSource)
{ {
if (_liveTvOptions.EnableOriginalAudioWithEncodedRecordings)
{
return false;
}
var mediaStreams = mediaSource.MediaStreams ?? new List<MediaStream>(); var mediaStreams = mediaSource.MediaStreams ?? new List<MediaStream>();
return !mediaStreams.Any(i => i.Type == MediaStreamType.Video && string.Equals(i.Codec, "h264", StringComparison.OrdinalIgnoreCase) && !i.IsInterlaced); return !mediaStreams.Any(i => i.Type == MediaStreamType.Video && string.Equals(i.Codec, "h264", StringComparison.OrdinalIgnoreCase) && !i.IsInterlaced);
} }

View File

@ -877,6 +877,7 @@ namespace MediaBrowser.Server.Implementations.LiveTv
SortOrder = query.SortOrder ?? SortOrder.Ascending, SortOrder = query.SortOrder ?? SortOrder.Ascending,
EnableTotalRecordCount = query.EnableTotalRecordCount, EnableTotalRecordCount = query.EnableTotalRecordCount,
TopParentIds = new[] { topFolder.Id.ToString("N") }, TopParentIds = new[] { topFolder.Id.ToString("N") },
Name = query.Name,
DtoOptions = options DtoOptions = options
}; };

View File

@ -111,15 +111,31 @@ namespace MediaBrowser.Server.Implementations.LiveTv.TunerHosts
channel.Number = "0"; channel.Number = "0";
} }
channel.ImageUrl = FindProperty("tvg-logo", extInf, null); channel.ImageUrl = FindProperty("tvg-logo", extInf);
channel.Number = FindProperty("channel-id", extInf, channel.Number);
channel.Number = FindProperty("tvg-id", extInf, channel.Number); var name = FindProperty("tvg-name", extInf);
channel.Name = FindProperty("tvg-id", extInf, channel.Name); if (string.IsNullOrWhiteSpace(name))
channel.Name = FindProperty("tvg-name", extInf, channel.Name); {
name = FindProperty("tvg-id", extInf);
}
channel.Name = name;
var numberString = FindProperty("tvg-id", extInf);
if (string.IsNullOrWhiteSpace(numberString))
{
numberString = FindProperty("channel-id", extInf);
}
if (!string.IsNullOrWhiteSpace(numberString))
{
channel.Number = numberString;
}
return channel; return channel;
} }
private string FindProperty(string property, string properties, string defaultResult = "") private string FindProperty(string property, string properties)
{ {
var reg = new Regex(@"([a-z0-9\-_]+)=\""([^""]+)\""", RegexOptions.IgnoreCase); var reg = new Regex(@"([a-z0-9\-_]+)=\""([^""]+)\""", RegexOptions.IgnoreCase);
var matches = reg.Matches(properties); var matches = reg.Matches(properties);
@ -130,7 +146,7 @@ namespace MediaBrowser.Server.Implementations.LiveTv.TunerHosts
return match.Groups[2].Value; return match.Groups[2].Value;
} }
} }
return defaultResult; return null;
} }
} }