diff options
| author | Luke <luke.pulverenti@gmail.com> | 2017-02-06 01:08:55 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2017-02-06 01:08:55 -0500 |
| commit | 2ceaa50ea737e88aca74c4af16a5c969e07d5f5a (patch) | |
| tree | f74ffd55b84f50b36f7f99b75dc10c5c27bc5b91 /MediaBrowser.Model | |
| parent | 84d2a5303b2eee311628876851335b7b926aa2ea (diff) | |
| parent | 6f1a300bdef907415160728670726735067efc7a (diff) | |
Merge pull request #2445 from MediaBrowser/beta
Beta
Diffstat (limited to 'MediaBrowser.Model')
| -rw-r--r-- | MediaBrowser.Model/Configuration/PathSubstitution.cs | 8 | ||||
| -rw-r--r-- | MediaBrowser.Model/Configuration/ServerConfiguration.cs | 8 | ||||
| -rw-r--r-- | MediaBrowser.Model/Dlna/ITranscoderSupport.cs | 5 | ||||
| -rw-r--r-- | MediaBrowser.Model/Dlna/StreamBuilder.cs | 64 | ||||
| -rw-r--r-- | MediaBrowser.Model/Dlna/StreamInfo.cs | 10 | ||||
| -rw-r--r-- | MediaBrowser.Model/Dto/BaseItemDto.cs | 6 | ||||
| -rw-r--r-- | MediaBrowser.Model/Entities/MediaStream.cs | 12 | ||||
| -rw-r--r-- | MediaBrowser.Model/LiveTv/LiveTvOptions.cs | 12 | ||||
| -rw-r--r-- | MediaBrowser.Model/MediaBrowser.Model.csproj | 1 | ||||
| -rw-r--r-- | MediaBrowser.Model/MediaInfo/MediaInfo.cs | 5 | ||||
| -rw-r--r-- | MediaBrowser.Model/Net/IUdpSocket.cs | 3 | ||||
| -rw-r--r-- | MediaBrowser.Model/Querying/ItemFields.cs | 5 | ||||
| -rw-r--r-- | MediaBrowser.Model/Session/PlaybackStopInfo.cs | 2 |
13 files changed, 85 insertions, 56 deletions
diff --git a/MediaBrowser.Model/Configuration/PathSubstitution.cs b/MediaBrowser.Model/Configuration/PathSubstitution.cs deleted file mode 100644 index 576dd2d5a..000000000 --- a/MediaBrowser.Model/Configuration/PathSubstitution.cs +++ /dev/null @@ -1,8 +0,0 @@ -namespace MediaBrowser.Model.Configuration -{ - public class PathSubstitution - { - public string From { get; set; } - public string To { get; set; } - } -}
\ No newline at end of file diff --git a/MediaBrowser.Model/Configuration/ServerConfiguration.cs b/MediaBrowser.Model/Configuration/ServerConfiguration.cs index bd0a53cc0..f9df776df 100644 --- a/MediaBrowser.Model/Configuration/ServerConfiguration.cs +++ b/MediaBrowser.Model/Configuration/ServerConfiguration.cs @@ -47,6 +47,7 @@ namespace MediaBrowser.Model.Configuration /// <value><c>true</c> if [use HTTPS]; otherwise, <c>false</c>.</value> public bool EnableHttps { get; set; } public bool EnableSeriesPresentationUniqueKey { get; set; } + public bool EnableLocalizedGuids { get; set; } /// <summary> /// Gets or sets the value pointing to the file system where the ssl certiifcate is located.. @@ -163,8 +164,6 @@ namespace MediaBrowser.Model.Configuration public bool SkipDeserializationForPrograms { get; set; } public bool SkipDeserializationForAudio { get; set; } - public PathSubstitution[] PathSubstitutions { get; set; } - public string ServerName { get; set; } public string WanDdns { get; set; } @@ -182,7 +181,6 @@ namespace MediaBrowser.Model.Configuration public bool EnableAnonymousUsageReporting { get; set; } public bool EnableStandaloneMusicKeys { get; set; } - public bool EnableLocalizedGuids { get; set; } public bool EnableFolderView { get; set; } public bool EnableGroupingIntoCollections { get; set; } public bool DisplaySpecialsWithinSeasons { get; set; } @@ -192,7 +190,6 @@ namespace MediaBrowser.Model.Configuration public string[] Migrations { get; set; } public bool EnableChannelView { get; set; } public bool EnableExternalContentInSuggestions { get; set; } - public bool EnableSimpleArtistDetection { get; set; } public int ImageExtractionTimeoutMs { get; set; } /// <summary> @@ -204,8 +201,8 @@ namespace MediaBrowser.Model.Configuration CodecsUsed = new string[] { }; Migrations = new string[] { }; ImageExtractionTimeoutMs = 0; - EnableLocalizedGuids = true; + DisplaySpecialsWithinSeasons = true; EnableExternalContentInSuggestions = true; @@ -231,7 +228,6 @@ namespace MediaBrowser.Model.Configuration LibraryMonitorDelay = 60; - PathSubstitutions = new PathSubstitution[] { }; ContentTypes = new NameValuePair[] { }; PreferredMetadataLanguage = "en"; diff --git a/MediaBrowser.Model/Dlna/ITranscoderSupport.cs b/MediaBrowser.Model/Dlna/ITranscoderSupport.cs index 0dac23403..fd615733d 100644 --- a/MediaBrowser.Model/Dlna/ITranscoderSupport.cs +++ b/MediaBrowser.Model/Dlna/ITranscoderSupport.cs @@ -3,6 +3,7 @@ public interface ITranscoderSupport { bool CanEncodeToAudioCodec(string codec); + bool CanEncodeToSubtitleCodec(string codec); } public class FullTranscoderSupport : ITranscoderSupport @@ -11,5 +12,9 @@ { return true; } + public bool CanEncodeToSubtitleCodec(string codec) + { + return true; + } } } diff --git a/MediaBrowser.Model/Dlna/StreamBuilder.cs b/MediaBrowser.Model/Dlna/StreamBuilder.cs index 262964404..129b49cf6 100644 --- a/MediaBrowser.Model/Dlna/StreamBuilder.cs +++ b/MediaBrowser.Model/Dlna/StreamBuilder.cs @@ -435,7 +435,7 @@ namespace MediaBrowser.Model.Dlna if (subtitleStream != null) { - SubtitleProfile subtitleProfile = GetSubtitleProfile(subtitleStream, options.Profile.SubtitleProfiles, directPlay.Value); + SubtitleProfile subtitleProfile = GetSubtitleProfile(subtitleStream, options.Profile.SubtitleProfiles, directPlay.Value, null, null); playlistItem.SubtitleDeliveryMethod = subtitleProfile.Method; playlistItem.SubtitleFormat = subtitleProfile.Format; @@ -465,10 +465,11 @@ namespace MediaBrowser.Model.Dlna if (subtitleStream != null) { - SubtitleProfile subtitleProfile = GetSubtitleProfile(subtitleStream, options.Profile.SubtitleProfiles, PlayMethod.Transcode); + SubtitleProfile subtitleProfile = GetSubtitleProfile(subtitleStream, options.Profile.SubtitleProfiles, PlayMethod.Transcode, transcodingProfile.Protocol, transcodingProfile.Container); playlistItem.SubtitleDeliveryMethod = subtitleProfile.Method; playlistItem.SubtitleFormat = subtitleProfile.Format; + playlistItem.SubtitleCodecs = new[] { subtitleProfile.Format }; } playlistItem.PlayMethod = PlayMethod.Transcode; @@ -874,7 +875,7 @@ namespace MediaBrowser.Model.Dlna { if (subtitleStream != null) { - SubtitleProfile subtitleProfile = GetSubtitleProfile(subtitleStream, options.Profile.SubtitleProfiles, playMethod); + SubtitleProfile subtitleProfile = GetSubtitleProfile(subtitleStream, options.Profile.SubtitleProfiles, playMethod, null, null); if (subtitleProfile.Method != SubtitleDeliveryMethod.External && subtitleProfile.Method != SubtitleDeliveryMethod.Embed) { @@ -886,11 +887,11 @@ namespace MediaBrowser.Model.Dlna return IsAudioEligibleForDirectPlay(item, maxBitrate); } - public static SubtitleProfile GetSubtitleProfile(MediaStream subtitleStream, SubtitleProfile[] subtitleProfiles, PlayMethod playMethod) + public static SubtitleProfile GetSubtitleProfile(MediaStream subtitleStream, SubtitleProfile[] subtitleProfiles, PlayMethod playMethod, string transcodingSubProtocol, string transcodingContainer) { - if (playMethod != PlayMethod.Transcode && !subtitleStream.IsExternal) + if (!subtitleStream.IsExternal && (playMethod != PlayMethod.Transcode || !string.Equals(transcodingSubProtocol, "hls", StringComparison.OrdinalIgnoreCase))) { - // Look for supported embedded subs + // Look for supported embedded subs of the same format foreach (SubtitleProfile profile in subtitleProfiles) { if (!profile.SupportsLanguage(subtitleStream.Language)) @@ -903,11 +904,40 @@ namespace MediaBrowser.Model.Dlna continue; } + if (playMethod == PlayMethod.Transcode && !IsSubtitleEmbedSupported(subtitleStream, profile, transcodingSubProtocol, transcodingContainer)) + { + continue; + } + if (subtitleStream.IsTextSubtitleStream == MediaStream.IsTextFormat(profile.Format) && StringHelper.EqualsIgnoreCase(profile.Format, subtitleStream.Codec)) { return profile; } } + + // Look for supported embedded subs of a convertible format + foreach (SubtitleProfile profile in subtitleProfiles) + { + if (!profile.SupportsLanguage(subtitleStream.Language)) + { + continue; + } + + if (profile.Method != SubtitleDeliveryMethod.Embed) + { + continue; + } + + if (playMethod == PlayMethod.Transcode && !IsSubtitleEmbedSupported(subtitleStream, profile, transcodingSubProtocol, transcodingContainer)) + { + continue; + } + + if (subtitleStream.IsTextSubtitleStream && subtitleStream.SupportsSubtitleConversionTo(profile.Format)) + { + return profile; + } + } } // Look for an external or hls profile that matches the stream type (text/graphical) and doesn't require conversion @@ -918,6 +948,28 @@ namespace MediaBrowser.Model.Dlna }; } + private static bool IsSubtitleEmbedSupported(MediaStream subtitleStream, SubtitleProfile subtitleProfile, string transcodingSubProtocol, string transcodingContainer) + { + if (string.Equals(transcodingContainer, "ts", StringComparison.OrdinalIgnoreCase)) + { + return false; + } + if (string.Equals(transcodingContainer, "mpegts", StringComparison.OrdinalIgnoreCase)) + { + return false; + } + if (string.Equals(transcodingContainer, "mp4", StringComparison.OrdinalIgnoreCase)) + { + return false; + } + if (string.Equals(transcodingContainer, "mkv", StringComparison.OrdinalIgnoreCase)) + { + return true; + } + + return false; + } + private static SubtitleProfile GetExternalSubtitleProfile(MediaStream subtitleStream, SubtitleProfile[] subtitleProfiles, PlayMethod playMethod, bool allowConversion) { foreach (SubtitleProfile profile in subtitleProfiles) diff --git a/MediaBrowser.Model/Dlna/StreamInfo.cs b/MediaBrowser.Model/Dlna/StreamInfo.cs index 5b8d40dfb..a85e6085b 100644 --- a/MediaBrowser.Model/Dlna/StreamInfo.cs +++ b/MediaBrowser.Model/Dlna/StreamInfo.cs @@ -18,6 +18,7 @@ namespace MediaBrowser.Model.Dlna public StreamInfo() { AudioCodecs = new string[] { }; + SubtitleCodecs = new string[] { }; } public string ItemId { get; set; } @@ -74,6 +75,7 @@ namespace MediaBrowser.Model.Dlna public MediaSourceInfo MediaSource { get; set; } + public string[] SubtitleCodecs { get; set; } public SubtitleDeliveryMethod SubtitleDeliveryMethod { get; set; } public string SubtitleFormat { get; set; } @@ -268,6 +270,12 @@ namespace MediaBrowser.Model.Dlna list.Add(new NameValuePair("Tag", item.MediaSource.ETag ?? string.Empty)); list.Add(new NameValuePair("RequireAvc", item.RequireAvc.ToString().ToLower())); + string subtitleCodecs = item.SubtitleCodecs.Length == 0 ? + string.Empty : + string.Join(",", item.SubtitleCodecs); + + list.Add(new NameValuePair("SubtitleCodec", item.SubtitleStreamIndex.HasValue && item.SubtitleDeliveryMethod == SubtitleDeliveryMethod.Embed ? subtitleCodecs : string.Empty)); + return list; } @@ -354,7 +362,7 @@ namespace MediaBrowser.Model.Dlna private SubtitleStreamInfo GetSubtitleStreamInfo(MediaStream stream, string baseUrl, string accessToken, long startPositionTicks, SubtitleProfile[] subtitleProfiles) { - SubtitleProfile subtitleProfile = StreamBuilder.GetSubtitleProfile(stream, subtitleProfiles, PlayMethod); + SubtitleProfile subtitleProfile = StreamBuilder.GetSubtitleProfile(stream, subtitleProfiles, PlayMethod, SubProtocol, Container); SubtitleStreamInfo info = new SubtitleStreamInfo { IsForced = stream.IsForced, diff --git a/MediaBrowser.Model/Dto/BaseItemDto.cs b/MediaBrowser.Model/Dto/BaseItemDto.cs index 864123bb9..c69bbb581 100644 --- a/MediaBrowser.Model/Dto/BaseItemDto.cs +++ b/MediaBrowser.Model/Dto/BaseItemDto.cs @@ -212,12 +212,6 @@ namespace MediaBrowser.Model.Dto public string Overview { get; set; } /// <summary> - /// Gets or sets the short overview. - /// </summary> - /// <value>The short overview.</value> - public string ShortOverview { get; set; } - - /// <summary> /// Gets or sets the taglines. /// </summary> /// <value>The taglines.</value> diff --git a/MediaBrowser.Model/Entities/MediaStream.cs b/MediaBrowser.Model/Entities/MediaStream.cs index 0eb9e2730..3cd3e7dde 100644 --- a/MediaBrowser.Model/Entities/MediaStream.cs +++ b/MediaBrowser.Model/Entities/MediaStream.cs @@ -311,29 +311,31 @@ namespace MediaBrowser.Model.Entities !StringHelper.EqualsIgnoreCase(codec, "dvb_subtitle"); } - public bool SupportsSubtitleConversionTo(string codec) + public bool SupportsSubtitleConversionTo(string toCodec) { if (!IsTextSubtitleStream) { return false; } + var fromCodec = Codec; + // Can't convert from this - if (StringHelper.EqualsIgnoreCase(Codec, "ass")) + if (StringHelper.EqualsIgnoreCase(fromCodec, "ass")) { return false; } - if (StringHelper.EqualsIgnoreCase(Codec, "ssa")) + if (StringHelper.EqualsIgnoreCase(fromCodec, "ssa")) { return false; } // Can't convert to this - if (StringHelper.EqualsIgnoreCase(codec, "ass")) + if (StringHelper.EqualsIgnoreCase(toCodec, "ass")) { return false; } - if (StringHelper.EqualsIgnoreCase(codec, "ssa")) + if (StringHelper.EqualsIgnoreCase(toCodec, "ssa")) { return false; } diff --git a/MediaBrowser.Model/LiveTv/LiveTvOptions.cs b/MediaBrowser.Model/LiveTv/LiveTvOptions.cs index 3c2ace896..5cf52e0ef 100644 --- a/MediaBrowser.Model/LiveTv/LiveTvOptions.cs +++ b/MediaBrowser.Model/LiveTv/LiveTvOptions.cs @@ -96,17 +96,5 @@ namespace MediaBrowser.Model.LiveTv EnableAllTuners = true; ChannelMappings = new NameValuePair[] {}; } - - public string GetMappedChannel(string channelNumber) - { - foreach (NameValuePair mapping in ChannelMappings) - { - if (StringHelper.EqualsIgnoreCase(mapping.Name, channelNumber)) - { - return mapping.Value; - } - } - return channelNumber; - } } } diff --git a/MediaBrowser.Model/MediaBrowser.Model.csproj b/MediaBrowser.Model/MediaBrowser.Model.csproj index 4457c6dc2..c50ee984e 100644 --- a/MediaBrowser.Model/MediaBrowser.Model.csproj +++ b/MediaBrowser.Model/MediaBrowser.Model.csproj @@ -198,7 +198,6 @@ <Compile Include="Notifications\NotificationOption.cs" /> <Compile Include="Notifications\NotificationOptions.cs" /> <Compile Include="Notifications\NotificationType.cs" /> - <Compile Include="Configuration\PathSubstitution.cs" /> <Compile Include="Notifications\SendToUserType.cs" /> <Compile Include="Configuration\ServerConfiguration.cs" /> <Compile Include="Playlists\PlaylistCreationRequest.cs" /> diff --git a/MediaBrowser.Model/MediaInfo/MediaInfo.cs b/MediaBrowser.Model/MediaInfo/MediaInfo.cs index de082635d..126710197 100644 --- a/MediaBrowser.Model/MediaInfo/MediaInfo.cs +++ b/MediaBrowser.Model/MediaInfo/MediaInfo.cs @@ -51,11 +51,6 @@ namespace MediaBrowser.Model.MediaInfo /// </summary> /// <value>The overview.</value> public string Overview { get; set; } - /// <summary> - /// Gets or sets the short overview. - /// </summary> - /// <value>The short overview.</value> - public string ShortOverview { get; set; } public MediaInfo() { diff --git a/MediaBrowser.Model/Net/IUdpSocket.cs b/MediaBrowser.Model/Net/IUdpSocket.cs index c70510726..76793f4a6 100644 --- a/MediaBrowser.Model/Net/IUdpSocket.cs +++ b/MediaBrowser.Model/Net/IUdpSocket.cs @@ -2,6 +2,7 @@ using System.Collections.Generic; using System.Linq; using System.Text; +using System.Threading; using System.Threading.Tasks; namespace MediaBrowser.Model.Net @@ -22,6 +23,6 @@ namespace MediaBrowser.Model.Net /// <summary> /// Sends a UDP message to a particular end point (uni or multicast). /// </summary> - Task SendAsync(byte[] buffer, int bytes, IpEndPointInfo endPoint); + Task SendAsync(byte[] buffer, int bytes, IpEndPointInfo endPoint, CancellationToken cancellationToken); } }
\ No newline at end of file diff --git a/MediaBrowser.Model/Querying/ItemFields.cs b/MediaBrowser.Model/Querying/ItemFields.cs index e36abf16e..5e1c17d1b 100644 --- a/MediaBrowser.Model/Querying/ItemFields.cs +++ b/MediaBrowser.Model/Querying/ItemFields.cs @@ -189,11 +189,6 @@ Settings, /// <summary> - /// The short overview - /// </summary> - ShortOverview, - - /// <summary> /// The screenshot image tags /// </summary> ScreenshotImageTags, diff --git a/MediaBrowser.Model/Session/PlaybackStopInfo.cs b/MediaBrowser.Model/Session/PlaybackStopInfo.cs index 3b4ac36a7..74347f894 100644 --- a/MediaBrowser.Model/Session/PlaybackStopInfo.cs +++ b/MediaBrowser.Model/Session/PlaybackStopInfo.cs @@ -47,5 +47,7 @@ namespace MediaBrowser.Model.Session /// </summary> /// <value><c>true</c> if failed; otherwise, <c>false</c>.</value> public bool Failed { get; set; } + + public string NextMediaType { get; set; } } }
\ No newline at end of file |
