From 5bfcbd4e9e07880a55cd88be031b523832186d93 Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Wed, 31 May 2017 15:21:32 -0400 Subject: [PATCH] update dlna profiles --- Emby.Dlna/Profiles/DefaultProfile.cs | 12 ++++++++ Emby.Dlna/Profiles/Xml/Default.xml | 2 ++ Emby.Dlna/Profiles/Xml/Denon AVR.xml | 2 ++ Emby.Dlna/Profiles/Xml/MediaMonkey.xml | 2 ++ Emby.Dlna/Profiles/Xml/foobar2000.xml | 2 ++ .../HttpServer/HttpResultFactory.cs | 18 ++++++++++-- .../Playback/UniversalAudioService.cs | 29 +++++++++++++++++-- MediaBrowser.Api/StartupWizardService.cs | 1 + MediaBrowser.Controller/Entities/BaseItem.cs | 12 +++++++- .../LiveTv/LiveTvChannel.cs | 2 +- .../Net/IHttpResultFactory.cs | 2 ++ .../Configuration/ServerConfiguration.cs | 4 +-- 12 files changed, 78 insertions(+), 10 deletions(-) diff --git a/Emby.Dlna/Profiles/DefaultProfile.cs b/Emby.Dlna/Profiles/DefaultProfile.cs index 1413e89d2a..70d08f9a9c 100644 --- a/Emby.Dlna/Profiles/DefaultProfile.cs +++ b/Emby.Dlna/Profiles/DefaultProfile.cs @@ -135,6 +135,18 @@ namespace Emby.Dlna.Profiles { Format = "sub", Method = SubtitleDeliveryMethod.Embed + }, + + new SubtitleProfile + { + Format = "subrip", + Method = SubtitleDeliveryMethod.Embed + }, + + new SubtitleProfile + { + Format = "vtt", + Method = SubtitleDeliveryMethod.Embed } }; diff --git a/Emby.Dlna/Profiles/Xml/Default.xml b/Emby.Dlna/Profiles/Xml/Default.xml index 9c4e68d965..fe783e0059 100644 --- a/Emby.Dlna/Profiles/Xml/Default.xml +++ b/Emby.Dlna/Profiles/Xml/Default.xml @@ -55,5 +55,7 @@ + + \ No newline at end of file diff --git a/Emby.Dlna/Profiles/Xml/Denon AVR.xml b/Emby.Dlna/Profiles/Xml/Denon AVR.xml index 772e9a41c0..c1d0a67ea5 100644 --- a/Emby.Dlna/Profiles/Xml/Denon AVR.xml +++ b/Emby.Dlna/Profiles/Xml/Denon AVR.xml @@ -55,5 +55,7 @@ + + \ No newline at end of file diff --git a/Emby.Dlna/Profiles/Xml/MediaMonkey.xml b/Emby.Dlna/Profiles/Xml/MediaMonkey.xml index 325c2e8368..d51cae988d 100644 --- a/Emby.Dlna/Profiles/Xml/MediaMonkey.xml +++ b/Emby.Dlna/Profiles/Xml/MediaMonkey.xml @@ -61,5 +61,7 @@ + + \ No newline at end of file diff --git a/Emby.Dlna/Profiles/Xml/foobar2000.xml b/Emby.Dlna/Profiles/Xml/foobar2000.xml index febc12a8fa..b22a0ee160 100644 --- a/Emby.Dlna/Profiles/Xml/foobar2000.xml +++ b/Emby.Dlna/Profiles/Xml/foobar2000.xml @@ -61,5 +61,7 @@ + + \ No newline at end of file diff --git a/Emby.Server.Implementations/HttpServer/HttpResultFactory.cs b/Emby.Server.Implementations/HttpServer/HttpResultFactory.cs index 0af88595f9..6c37d5f7a4 100644 --- a/Emby.Server.Implementations/HttpServer/HttpResultFactory.cs +++ b/Emby.Server.Implementations/HttpServer/HttpResultFactory.cs @@ -58,6 +58,18 @@ namespace Emby.Server.Implementations.HttpServer return GetHttpResult(content, contentType, true, responseHeaders); } + public object GetRedirectResult(string url) + { + var responseHeaders = new Dictionary(); + responseHeaders["Location"] = url; + + var result = new HttpResult(new byte[] { }, "text/plain", HttpStatusCode.Redirect); + + AddResponseHeaders(result, responseHeaders); + + return result; + } + /// /// Gets the HTTP result. /// @@ -599,9 +611,9 @@ namespace Emby.Server.Implementations.HttpServer } } - private async Task GetCompressedResult(Stream stream, - string requestedCompressionType, - IDictionary responseHeaders, + private async Task GetCompressedResult(Stream stream, + string requestedCompressionType, + IDictionary responseHeaders, bool isHeadRequest, string contentType) { diff --git a/MediaBrowser.Api/Playback/UniversalAudioService.cs b/MediaBrowser.Api/Playback/UniversalAudioService.cs index e5ece3984d..fffec69489 100644 --- a/MediaBrowser.Api/Playback/UniversalAudioService.cs +++ b/MediaBrowser.Api/Playback/UniversalAudioService.cs @@ -1,7 +1,6 @@ using System; using System.Collections.Generic; using System.Globalization; -using System.IO; using System.Threading.Tasks; using MediaBrowser.Api.Playback.Hls; using MediaBrowser.Api.Playback.Progressive; @@ -42,6 +41,7 @@ namespace MediaBrowser.Api.Playback public string Container { get; set; } public int? MaxAudioChannels { get; set; } + public int? TranscodingAudioChannels { get; set; } public long? MaxStreamingBitrate { get; set; } @@ -51,6 +51,15 @@ namespace MediaBrowser.Api.Playback public string TranscodingContainer { get; set; } public string TranscodingProtocol { get; set; } public int? MaxAudioSampleRate { get; set; } + + public bool EnableRedirection { get; set; } + public bool EnableRemoteMedia { get; set; } + public bool BreakOnNonKeyFrames { get; set; } + + public BaseUniversalRequest() + { + EnableRedirection = true; + } } [Route("/Audio/{Id}/universal.{Container}", "GET", Summary = "Gets an audio stream")] @@ -133,7 +142,9 @@ namespace MediaBrowser.Api.Playback Context = EncodingContext.Streaming, Container = request.TranscodingContainer, AudioCodec = request.AudioCodec, - Protocol = request.TranscodingProtocol + Protocol = request.TranscodingProtocol, + BreakOnNonKeyFrames = request.BreakOnNonKeyFrames, + MaxAudioChannels = request.TranscodingAudioChannels.HasValue ? request.TranscodingAudioChannels.Value.ToString(CultureInfo.InvariantCulture) : null } }; @@ -205,6 +216,17 @@ namespace MediaBrowser.Api.Playback var mediaSource = playbackInfoResult.MediaSources[0]; + if (mediaSource.SupportsDirectPlay && mediaSource.Protocol == MediaProtocol.Http) + { + if (request.EnableRedirection) + { + if (mediaSource.IsRemote && request.EnableRemoteMedia) + { + return ResultFactory.GetRedirectResult(mediaSource.Path); + } + } + } + var isStatic = mediaSource.SupportsDirectStream; if (!isStatic && string.Equals(mediaSource.TranscodingSubProtocol, "hls", StringComparison.OrdinalIgnoreCase)) @@ -242,7 +264,8 @@ namespace MediaBrowser.Api.Playback StartTimeTicks = request.StartTimeTicks, Static = isStatic, SegmentContainer = request.TranscodingContainer, - AudioSampleRate = request.MaxAudioSampleRate + AudioSampleRate = request.MaxAudioSampleRate, + BreakOnNonKeyFrames = transcodingProfile.BreakOnNonKeyFrames }; if (isHeadRequest) diff --git a/MediaBrowser.Api/StartupWizardService.cs b/MediaBrowser.Api/StartupWizardService.cs index cd56b69bd0..2df6d225b9 100644 --- a/MediaBrowser.Api/StartupWizardService.cs +++ b/MediaBrowser.Api/StartupWizardService.cs @@ -100,6 +100,7 @@ namespace MediaBrowser.Api config.EnableSimpleArtistDetection = true; config.EnableNormalizedItemByNameIds = true; config.DisableLiveTvChannelUserDataName = true; + config.EnableSimpleSortNameHandling = true; } public void Post(UpdateStartupConfiguration request) diff --git a/MediaBrowser.Controller/Entities/BaseItem.cs b/MediaBrowser.Controller/Entities/BaseItem.cs index 3d46cc9aaf..346442f59a 100644 --- a/MediaBrowser.Controller/Entities/BaseItem.cs +++ b/MediaBrowser.Controller/Entities/BaseItem.cs @@ -655,7 +655,17 @@ namespace MediaBrowser.Controller.Entities private string CreateSortNameFromCustomValue(string value) { - return string.IsNullOrWhiteSpace(value) ? null : ModifySortChunks(value).ToLower(); + return string.IsNullOrWhiteSpace(value) ? null : NormalizeCustomSortName(value); + } + + protected virtual string NormalizeCustomSortName(string value) + { + if (ConfigurationManager.Configuration.EnableSimpleSortNameHandling) + { + return value.RemoveDiacritics().ToLower(); + } + + return ModifySortChunks(value).ToLower(); } public bool IsSortNameDefault(string value) diff --git a/MediaBrowser.Controller/LiveTv/LiveTvChannel.cs b/MediaBrowser.Controller/LiveTv/LiveTvChannel.cs index 8a10ae4178..34a9103f84 100644 --- a/MediaBrowser.Controller/LiveTv/LiveTvChannel.cs +++ b/MediaBrowser.Controller/LiveTv/LiveTvChannel.cs @@ -101,7 +101,7 @@ namespace MediaBrowser.Controller.LiveTv } } - return Number + "-" + (Name ?? string.Empty); + return (Number ?? string.Empty) + "-" + (Name ?? string.Empty); } [IgnoreDataMember] diff --git a/MediaBrowser.Controller/Net/IHttpResultFactory.cs b/MediaBrowser.Controller/Net/IHttpResultFactory.cs index 7b431f69ab..b885246919 100644 --- a/MediaBrowser.Controller/Net/IHttpResultFactory.cs +++ b/MediaBrowser.Controller/Net/IHttpResultFactory.cs @@ -22,6 +22,8 @@ namespace MediaBrowser.Controller.Net /// System.Object. object GetResult(object content, string contentType, IDictionary responseHeaders = null); + object GetRedirectResult(string url); + /// /// Gets the optimized result. /// diff --git a/MediaBrowser.Model/Configuration/ServerConfiguration.cs b/MediaBrowser.Model/Configuration/ServerConfiguration.cs index a4a921821d..e30364de96 100644 --- a/MediaBrowser.Model/Configuration/ServerConfiguration.cs +++ b/MediaBrowser.Model/Configuration/ServerConfiguration.cs @@ -17,6 +17,8 @@ namespace MediaBrowser.Model.Configuration /// true if [enable u pn p]; otherwise, false. public bool EnableUPnP { get; set; } + public bool EnableSimpleSortNameHandling { get; set; } + /// /// Gets or sets the public mapped port. /// @@ -77,8 +79,6 @@ namespace MediaBrowser.Model.Configuration public string MetadataPath { get; set; } public string MetadataNetworkPath { get; set; } - public string LastVersion { get; set; } - /// /// Gets or sets the display name of the season zero. ///