From 575ca7683ce65ff476b5923526b077e04e41b94d Mon Sep 17 00:00:00 2001 From: Luke Date: Thu, 24 Dec 2015 02:00:23 -0500 Subject: [PATCH] fixes #1348 - [Feature Request] Option for single subtitle on DLNA config. --- MediaBrowser.Dlna/Didl/DidlBuilder.cs | 13 ++++++++++--- MediaBrowser.Model/Dlna/DeviceProfile.cs | 3 ++- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/MediaBrowser.Dlna/Didl/DidlBuilder.cs b/MediaBrowser.Dlna/Didl/DidlBuilder.cs index 571898733..40507db0c 100644 --- a/MediaBrowser.Dlna/Didl/DidlBuilder.cs +++ b/MediaBrowser.Dlna/Didl/DidlBuilder.cs @@ -175,19 +175,24 @@ namespace MediaBrowser.Dlna.Didl { if (subtitle.DeliveryMethod == SubtitleDeliveryMethod.External) { - AddSubtitleElement(container, subtitle); + var subtitleAdded = AddSubtitleElement(container, subtitle); + + if (subtitleAdded && _profile.EnableSingleSubtitleLimit) + { + break; + } } } } - private void AddSubtitleElement(XmlElement container, SubtitleStreamInfo info) + private bool AddSubtitleElement(XmlElement container, SubtitleStreamInfo info) { var subtitleProfile = _profile.SubtitleProfiles .FirstOrDefault(i => string.Equals(info.Format, i.Format, StringComparison.OrdinalIgnoreCase) && i.Method == SubtitleDeliveryMethod.External); if (subtitleProfile == null) { - return; + return false; } var subtitleMode = subtitleProfile.DidlMode; @@ -226,6 +231,8 @@ namespace MediaBrowser.Dlna.Didl container.AppendChild(res); } + + return true; } private void AddVideoResource(XmlElement container, IHasMediaSources video, string deviceId, Filter filter, string contentFeatures, StreamInfo streamInfo) diff --git a/MediaBrowser.Model/Dlna/DeviceProfile.cs b/MediaBrowser.Model/Dlna/DeviceProfile.cs index 6d4aa34a3..5554c0623 100644 --- a/MediaBrowser.Model/Dlna/DeviceProfile.cs +++ b/MediaBrowser.Model/Dlna/DeviceProfile.cs @@ -36,7 +36,8 @@ namespace MediaBrowser.Model.Dlna public string SerialNumber { get; set; } public bool EnableAlbumArtInDidl { get; set; } - public bool EnableSingleAlbumArtLimit { get; set; } + public bool EnableSingleAlbumArtLimit { get; set; } + public bool EnableSingleSubtitleLimit { get; set; } public string SupportedMediaTypes { get; set; }