diff options
| author | hatharry <hatharry@hotmail.com> | 2016-07-25 23:29:52 +1200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2016-07-25 23:29:52 +1200 |
| commit | f21f9923de6291aaf985f32dbbbaddbb26d07fb1 (patch) | |
| tree | 1a313e9a1c6790a755926bcef221c5f680537eae /MediaBrowser.Model | |
| parent | 6332d0b9436c511a59e2abd67ea8c24ce3d82ace (diff) | |
| parent | 8328f39834f042e1808fd8506bbc7c48151703ab (diff) | |
Merge pull request #15 from MediaBrowser/dev
Dev
Diffstat (limited to 'MediaBrowser.Model')
61 files changed, 705 insertions, 421 deletions
diff --git a/MediaBrowser.Model/ApiClient/ServerCredentials.cs b/MediaBrowser.Model/ApiClient/ServerCredentials.cs index 0f0ab65d4..19f68445e 100644 --- a/MediaBrowser.Model/ApiClient/ServerCredentials.cs +++ b/MediaBrowser.Model/ApiClient/ServerCredentials.cs @@ -57,6 +57,10 @@ namespace MediaBrowser.Model.ApiClient { existing.RemoteAddress = server.RemoteAddress; } + if (!string.IsNullOrEmpty(server.ConnectServerId)) + { + existing.ConnectServerId = server.ConnectServerId; + } if (!string.IsNullOrEmpty(server.LocalAddress)) { existing.LocalAddress = server.LocalAddress; diff --git a/MediaBrowser.Model/ApiClient/ServerInfo.cs b/MediaBrowser.Model/ApiClient/ServerInfo.cs index e1fa581d7..48995e80a 100644 --- a/MediaBrowser.Model/ApiClient/ServerInfo.cs +++ b/MediaBrowser.Model/ApiClient/ServerInfo.cs @@ -12,6 +12,7 @@ namespace MediaBrowser.Model.ApiClient public String Name { get; set; } public String Id { get; set; } + public String ConnectServerId { get; set; } public String LocalAddress { get; set; } public String RemoteAddress { get; set; } public String ManualAddress { get; set; } diff --git a/MediaBrowser.Model/Channels/ChannelFolderType.cs b/MediaBrowser.Model/Channels/ChannelFolderType.cs index 9261cb5cd..7c97afd02 100644 --- a/MediaBrowser.Model/Channels/ChannelFolderType.cs +++ b/MediaBrowser.Model/Channels/ChannelFolderType.cs @@ -6,6 +6,12 @@ namespace MediaBrowser.Model.Channels MusicAlbum = 1, - PhotoAlbum = 2 + PhotoAlbum = 2, + + MusicArtist = 3, + + Series = 4, + + Season = 5 } }
\ No newline at end of file diff --git a/MediaBrowser.Model/Configuration/BaseApplicationConfiguration.cs b/MediaBrowser.Model/Configuration/BaseApplicationConfiguration.cs index 2b53c6688..c4f9f206d 100644 --- a/MediaBrowser.Model/Configuration/BaseApplicationConfiguration.cs +++ b/MediaBrowser.Model/Configuration/BaseApplicationConfiguration.cs @@ -49,12 +49,6 @@ namespace MediaBrowser.Model.Configuration /// </summary> /// <value>The cache path.</value> public string CachePath { get; set; } - - /// <summary> - /// Gets or sets a value indicating whether [enable custom path sub folders]. - /// </summary> - /// <value><c>true</c> if [enable custom path sub folders]; otherwise, <c>false</c>.</value> - public bool EnableCustomPathSubFolders { get; set; } /// <summary> /// Initializes a new instance of the <see cref="BaseApplicationConfiguration" /> class. diff --git a/MediaBrowser.Model/Configuration/EncodingOptions.cs b/MediaBrowser.Model/Configuration/EncodingOptions.cs index 516d00ee6..91d28a296 100644 --- a/MediaBrowser.Model/Configuration/EncodingOptions.cs +++ b/MediaBrowser.Model/Configuration/EncodingOptions.cs @@ -6,10 +6,10 @@ namespace MediaBrowser.Model.Configuration public int EncodingThreadCount { get; set; } public string TranscodingTempPath { get; set; } public double DownMixAudioBoost { get; set; } - public bool EnableDebugLogging { get; set; } public bool EnableThrottling { get; set; } public int ThrottleDelaySeconds { get; set; } public string HardwareAccelerationType { get; set; } + public string EncoderAppPath { get; set; } public EncodingOptions() { diff --git a/MediaBrowser.Model/Configuration/FanartOptions.cs b/MediaBrowser.Model/Configuration/FanartOptions.cs index e992abe5d..6924b25d7 100644 --- a/MediaBrowser.Model/Configuration/FanartOptions.cs +++ b/MediaBrowser.Model/Configuration/FanartOptions.cs @@ -4,11 +4,6 @@ namespace MediaBrowser.Model.Configuration public class FanartOptions { /// <summary> - /// Gets or sets a value indicating whether [enable automatic updates]. - /// </summary> - /// <value><c>true</c> if [enable automatic updates]; otherwise, <c>false</c>.</value> - public bool EnableAutomaticUpdates { get; set; } - /// <summary> /// Gets or sets the user API key. /// </summary> /// <value>The user API key.</value> diff --git a/MediaBrowser.Model/Configuration/ServerConfiguration.cs b/MediaBrowser.Model/Configuration/ServerConfiguration.cs index 041f51a89..58b74ba64 100644 --- a/MediaBrowser.Model/Configuration/ServerConfiguration.cs +++ b/MediaBrowser.Model/Configuration/ServerConfiguration.cs @@ -67,7 +67,7 @@ namespace MediaBrowser.Model.Configuration /// </summary> /// <value><c>true</c> if [enable case sensitive item ids]; otherwise, <c>false</c>.</value> public bool EnableCaseSensitiveItemIds { get; set; } - + /// <summary> /// Gets or sets the metadata path. /// </summary> @@ -87,12 +87,6 @@ namespace MediaBrowser.Model.Configuration public bool SaveLocalMeta { get; set; } /// <summary> - /// Gets or sets a value indicating whether [enable localized guids]. - /// </summary> - /// <value><c>true</c> if [enable localized guids]; otherwise, <c>false</c>.</value> - public bool EnableLocalizedGuids { get; set; } - - /// <summary> /// Gets or sets the preferred metadata language. /// </summary> /// <value>The preferred metadata language.</value> @@ -161,7 +155,7 @@ namespace MediaBrowser.Model.Configuration /// </summary> /// <value>The dashboard source path.</value> public string DashboardSourcePath { get; set; } - + /// <summary> /// Gets or sets the image saving convention. /// </summary> @@ -190,31 +184,38 @@ namespace MediaBrowser.Model.Configuration public bool EnableVideoArchiveFiles { get; set; } public int RemoteClientBitrateLimit { get; set; } - public bool DenyIFrameEmbedding { get; set; } - public AutoOnOff EnableLibraryMonitor { get; set; } public int SharingExpirationDays { get; set; } - public bool EnableWindowsShortcuts { get; set; } - - public bool EnableDateLastRefresh { get; set; } - public string[] Migrations { get; set; } public int MigrationVersion { get; set; } + public int SchemaVersion { get; set; } + public int SqliteCacheSize { get; set; } public bool DownloadImagesInAdvance { get; set; } 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; } + public bool DisplayCollectionsView { get; set; } + public string[] LocalNetworkAddresses { get; set; } /// <summary> /// Initializes a new instance of the <see cref="ServerConfiguration" /> class. /// </summary> public ServerConfiguration() { + LocalNetworkAddresses = new string[] { }; Migrations = new string[] { }; + SqliteCacheSize = 0; + + EnableLocalizedGuids = true; + DisplaySpecialsWithinSeasons = true; ImageSavingConvention = ImageSavingConvention.Compatible; PublicPort = 8096; @@ -227,10 +228,8 @@ namespace MediaBrowser.Model.Configuration EnableAnonymousUsageReporting = true; EnableAutomaticRestart = true; - DenyIFrameEmbedding = true; EnableUPnP = true; - SharingExpirationDays = 30; MinResumePct = 5; MaxResumePct = 90; diff --git a/MediaBrowser.Model/Configuration/TheMovieDbOptions.cs b/MediaBrowser.Model/Configuration/TheMovieDbOptions.cs deleted file mode 100644 index 9a73e3476..000000000 --- a/MediaBrowser.Model/Configuration/TheMovieDbOptions.cs +++ /dev/null @@ -1,12 +0,0 @@ - -namespace MediaBrowser.Model.Configuration -{ - public class TheMovieDbOptions - { - /// <summary> - /// Gets or sets a value indicating whether [enable automatic updates]. - /// </summary> - /// <value><c>true</c> if [enable automatic updates]; otherwise, <c>false</c>.</value> - public bool EnableAutomaticUpdates { get; set; } - } -} diff --git a/MediaBrowser.Model/Configuration/TvdbOptions.cs b/MediaBrowser.Model/Configuration/TvdbOptions.cs deleted file mode 100644 index 034af609c..000000000 --- a/MediaBrowser.Model/Configuration/TvdbOptions.cs +++ /dev/null @@ -1,12 +0,0 @@ - -namespace MediaBrowser.Model.Configuration -{ - public class TvdbOptions - { - /// <summary> - /// Gets or sets a value indicating whether [enable automatic updates]. - /// </summary> - /// <value><c>true</c> if [enable automatic updates]; otherwise, <c>false</c>.</value> - public bool EnableAutomaticUpdates { get; set; } - } -} diff --git a/MediaBrowser.Model/Configuration/UserConfiguration.cs b/MediaBrowser.Model/Configuration/UserConfiguration.cs index f294d1dec..69dc23b21 100644 --- a/MediaBrowser.Model/Configuration/UserConfiguration.cs +++ b/MediaBrowser.Model/Configuration/UserConfiguration.cs @@ -34,24 +34,22 @@ namespace MediaBrowser.Model.Configuration public SubtitlePlaybackMode SubtitleMode { get; set; } public bool DisplayCollectionsView { get; set; } - public bool DisplayFoldersView { get; set; } public bool EnableLocalPassword { get; set; } public string[] OrderedViews { get; set; } - public bool IncludeTrailersInSuggestions { get; set; } - public string[] LatestItemsExcludes { get; set; } public string[] PlainFolderViews { get; set; } public bool HidePlayedInLatest { get; set; } - public bool DisplayChannelsInline { get; set; } + public bool EnableChannelView { get; set; } public bool RememberAudioSelections { get; set; } public bool RememberSubtitleSelections { get; set; } public bool EnableNextEpisodeAutoPlay { get; set; } - + public bool DisplayFoldersView { get; set; } + /// <summary> /// Initializes a new instance of the <see cref="UserConfiguration" /> class. /// </summary> @@ -60,7 +58,6 @@ namespace MediaBrowser.Model.Configuration EnableNextEpisodeAutoPlay = true; RememberAudioSelections = true; RememberSubtitleSelections = true; - DisplayChannelsInline = true; HidePlayedInLatest = true; PlayDefaultAudioTrack = true; @@ -70,8 +67,6 @@ namespace MediaBrowser.Model.Configuration PlainFolderViews = new string[] { }; - IncludeTrailersInSuggestions = true; - GroupedFolders = new string[] { }; } } diff --git a/MediaBrowser.Model/Connect/ConnectUser.cs b/MediaBrowser.Model/Connect/ConnectUser.cs index 383261a6b..da290da12 100644 --- a/MediaBrowser.Model/Connect/ConnectUser.cs +++ b/MediaBrowser.Model/Connect/ConnectUser.cs @@ -8,6 +8,5 @@ namespace MediaBrowser.Model.Connect public string Email { get; set; } public bool IsActive { get; set; } public string ImageUrl { get; set; } - public bool IsSupporter { get; set; } } } diff --git a/MediaBrowser.Model/Dlna/AudioOptions.cs b/MediaBrowser.Model/Dlna/AudioOptions.cs index 6ad4fa265..c208e8ab0 100644 --- a/MediaBrowser.Model/Dlna/AudioOptions.cs +++ b/MediaBrowser.Model/Dlna/AudioOptions.cs @@ -11,8 +11,16 @@ namespace MediaBrowser.Model.Dlna public AudioOptions() { Context = EncodingContext.Streaming; + + EnableDirectPlay = true; + EnableDirectStream = true; } + public bool EnableDirectPlay { get; set; } + public bool EnableDirectStream { get; set; } + public bool ForceDirectPlay { get; set; } + public bool ForceDirectStream { get; set; } + public string ItemId { get; set; } public List<MediaSourceInfo> MediaSources { get; set; } public DeviceProfile Profile { get; set; } diff --git a/MediaBrowser.Model/Dlna/CodecProfile.cs b/MediaBrowser.Model/Dlna/CodecProfile.cs index 7200f648c..385e98f61 100644 --- a/MediaBrowser.Model/Dlna/CodecProfile.cs +++ b/MediaBrowser.Model/Dlna/CodecProfile.cs @@ -11,6 +11,8 @@ namespace MediaBrowser.Model.Dlna public ProfileCondition[] Conditions { get; set; } + public ProfileCondition[] ApplyConditions { get; set; } + [XmlAttribute("codec")] public string Codec { get; set; } @@ -20,6 +22,7 @@ namespace MediaBrowser.Model.Dlna public CodecProfile() { Conditions = new ProfileCondition[] {}; + ApplyConditions = new ProfileCondition[] { }; } public List<string> GetCodecs() diff --git a/MediaBrowser.Model/Dlna/ConditionProcessor.cs b/MediaBrowser.Model/Dlna/ConditionProcessor.cs index fef04647a..69f1369dc 100644 --- a/MediaBrowser.Model/Dlna/ConditionProcessor.cs +++ b/MediaBrowser.Model/Dlna/ConditionProcessor.cs @@ -17,7 +17,6 @@ namespace MediaBrowser.Model.Dlna int? packetLength, TransportStreamTimestamp? timestamp, bool? isAnamorphic, - bool? isCabac, int? refFrames, int? numVideoStreams, int? numAudioStreams, @@ -27,8 +26,6 @@ namespace MediaBrowser.Model.Dlna { case ProfileConditionValue.IsAnamorphic: return IsConditionSatisfied(condition, isAnamorphic); - case ProfileConditionValue.IsCabac: - return IsConditionSatisfied(condition, isCabac); case ProfileConditionValue.VideoFramerate: return IsConditionSatisfied(condition, videoFramerate); case ProfileConditionValue.VideoLevel: diff --git a/MediaBrowser.Model/Dlna/ContentFeatureBuilder.cs b/MediaBrowser.Model/Dlna/ContentFeatureBuilder.cs index 58d669c22..c4b3383a2 100644 --- a/MediaBrowser.Model/Dlna/ContentFeatureBuilder.cs +++ b/MediaBrowser.Model/Dlna/ContentFeatureBuilder.cs @@ -115,7 +115,6 @@ namespace MediaBrowser.Model.Dlna int? packetLength, TranscodeSeekInfo transcodeSeekInfo, bool? isAnamorphic, - bool? isCabac, int? refFrames, int? numVideoStreams, int? numAudioStreams, @@ -157,7 +156,6 @@ namespace MediaBrowser.Model.Dlna packetLength, timestamp, isAnamorphic, - isCabac, refFrames, numVideoStreams, numAudioStreams, diff --git a/MediaBrowser.Model/Dlna/DeviceProfile.cs b/MediaBrowser.Model/Dlna/DeviceProfile.cs index 80c060c49..423928f62 100644 --- a/MediaBrowser.Model/Dlna/DeviceProfile.cs +++ b/MediaBrowser.Model/Dlna/DeviceProfile.cs @@ -283,7 +283,6 @@ namespace MediaBrowser.Model.Dlna int? packetLength, TransportStreamTimestamp timestamp, bool? isAnamorphic, - bool? isCabac, int? refFrames, int? numVideoStreams, int? numAudioStreams, @@ -321,7 +320,7 @@ namespace MediaBrowser.Model.Dlna var anyOff = false; foreach (ProfileCondition c in i.Conditions) { - if (!conditionProcessor.IsVideoConditionSatisfied(c, width, height, bitDepth, videoBitrate, videoProfile, videoLevel, videoFramerate, packetLength, timestamp, isAnamorphic, isCabac, refFrames, numVideoStreams, numAudioStreams, videoCodecTag)) + if (!conditionProcessor.IsVideoConditionSatisfied(c, width, height, bitDepth, videoBitrate, videoProfile, videoLevel, videoFramerate, packetLength, timestamp, isAnamorphic, refFrames, numVideoStreams, numAudioStreams, videoCodecTag)) { anyOff = true; break; diff --git a/MediaBrowser.Model/Dlna/ILocalPlayer.cs b/MediaBrowser.Model/Dlna/ILocalPlayer.cs deleted file mode 100644 index 55e11ec4b..000000000 --- a/MediaBrowser.Model/Dlna/ILocalPlayer.cs +++ /dev/null @@ -1,26 +0,0 @@ - -namespace MediaBrowser.Model.Dlna -{ - public interface ILocalPlayer - { - /// <summary> - /// Determines whether this instance [can access file] the specified path. - /// </summary> - /// <param name="path">The path.</param> - /// <returns><c>true</c> if this instance [can access file] the specified path; otherwise, <c>false</c>.</returns> - bool CanAccessFile(string path); - /// <summary> - /// Determines whether this instance [can access directory] the specified path. - /// </summary> - /// <param name="path">The path.</param> - /// <returns><c>true</c> if this instance [can access directory] the specified path; otherwise, <c>false</c>.</returns> - bool CanAccessDirectory(string path); - /// <summary> - /// Determines whether this instance [can access URL] the specified URL. - /// </summary> - /// <param name="url">The URL.</param> - /// <param name="requiresCustomRequestHeaders">if set to <c>true</c> [requires custom request headers].</param> - /// <returns><c>true</c> if this instance [can access URL] the specified URL; otherwise, <c>false</c>.</returns> - bool CanAccessUrl(string url, bool requiresCustomRequestHeaders); - } -} diff --git a/MediaBrowser.Model/Dlna/ITranscoderSupport.cs b/MediaBrowser.Model/Dlna/ITranscoderSupport.cs new file mode 100644 index 000000000..0dac23403 --- /dev/null +++ b/MediaBrowser.Model/Dlna/ITranscoderSupport.cs @@ -0,0 +1,15 @@ +namespace MediaBrowser.Model.Dlna +{ + public interface ITranscoderSupport + { + bool CanEncodeToAudioCodec(string codec); + } + + public class FullTranscoderSupport : ITranscoderSupport + { + public bool CanEncodeToAudioCodec(string codec) + { + return true; + } + } +} diff --git a/MediaBrowser.Model/Dlna/NullLocalPlayer.cs b/MediaBrowser.Model/Dlna/NullLocalPlayer.cs deleted file mode 100644 index c34b63887..000000000 --- a/MediaBrowser.Model/Dlna/NullLocalPlayer.cs +++ /dev/null @@ -1,21 +0,0 @@ - -namespace MediaBrowser.Model.Dlna -{ - public class NullLocalPlayer : ILocalPlayer - { - public bool CanAccessFile(string path) - { - return false; - } - - public bool CanAccessDirectory(string path) - { - return false; - } - - public bool CanAccessUrl(string url, bool requiresCustomRequestHeaders) - { - return false; - } - } -} diff --git a/MediaBrowser.Model/Dlna/ProfileConditionValue.cs b/MediaBrowser.Model/Dlna/ProfileConditionValue.cs index 4ad326e51..c17a09c3f 100644 --- a/MediaBrowser.Model/Dlna/ProfileConditionValue.cs +++ b/MediaBrowser.Model/Dlna/ProfileConditionValue.cs @@ -17,7 +17,6 @@ VideoTimestamp = 12, IsAnamorphic = 13, RefFrames = 14, - IsCabac = 15, NumAudioStreams = 16, NumVideoStreams = 17, IsSecondaryAudio = 18, diff --git a/MediaBrowser.Model/Dlna/ResolutionNormalizer.cs b/MediaBrowser.Model/Dlna/ResolutionNormalizer.cs index 8a412ac2c..ed18fed65 100644 --- a/MediaBrowser.Model/Dlna/ResolutionNormalizer.cs +++ b/MediaBrowser.Model/Dlna/ResolutionNormalizer.cs @@ -56,5 +56,25 @@ namespace MediaBrowser.Model.Dlna MaxHeight = maxHeight }; } + + private static double GetVideoBitrateScaleFactor(string codec) + { + if (string.Equals(codec, "h265", StringComparison.OrdinalIgnoreCase) || + string.Equals(codec, "hevc", StringComparison.OrdinalIgnoreCase)) + { + return .5; + } + return 1; + } + + public static int ScaleBitrate(int bitrate, string inputVideoCodec, string outputVideoCodec) + { + var inputScaleFactor = GetVideoBitrateScaleFactor(inputVideoCodec); + var outputScaleFactor = GetVideoBitrateScaleFactor(outputVideoCodec); + var scaleFactor = outputScaleFactor/inputScaleFactor; + var newBitrate = scaleFactor*bitrate; + + return Convert.ToInt32(newBitrate); + } } } diff --git a/MediaBrowser.Model/Dlna/StreamBuilder.cs b/MediaBrowser.Model/Dlna/StreamBuilder.cs index b04f1b0fb..c05ca4187 100644 --- a/MediaBrowser.Model/Dlna/StreamBuilder.cs +++ b/MediaBrowser.Model/Dlna/StreamBuilder.cs @@ -11,17 +11,17 @@ namespace MediaBrowser.Model.Dlna { public class StreamBuilder { - private readonly ILocalPlayer _localPlayer; private readonly ILogger _logger; + private readonly ITranscoderSupport _transcoderSupport; - public StreamBuilder(ILocalPlayer localPlayer, ILogger logger) + public StreamBuilder(ITranscoderSupport transcoderSupport, ILogger logger) { - _localPlayer = localPlayer; + _transcoderSupport = transcoderSupport; _logger = logger; } public StreamBuilder(ILogger logger) - : this(new NullLocalPlayer(), logger) + : this(new FullTranscoderSupport(), logger) { } @@ -55,7 +55,7 @@ namespace MediaBrowser.Model.Dlna stream.DeviceProfileId = options.Profile.Id; } - return GetOptimalStream(streams); + return GetOptimalStream(streams, options.GetMaxBitrate()); } public StreamInfo BuildVideoItem(VideoOptions options) @@ -88,12 +88,12 @@ namespace MediaBrowser.Model.Dlna stream.DeviceProfileId = options.Profile.Id; } - return GetOptimalStream(streams); + return GetOptimalStream(streams, options.GetMaxBitrate()); } - private StreamInfo GetOptimalStream(List<StreamInfo> streams) + private StreamInfo GetOptimalStream(List<StreamInfo> streams, int? maxBitrate) { - streams = StreamInfoSorter.SortMediaSources(streams); + streams = StreamInfoSorter.SortMediaSources(streams, maxBitrate); foreach (StreamInfo stream in streams) { @@ -115,10 +115,29 @@ namespace MediaBrowser.Model.Dlna DeviceProfile = options.Profile }; + if (options.ForceDirectPlay) + { + playlistItem.PlayMethod = PlayMethod.DirectPlay; + playlistItem.Container = item.Container; + return playlistItem; + } + + if (options.ForceDirectStream) + { + playlistItem.PlayMethod = PlayMethod.DirectStream; + playlistItem.Container = item.Container; + return playlistItem; + } + MediaStream audioStream = item.GetDefaultAudioStream(null); List<PlayMethod> directPlayMethods = GetAudioDirectPlayMethods(item, audioStream, options); + ConditionProcessor conditionProcessor = new ConditionProcessor(); + + int? inputAudioChannels = audioStream == null ? null : audioStream.Channels; + int? inputAudioBitrate = audioStream == null ? null : audioStream.BitDepth; + if (directPlayMethods.Count > 0) { string audioCodec = audioStream == null ? null : audioStream.Codec; @@ -126,27 +145,36 @@ namespace MediaBrowser.Model.Dlna // Make sure audio codec profiles are satisfied if (!string.IsNullOrEmpty(audioCodec)) { - ConditionProcessor conditionProcessor = new ConditionProcessor(); - List<ProfileCondition> conditions = new List<ProfileCondition>(); foreach (CodecProfile i in options.Profile.CodecProfiles) { if (i.Type == CodecType.Audio && i.ContainsCodec(audioCodec, item.Container)) { - foreach (ProfileCondition c in i.Conditions) + bool applyConditions = true; + foreach (ProfileCondition applyCondition in i.ApplyConditions) { - conditions.Add(c); + if (!conditionProcessor.IsAudioConditionSatisfied(applyCondition, inputAudioChannels, inputAudioBitrate)) + { + LogConditionFailure(options.Profile, "AudioCodecProfile", applyCondition, item); + applyConditions = false; + break; + } + } + + if (applyConditions) + { + foreach (ProfileCondition c in i.Conditions) + { + conditions.Add(c); + } } } } - int? audioChannels = audioStream.Channels; - int? audioBitrate = audioStream.BitRate; - bool all = true; foreach (ProfileCondition c in conditions) { - if (!conditionProcessor.IsAudioConditionSatisfied(c, audioChannels, audioBitrate)) + if (!conditionProcessor.IsAudioConditionSatisfied(c, inputAudioChannels, inputAudioBitrate)) { LogConditionFailure(options.Profile, "AudioCodecProfile", c, item); all = false; @@ -156,19 +184,7 @@ namespace MediaBrowser.Model.Dlna if (all) { - if (item.Protocol == MediaProtocol.File && - directPlayMethods.Contains(PlayMethod.DirectPlay) && - _localPlayer.CanAccessFile(item.Path)) - { - playlistItem.PlayMethod = PlayMethod.DirectPlay; - } - else if (item.Protocol == MediaProtocol.Http && - directPlayMethods.Contains(PlayMethod.DirectPlay) && - _localPlayer.CanAccessUrl(item.Path, item.RequiredHttpHeaders.Count > 0)) - { - playlistItem.PlayMethod = PlayMethod.DirectPlay; - } - else if (directPlayMethods.Contains(PlayMethod.DirectStream)) + if (directPlayMethods.Contains(PlayMethod.DirectStream)) { playlistItem.PlayMethod = PlayMethod.DirectStream; } @@ -185,8 +201,11 @@ namespace MediaBrowser.Model.Dlna { if (i.Type == playlistItem.MediaType && i.Context == options.Context) { - transcodingProfile = i; - break; + if (_transcoderSupport.CanEncodeToAudioCodec(i.AudioCodec ?? i.Container)) + { + transcodingProfile = i; + break; + } } } @@ -201,7 +220,15 @@ namespace MediaBrowser.Model.Dlna playlistItem.TranscodeSeekInfo = transcodingProfile.TranscodeSeekInfo; playlistItem.EstimateContentLength = transcodingProfile.EstimateContentLength; playlistItem.Container = transcodingProfile.Container; - playlistItem.AudioCodec = transcodingProfile.AudioCodec; + + if (string.IsNullOrEmpty(transcodingProfile.AudioCodec)) + { + playlistItem.AudioCodecs = new string[] { }; + } + else + { + playlistItem.AudioCodecs = transcodingProfile.AudioCodec.Split(','); + } playlistItem.SubProtocol = transcodingProfile.Protocol; List<CodecProfile> audioCodecProfiles = new List<CodecProfile>(); @@ -218,9 +245,23 @@ namespace MediaBrowser.Model.Dlna List<ProfileCondition> audioTranscodingConditions = new List<ProfileCondition>(); foreach (CodecProfile i in audioCodecProfiles) { - foreach (ProfileCondition c in i.Conditions) + bool applyConditions = true; + foreach (ProfileCondition applyCondition in i.ApplyConditions) { - audioTranscodingConditions.Add(c); + if (!conditionProcessor.IsAudioConditionSatisfied(applyCondition, inputAudioChannels, inputAudioBitrate)) + { + LogConditionFailure(options.Profile, "AudioCodecProfile", applyCondition, item); + applyConditions = false; + break; + } + } + + if (applyConditions) + { + foreach (ProfileCondition c in i.Conditions) + { + audioTranscodingConditions.Add(c); + } } } @@ -271,7 +312,7 @@ namespace MediaBrowser.Model.Dlna if (directPlayProfile != null) { // While options takes the network and other factors into account. Only applies to direct stream - if (item.SupportsDirectStream && IsAudioEligibleForDirectPlay(item, options.GetMaxBitrate())) + if (item.SupportsDirectStream && IsAudioEligibleForDirectPlay(item, options.GetMaxBitrate()) && options.EnableDirectStream) { playMethods.Add(PlayMethod.DirectStream); } @@ -279,7 +320,7 @@ namespace MediaBrowser.Model.Dlna // The profile describes what the device supports // If device requirements are satisfied then allow both direct stream and direct play if (item.SupportsDirectPlay && - IsAudioEligibleForDirectPlay(item, GetBitrateForDirectPlayCheck(item, options))) + IsAudioEligibleForDirectPlay(item, GetBitrateForDirectPlayCheck(item, options)) && options.EnableDirectPlay) { playMethods.Add(PlayMethod.DirectPlay); } @@ -362,8 +403,8 @@ namespace MediaBrowser.Model.Dlna MediaStream videoStream = item.VideoStream; // TODO: This doesn't accout for situation of device being able to handle media bitrate, but wifi connection not fast enough - bool isEligibleForDirectPlay = IsEligibleForDirectPlay(item, GetBitrateForDirectPlayCheck(item, options), subtitleStream, options, PlayMethod.DirectPlay); - bool isEligibleForDirectStream = IsEligibleForDirectPlay(item, options.GetMaxBitrate(), subtitleStream, options, PlayMethod.DirectStream); + bool isEligibleForDirectPlay = options.EnableDirectPlay && (options.ForceDirectPlay || IsEligibleForDirectPlay(item, GetBitrateForDirectPlayCheck(item, options), subtitleStream, options, PlayMethod.DirectPlay)); + bool isEligibleForDirectStream = options.EnableDirectStream && (options.ForceDirectStream || IsEligibleForDirectPlay(item, options.GetMaxBitrate(), subtitleStream, options, PlayMethod.DirectStream)); _logger.Info("Profile: {0}, Path: {1}, isEligibleForDirectPlay: {2}, isEligibleForDirectStream: {3}", options.Profile.Name ?? "Unknown Profile", @@ -374,7 +415,7 @@ namespace MediaBrowser.Model.Dlna if (isEligibleForDirectPlay || isEligibleForDirectStream) { // See if it can be direct played - PlayMethod? directPlay = GetVideoDirectPlayProfile(options.Profile, item, videoStream, audioStream, isEligibleForDirectPlay, isEligibleForDirectStream); + PlayMethod? directPlay = GetVideoDirectPlayProfile(options, item, videoStream, audioStream, isEligibleForDirectPlay, isEligibleForDirectStream); if (directPlay != null) { @@ -383,7 +424,7 @@ namespace MediaBrowser.Model.Dlna if (subtitleStream != null) { - SubtitleProfile subtitleProfile = GetSubtitleProfile(subtitleStream, options.Profile.SubtitleProfiles, options.Context, directPlay.Value); + SubtitleProfile subtitleProfile = GetSubtitleProfile(subtitleStream, options.Profile.SubtitleProfiles, directPlay.Value); playlistItem.SubtitleDeliveryMethod = subtitleProfile.Method; playlistItem.SubtitleFormat = subtitleProfile.Format; @@ -413,7 +454,7 @@ namespace MediaBrowser.Model.Dlna if (subtitleStream != null) { - SubtitleProfile subtitleProfile = GetSubtitleProfile(subtitleStream, options.Profile.SubtitleProfiles, options.Context, PlayMethod.Transcode); + SubtitleProfile subtitleProfile = GetSubtitleProfile(subtitleStream, options.Profile.SubtitleProfiles, PlayMethod.Transcode); playlistItem.SubtitleDeliveryMethod = subtitleProfile.Method; playlistItem.SubtitleFormat = subtitleProfile.Format; @@ -424,38 +465,54 @@ namespace MediaBrowser.Model.Dlna playlistItem.EstimateContentLength = transcodingProfile.EstimateContentLength; playlistItem.TranscodeSeekInfo = transcodingProfile.TranscodeSeekInfo; - // TODO: We should probably preserve the full list and sent it tp the server that way - string[] supportedAudioCodecs = transcodingProfile.AudioCodec.Split(','); - string inputAudioCodec = audioStream == null ? null : audioStream.Codec; - foreach (string supportedAudioCodec in supportedAudioCodecs) + playlistItem.AudioCodecs = transcodingProfile.AudioCodec.Split(','); + + playlistItem.VideoCodec = transcodingProfile.VideoCodec; + playlistItem.CopyTimestamps = transcodingProfile.CopyTimestamps; + playlistItem.ForceLiveStream = transcodingProfile.ForceLiveStream; + playlistItem.EnableSubtitlesInManifest = transcodingProfile.EnableSubtitlesInManifest; + + if (!string.IsNullOrEmpty(transcodingProfile.MaxAudioChannels)) { - if (StringHelper.EqualsIgnoreCase(supportedAudioCodec, inputAudioCodec)) + int transcodingMaxAudioChannels; + if (IntHelper.TryParseCultureInvariant(transcodingProfile.MaxAudioChannels, out transcodingMaxAudioChannels)) { - playlistItem.AudioCodec = supportedAudioCodec; - break; + playlistItem.TranscodingMaxAudioChannels = transcodingMaxAudioChannels; } } - - if (string.IsNullOrEmpty(playlistItem.AudioCodec)) - { - playlistItem.AudioCodec = supportedAudioCodecs[0]; - } - - playlistItem.VideoCodec = transcodingProfile.VideoCodec; - playlistItem.CopyTimestamps = transcodingProfile.CopyTimestamps; playlistItem.SubProtocol = transcodingProfile.Protocol; playlistItem.AudioStreamIndex = audioStreamIndex; + ConditionProcessor conditionProcessor = new ConditionProcessor(); List<ProfileCondition> videoTranscodingConditions = new List<ProfileCondition>(); foreach (CodecProfile i in options.Profile.CodecProfiles) { if (i.Type == CodecType.Video && i.ContainsCodec(transcodingProfile.VideoCodec, transcodingProfile.Container)) { - foreach (ProfileCondition c in i.Conditions) + bool applyConditions = true; + foreach (ProfileCondition applyCondition in i.ApplyConditions) { - videoTranscodingConditions.Add(c); + bool? isSecondaryAudio = audioStream == null ? null : item.IsSecondaryAudio(audioStream); + int? inputAudioBitrate = audioStream == null ? null : audioStream.BitRate; + int? audioChannels = audioStream == null ? null : audioStream.Channels; + string audioProfile = audioStream == null ? null : audioStream.Profile; + + if (!conditionProcessor.IsVideoAudioConditionSatisfied(applyCondition, audioChannels, inputAudioBitrate, audioProfile, isSecondaryAudio)) + { + LogConditionFailure(options.Profile, "AudioCodecProfile", applyCondition, item); + applyConditions = false; + break; + } + } + + if (applyConditions) + { + foreach (ProfileCondition c in i.Conditions) + { + videoTranscodingConditions.Add(c); + } + break; } - break; } } ApplyTranscodingConditions(playlistItem, videoTranscodingConditions); @@ -463,13 +520,44 @@ namespace MediaBrowser.Model.Dlna List<ProfileCondition> audioTranscodingConditions = new List<ProfileCondition>(); foreach (CodecProfile i in options.Profile.CodecProfiles) { - if (i.Type == CodecType.VideoAudio && i.ContainsCodec(playlistItem.AudioCodec, transcodingProfile.Container)) + if (i.Type == CodecType.VideoAudio && i.ContainsCodec(playlistItem.TargetAudioCodec, transcodingProfile.Container)) { - foreach (ProfileCondition c in i.Conditions) + bool applyConditions = true; + foreach (ProfileCondition applyCondition in i.ApplyConditions) { - audioTranscodingConditions.Add(c); + int? width = videoStream == null ? null : videoStream.Width; + int? height = videoStream == null ? null : videoStream.Height; + int? bitDepth = videoStream == null ? null : videoStream.BitDepth; + int? videoBitrate = videoStream == null ? null : videoStream.BitRate; + double? videoLevel = videoStream == null ? null : videoStream.Level; + string videoProfile = videoStream == null ? null : videoStream.Profile; + float? videoFramerate = videoStream == null ? null : videoStream.AverageFrameRate ?? videoStream.AverageFrameRate; + bool? isAnamorphic = videoStream == null ? null : videoStream.IsAnamorphic; + string videoCodecTag = videoStream == null ? null : videoStream.CodecTag; + + TransportStreamTimestamp? timestamp = videoStream == null ? TransportStreamTimestamp.None : item.Timestamp; + int? packetLength = videoStream == null ? null : videoStream.PacketLength; + int? refFrames = videoStream == null ? null : videoStream.RefFrames; + + int? numAudioStreams = item.GetStreamCount(MediaStreamType.Audio); + int? numVideoStreams = item.GetStreamCount(MediaStreamType.Video); + + if (!conditionProcessor.IsVideoConditionSatisfied(applyCondition, width, height, bitDepth, videoBitrate, videoProfile, videoLevel, videoFramerate, packetLength, timestamp, isAnamorphic, refFrames, numVideoStreams, numAudioStreams, videoCodecTag)) + { + LogConditionFailure(options.Profile, "VideoCodecProfile", applyCondition, item); + applyConditions = false; + break; + } + } + + if (applyConditions) + { + foreach (ProfileCondition c in i.Conditions) + { + audioTranscodingConditions.Add(c); + } + break; } - break; } } ApplyTranscodingConditions(playlistItem, audioTranscodingConditions); @@ -508,12 +596,23 @@ namespace MediaBrowser.Model.Dlna private int GetAudioBitrate(int? maxTotalBitrate, int? targetAudioChannels, string targetAudioCodec, MediaStream audioStream) { var defaultBitrate = 128000; + if (StringHelper.EqualsIgnoreCase(targetAudioCodec, "ac3")) + { + defaultBitrate = 192000; + } if (targetAudioChannels.HasValue) { if (targetAudioChannels.Value >= 5 && (maxTotalBitrate ?? 0) >= 2000000) { - defaultBitrate = 320000; + if (StringHelper.EqualsIgnoreCase(targetAudioCodec, "ac3")) + { + defaultBitrate = 448000; + } + else + { + defaultBitrate = 320000; + } } } @@ -536,13 +635,24 @@ namespace MediaBrowser.Model.Dlna return Math.Min(defaultBitrate, encoderAudioBitrateLimit); } - private PlayMethod? GetVideoDirectPlayProfile(DeviceProfile profile, + private PlayMethod? GetVideoDirectPlayProfile(VideoOptions options, MediaSourceInfo mediaSource, MediaStream videoStream, MediaStream audioStream, bool isEligibleForDirectPlay, bool isEligibleForDirectStream) { + DeviceProfile profile = options.Profile; + + if (options.ForceDirectPlay) + { + return PlayMethod.DirectPlay; + } + if (options.ForceDirectStream) + { + return PlayMethod.DirectStream; + } + if (videoStream == null) { _logger.Info("Profile: {0}, Cannot direct stream with no known video stream. Path: {1}", @@ -597,7 +707,6 @@ namespace MediaBrowser.Model.Dlna string videoProfile = videoStream == null ? null : videoStream.Profile; float? videoFramerate = videoStream == null ? null : videoStream.AverageFrameRate ?? videoStream.AverageFrameRate; bool? isAnamorphic = videoStream == null ? null : videoStream.IsAnamorphic; - bool? isCabac = videoStream == null ? null : videoStream.IsCabac; string videoCodecTag = videoStream == null ? null : videoStream.CodecTag; int? audioBitrate = audioStream == null ? null : audioStream.BitRate; @@ -614,7 +723,7 @@ namespace MediaBrowser.Model.Dlna // Check container conditions foreach (ProfileCondition i in conditions) { - if (!conditionProcessor.IsVideoConditionSatisfied(i, width, height, bitDepth, videoBitrate, videoProfile, videoLevel, videoFramerate, packetLength, timestamp, isAnamorphic, isCabac, refFrames, numVideoStreams, numAudioStreams, videoCodecTag)) + if (!conditionProcessor.IsVideoConditionSatisfied(i, width, height, bitDepth, videoBitrate, videoProfile, videoLevel, videoFramerate, packetLength, timestamp, isAnamorphic, refFrames, numVideoStreams, numAudioStreams, videoCodecTag)) { LogConditionFailure(profile, "VideoContainerProfile", i, mediaSource); @@ -638,16 +747,30 @@ namespace MediaBrowser.Model.Dlna { if (i.Type == CodecType.Video && i.ContainsCodec(videoCodec, container)) { - foreach (ProfileCondition c in i.Conditions) + bool applyConditions = true; + foreach (ProfileCondition applyCondition in i.ApplyConditions) { - conditions.Add(c); + if (!conditionProcessor.IsVideoConditionSatisfied(applyCondition, width, height, bitDepth, videoBitrate, videoProfile, videoLevel, videoFramerate, packetLength, timestamp, isAnamorphic, refFrames, numVideoStreams, numAudioStreams, videoCodecTag)) + { + LogConditionFailure(profile, "VideoCodecProfile", applyCondition, mediaSource); + applyConditions = false; + break; + } + } + + if (applyConditions) + { + foreach (ProfileCondition c in i.Conditions) + { + conditions.Add(c); + } } } } foreach (ProfileCondition i in conditions) { - if (!conditionProcessor.IsVideoConditionSatisfied(i, width, height, bitDepth, videoBitrate, videoProfile, videoLevel, videoFramerate, packetLength, timestamp, isAnamorphic, isCabac, refFrames, numVideoStreams, numAudioStreams, videoCodecTag)) + if (!conditionProcessor.IsVideoConditionSatisfied(i, width, height, bitDepth, videoBitrate, videoProfile, videoLevel, videoFramerate, packetLength, timestamp, isAnamorphic, refFrames, numVideoStreams, numAudioStreams, videoCodecTag)) { LogConditionFailure(profile, "VideoCodecProfile", i, mediaSource); @@ -669,20 +792,35 @@ namespace MediaBrowser.Model.Dlna } conditions = new List<ProfileCondition>(); + bool? isSecondaryAudio = audioStream == null ? null : mediaSource.IsSecondaryAudio(audioStream); + foreach (CodecProfile i in profile.CodecProfiles) { if (i.Type == CodecType.VideoAudio && i.ContainsCodec(audioCodec, container)) { - foreach (ProfileCondition c in i.Conditions) + bool applyConditions = true; + foreach (ProfileCondition applyCondition in i.ApplyConditions) { - conditions.Add(c); + if (!conditionProcessor.IsVideoAudioConditionSatisfied(applyCondition, audioChannels, audioBitrate, audioProfile, isSecondaryAudio)) + { + LogConditionFailure(profile, "VideoAudioCodecProfile", applyCondition, mediaSource); + applyConditions = false; + break; + } + } + + if (applyConditions) + { + foreach (ProfileCondition c in i.Conditions) + { + conditions.Add(c); + } } } } foreach (ProfileCondition i in conditions) { - bool? isSecondaryAudio = audioStream == null ? null : mediaSource.IsSecondaryAudio(audioStream); if (!conditionProcessor.IsVideoAudioConditionSatisfied(i, audioChannels, audioBitrate, audioProfile, isSecondaryAudio)) { LogConditionFailure(profile, "VideoAudioCodecProfile", i, mediaSource); @@ -692,25 +830,6 @@ namespace MediaBrowser.Model.Dlna } } - if (isEligibleForDirectPlay && mediaSource.SupportsDirectPlay) - { - if (mediaSource.Protocol == MediaProtocol.Http) - { - if (_localPlayer.CanAccessUrl(mediaSource.Path, mediaSource.RequiredHttpHeaders.Count > 0)) - { - return PlayMethod.DirectPlay; - } - } - - else if (mediaSource.Protocol == MediaProtocol.File) - { - if (_localPlayer.CanAccessFile(mediaSource.Path)) - { - return PlayMethod.DirectPlay; - } - } - } - if (isEligibleForDirectStream && mediaSource.SupportsDirectStream) { return PlayMethod.DirectStream; @@ -739,7 +858,7 @@ namespace MediaBrowser.Model.Dlna { if (subtitleStream != null) { - SubtitleProfile subtitleProfile = GetSubtitleProfile(subtitleStream, options.Profile.SubtitleProfiles, options.Context, playMethod); + SubtitleProfile subtitleProfile = GetSubtitleProfile(subtitleStream, options.Profile.SubtitleProfiles, playMethod); if (subtitleProfile.Method != SubtitleDeliveryMethod.External && subtitleProfile.Method != SubtitleDeliveryMethod.Embed) { @@ -751,7 +870,7 @@ namespace MediaBrowser.Model.Dlna return IsAudioEligibleForDirectPlay(item, maxBitrate); } - public static SubtitleProfile GetSubtitleProfile(MediaStream subtitleStream, SubtitleProfile[] subtitleProfiles, EncodingContext context, PlayMethod playMethod) + public static SubtitleProfile GetSubtitleProfile(MediaStream subtitleStream, SubtitleProfile[] subtitleProfiles, PlayMethod playMethod) { if (playMethod != PlayMethod.Transcode && !subtitleStream.IsExternal) { @@ -775,7 +894,16 @@ namespace MediaBrowser.Model.Dlna } } - // Look for an external profile that matches the stream type (text/graphical) + // Look for an external or hls profile that matches the stream type (text/graphical) and doesn't require conversion + return GetExternalSubtitleProfile(subtitleStream, subtitleProfiles, playMethod, false) ?? GetExternalSubtitleProfile(subtitleStream, subtitleProfiles, playMethod, true) ?? new SubtitleProfile + { + Method = SubtitleDeliveryMethod.Encode, + Format = subtitleStream.Codec + }; + } + + private static SubtitleProfile GetExternalSubtitleProfile(MediaStream subtitleStream, SubtitleProfile[] subtitleProfiles, PlayMethod playMethod, bool allowConversion) + { foreach (SubtitleProfile profile in subtitleProfiles) { if (profile.Method != SubtitleDeliveryMethod.External && profile.Method != SubtitleDeliveryMethod.Hls) @@ -798,32 +926,47 @@ namespace MediaBrowser.Model.Dlna { bool requiresConversion = !StringHelper.EqualsIgnoreCase(subtitleStream.Codec, profile.Format); - if (subtitleStream.IsTextSubtitleStream || !requiresConversion) + if (!requiresConversion) { - if (subtitleStream.SupportsExternalStream) - { - return profile; - } + return profile; + } + + if (!allowConversion) + { + continue; + } + + if (subtitleStream.IsTextSubtitleStream && subtitleStream.SupportsExternalStream && subtitleStream.SupportsSubtitleConversionTo(profile.Format)) + { + return profile; } } } - return new SubtitleProfile - { - Method = SubtitleDeliveryMethod.Encode, - Format = subtitleStream.Codec - }; + return null; } private bool IsAudioEligibleForDirectPlay(MediaSourceInfo item, int? maxBitrate) { - if (!maxBitrate.HasValue || (item.Bitrate.HasValue && item.Bitrate.Value <= maxBitrate.Value)) + if (!maxBitrate.HasValue) + { + _logger.Info("Cannot direct play due to unknown supported bitrate"); + return false; + } + + if (!item.Bitrate.HasValue) + { + _logger.Info("Cannot direct play due to unknown content bitrate"); + return false; + } + + if (item.Bitrate.Value > maxBitrate.Value) { - return true; + _logger.Info("Bitrate exceeds DirectPlay limit"); + return false; } - _logger.Info("Bitrate exceeds DirectPlay limit"); - return false; + return true; } private void ValidateInput(VideoOptions options) @@ -898,22 +1041,6 @@ namespace MediaBrowser.Model.Dlna } break; } - case ProfileConditionValue.IsCabac: - { - bool val; - if (BoolHelper.TryParseCultureInvariant(value, out val)) - { - if (condition.Condition == ProfileConditionType.Equals) - { - item.Cabac = val; - } - else if (condition.Condition == ProfileConditionType.NotEquals) - { - item.Cabac = !val; - } - } - break; - } case ProfileConditionValue.IsAnamorphic: case ProfileConditionValue.AudioProfile: case ProfileConditionValue.Has64BitOffsets: @@ -1019,6 +1146,18 @@ namespace MediaBrowser.Model.Dlna } } + // Check audio codec + List<string> audioCodecs = profile.GetAudioCodecs(); + if (audioCodecs.Count > 0) + { + // Check audio codecs + string audioCodec = audioStream == null ? null : audioStream.Codec; + if (string.IsNullOrEmpty(audioCodec) || !ListHelper.ContainsIgnoreCase(audioCodecs, audioCodec)) + { + return false; + } + } + return true; } @@ -1054,6 +1193,7 @@ namespace MediaBrowser.Model.Dlna } } + // Check audio codec List<string> audioCodecs = profile.GetAudioCodecs(); if (audioCodecs.Count > 0) { diff --git a/MediaBrowser.Model/Dlna/StreamInfo.cs b/MediaBrowser.Model/Dlna/StreamInfo.cs index f78047d47..f95c6a070 100644 --- a/MediaBrowser.Model/Dlna/StreamInfo.cs +++ b/MediaBrowser.Model/Dlna/StreamInfo.cs @@ -14,6 +14,11 @@ namespace MediaBrowser.Model.Dlna /// </summary> public class StreamInfo { + public StreamInfo() + { + AudioCodecs = new string[] { }; + } + public string ItemId { get; set; } public PlayMethod PlayMethod { get; set; } @@ -30,14 +35,16 @@ namespace MediaBrowser.Model.Dlna public string VideoCodec { get; set; } public string VideoProfile { get; set; } - public bool? Cabac { get; set; } public bool CopyTimestamps { get; set; } - public string AudioCodec { get; set; } + public bool ForceLiveStream { get; set; } + public bool EnableSubtitlesInManifest { get; set; } + public string[] AudioCodecs { get; set; } public int? AudioStreamIndex { get; set; } public int? SubtitleStreamIndex { get; set; } + public int? TranscodingMaxAudioChannels { get; set; } public int? MaxAudioChannels { get; set; } public int? AudioBitrate { get; set; } @@ -190,12 +197,16 @@ namespace MediaBrowser.Model.Dlna { List<NameValuePair> list = new List<NameValuePair>(); + string audioCodecs = item.AudioCodecs.Length == 0 ? + string.Empty : + string.Join(",", item.AudioCodecs); + list.Add(new NameValuePair("DeviceProfileId", item.DeviceProfileId ?? string.Empty)); list.Add(new NameValuePair("DeviceId", item.DeviceId ?? string.Empty)); list.Add(new NameValuePair("MediaSourceId", item.MediaSourceId ?? string.Empty)); list.Add(new NameValuePair("Static", item.IsDirectStream.ToString().ToLower())); list.Add(new NameValuePair("VideoCodec", item.VideoCodec ?? string.Empty)); - list.Add(new NameValuePair("AudioCodec", item.AudioCodec ?? string.Empty)); + list.Add(new NameValuePair("AudioCodec", audioCodecs)); list.Add(new NameValuePair("AudioStreamIndex", item.AudioStreamIndex.HasValue ? StringHelper.ToStringCultureInvariant(item.AudioStreamIndex.Value) : string.Empty)); list.Add(new NameValuePair("SubtitleStreamIndex", item.SubtitleStreamIndex.HasValue && item.SubtitleDeliveryMethod != SubtitleDeliveryMethod.External ? StringHelper.ToStringCultureInvariant(item.SubtitleStreamIndex.Value) : string.Empty)); list.Add(new NameValuePair("VideoBitrate", item.VideoBitrate.HasValue ? StringHelper.ToStringCultureInvariant(item.VideoBitrate.Value) : string.Empty)); @@ -205,7 +216,7 @@ namespace MediaBrowser.Model.Dlna list.Add(new NameValuePair("MaxWidth", item.MaxWidth.HasValue ? StringHelper.ToStringCultureInvariant(item.MaxWidth.Value) : string.Empty)); list.Add(new NameValuePair("MaxHeight", item.MaxHeight.HasValue ? StringHelper.ToStringCultureInvariant(item.MaxHeight.Value) : string.Empty)); - if (StringHelper.EqualsIgnoreCase(item.SubProtocol, "hls")) + if (StringHelper.EqualsIgnoreCase(item.SubProtocol, "hls") && !item.ForceLiveStream) { list.Add(new NameValuePair("StartTimeTicks", string.Empty)); } @@ -219,7 +230,9 @@ namespace MediaBrowser.Model.Dlna list.Add(new NameValuePair("MaxRefFrames", item.MaxRefFrames.HasValue ? StringHelper.ToStringCultureInvariant(item.MaxRefFrames.Value) : string.Empty)); list.Add(new NameValuePair("MaxVideoBitDepth", item.MaxVideoBitDepth.HasValue ? StringHelper.ToStringCultureInvariant(item.MaxVideoBitDepth.Value) : string.Empty)); list.Add(new NameValuePair("Profile", item.VideoProfile ?? string.Empty)); - list.Add(new NameValuePair("Cabac", item.Cabac.HasValue ? item.Cabac.Value.ToString() : string.Empty)); + + // no longer used + list.Add(new NameValuePair("Cabac", string.Empty)); list.Add(new NameValuePair("PlaySessionId", item.PlaySessionId ?? string.Empty)); list.Add(new NameValuePair("api_key", accessToken ?? string.Empty)); @@ -233,8 +246,12 @@ namespace MediaBrowser.Model.Dlna } list.Add(new NameValuePair("CopyTimestamps", item.CopyTimestamps.ToString().ToLower())); + list.Add(new NameValuePair("ForceLiveStream", item.ForceLiveStream.ToString().ToLower())); list.Add(new NameValuePair("SubtitleMethod", item.SubtitleStreamIndex.HasValue && item.SubtitleDeliveryMethod != SubtitleDeliveryMethod.External ? item.SubtitleDeliveryMethod.ToString() : string.Empty)); - + + list.Add(new NameValuePair("TranscodingMaxAudioChannels", item.TranscodingMaxAudioChannels.HasValue ? StringHelper.ToStringCultureInvariant(item.TranscodingMaxAudioChannels.Value) : string.Empty)); + list.Add(new NameValuePair("EnableSubtitlesInManifest", item.EnableSubtitlesInManifest.ToString().ToLower())); + return list; } @@ -272,7 +289,7 @@ namespace MediaBrowser.Model.Dlna // HLS will preserve timestamps so we can just grab the full subtitle stream long startPositionTicks = StringHelper.EqualsIgnoreCase(SubProtocol, "hls") ? 0 - : (PlayMethod == PlayMethod.Transcode && !CopyTimestamps ? StartPositionTicks : 0); + : (PlayMethod == PlayMethod.Transcode && !CopyTimestamps ? StartPositionTicks : 0); // First add the selected track if (SubtitleStreamIndex.HasValue) @@ -321,7 +338,7 @@ namespace MediaBrowser.Model.Dlna private SubtitleStreamInfo GetSubtitleStreamInfo(MediaStream stream, string baseUrl, string accessToken, long startPositionTicks, SubtitleProfile[] subtitleProfiles) { - SubtitleProfile subtitleProfile = StreamBuilder.GetSubtitleProfile(stream, subtitleProfiles, Context, PlayMethod); + SubtitleProfile subtitleProfile = StreamBuilder.GetSubtitleProfile(stream, subtitleProfiles, PlayMethod); SubtitleStreamInfo info = new SubtitleStreamInfo { IsForced = stream.IsForced, @@ -329,7 +346,8 @@ namespace MediaBrowser.Model.Dlna Name = stream.Language ?? "Unknown", Format = subtitleProfile.Format, Index = stream.Index, - DeliveryMethod = subtitleProfile.Method + DeliveryMethod = subtitleProfile.Method, + DisplayTitle = stream.DisplayTitle }; if (info.DeliveryMethod == SubtitleDeliveryMethod.External) @@ -548,9 +566,22 @@ namespace MediaBrowser.Model.Dlna { MediaStream stream = TargetAudioStream; - return IsDirectStream - ? (stream == null ? null : stream.Codec) - : AudioCodec; + string inputCodec = stream == null ? null : stream.Codec; + + if (IsDirectStream) + { + return inputCodec; + } + + foreach (string codec in AudioCodecs) + { + if (StringHelper.EqualsIgnoreCase(codec, inputCodec)) + { + return codec; + } + } + + return AudioCodecs.Length == 0 ? null : AudioCodecs[0]; } } @@ -632,19 +663,6 @@ namespace MediaBrowser.Model.Dlna } } - public bool? IsTargetCabac - { - get - { - if (IsDirectStream) - { - return TargetVideoStream == null ? null : TargetVideoStream.IsCabac; - } - - return true; - } - } - public int? TargetWidth { get diff --git a/MediaBrowser.Model/Dlna/StreamInfoSorter.cs b/MediaBrowser.Model/Dlna/StreamInfoSorter.cs index 0cccd8080..293054e5b 100644 --- a/MediaBrowser.Model/Dlna/StreamInfoSorter.cs +++ b/MediaBrowser.Model/Dlna/StreamInfoSorter.cs @@ -7,7 +7,7 @@ namespace MediaBrowser.Model.Dlna { public class StreamInfoSorter { - public static List<StreamInfo> SortMediaSources(List<StreamInfo> streams) + public static List<StreamInfo> SortMediaSources(List<StreamInfo> streams, int? maxBitrate) { return streams.OrderBy(i => { @@ -41,6 +41,23 @@ namespace MediaBrowser.Model.Dlna return 1; } + }).ThenBy(i => + { + if (maxBitrate.HasValue) + { + if (i.MediaSource.Bitrate.HasValue) + { + if (i.MediaSource.Bitrate.Value <= maxBitrate.Value) + { + return 0; + } + + return 2; + } + } + + return 1; + }).ToList(); } } diff --git a/MediaBrowser.Model/Dlna/SubtitleStreamInfo.cs b/MediaBrowser.Model/Dlna/SubtitleStreamInfo.cs index 61b2895fc..7a89308dc 100644 --- a/MediaBrowser.Model/Dlna/SubtitleStreamInfo.cs +++ b/MediaBrowser.Model/Dlna/SubtitleStreamInfo.cs @@ -7,6 +7,7 @@ namespace MediaBrowser.Model.Dlna public string Name { get; set; } public bool IsForced { get; set; } public string Format { get; set; } + public string DisplayTitle { get; set; } public int Index { get; set; } public SubtitleDeliveryMethod DeliveryMethod { get; set; } public bool IsExternalUrl { get; set; } diff --git a/MediaBrowser.Model/Dlna/TranscodingProfile.cs b/MediaBrowser.Model/Dlna/TranscodingProfile.cs index e59ee6d63..19caf85eb 100644 --- a/MediaBrowser.Model/Dlna/TranscodingProfile.cs +++ b/MediaBrowser.Model/Dlna/TranscodingProfile.cs @@ -19,7 +19,7 @@ namespace MediaBrowser.Model.Dlna [XmlAttribute("protocol")] public string Protocol { get; set; } - + [XmlAttribute("estimateContentLength")] public bool EstimateContentLength { get; set; } @@ -35,6 +35,15 @@ namespace MediaBrowser.Model.Dlna [XmlAttribute("context")] public EncodingContext Context { get; set; } + [XmlAttribute("forceLiveStream")] + public bool ForceLiveStream { get; set; } + + [XmlAttribute("enableSubtitlesInManifest")] + public bool EnableSubtitlesInManifest { get; set; } + + [XmlAttribute("maxAudioChannels")] + public string MaxAudioChannels { get; set; } + public List<string> GetAudioCodecs() { List<string> list = new List<string>(); diff --git a/MediaBrowser.Model/Dto/BaseItemDto.cs b/MediaBrowser.Model/Dto/BaseItemDto.cs index 7928d0bf9..8ca1dfcb1 100644 --- a/MediaBrowser.Model/Dto/BaseItemDto.cs +++ b/MediaBrowser.Model/Dto/BaseItemDto.cs @@ -18,7 +18,7 @@ namespace MediaBrowser.Model.Dto /// This holds information about a BaseItem in a format that is convenient for the client. /// </summary> [DebuggerDisplay("Name = {Name}, ID = {Id}, Type = {Type}")] - public class BaseItemDto : IHasProviderIds, IHasPropertyChangedEvent, IItemDto, IHasServerId, IHasSyncInfo + public class BaseItemDto : IHasProviderIds, IItemDto, IHasServerId, IHasSyncInfo { /// <summary> /// Gets or sets the name. @@ -26,6 +26,8 @@ namespace MediaBrowser.Model.Dto /// <value>The name.</value> public string Name { get; set; } + public string OriginalTitle { get; set; } + /// <summary> /// Gets or sets the server identifier. /// </summary> @@ -112,6 +114,8 @@ namespace MediaBrowser.Model.Dto /// <value>The synchronize percent.</value> public double? SyncPercent { get; set; } + public string Container { get; set; } + /// <summary> /// Gets or sets the DVD season number. /// </summary> @@ -295,7 +299,8 @@ namespace MediaBrowser.Model.Dto /// </summary> /// <value>The number.</value> public string Number { get; set; } - + public string ChannelNumber { get; set; } + /// <summary> /// Gets or sets the index number. /// </summary> @@ -952,6 +957,16 @@ namespace MediaBrowser.Model.Dto } /// <summary> + /// Gets a value indicating whether this instance has thumb. + /// </summary> + /// <value><c>true</c> if this instance has thumb; otherwise, <c>false</c>.</value> + [IgnoreDataMember] + public bool HasBackdrop + { + get { return (BackdropImageTags != null && BackdropImageTags.Count > 0) || (ParentBackdropImageTags != null && ParentBackdropImageTags.Count > 0); } + } + + /// <summary> /// Gets a value indicating whether this instance has primary image. /// </summary> /// <value><c>true</c> if this instance has primary image; otherwise, <c>false</c>.</value> @@ -1097,11 +1112,6 @@ namespace MediaBrowser.Model.Dto } /// <summary> - /// Occurs when [property changed]. - /// </summary> - public event PropertyChangedEventHandler PropertyChanged; - - /// <summary> /// Gets or sets the program identifier. /// </summary> /// <value>The program identifier.</value> diff --git a/MediaBrowser.Model/Dto/BaseItemPerson.cs b/MediaBrowser.Model/Dto/BaseItemPerson.cs index 8e7750562..b74912907 100644 --- a/MediaBrowser.Model/Dto/BaseItemPerson.cs +++ b/MediaBrowser.Model/Dto/BaseItemPerson.cs @@ -1,5 +1,4 @@ -using MediaBrowser.Model.Extensions; -using System.ComponentModel; +using System.ComponentModel; using System.Diagnostics; using System.Runtime.Serialization; @@ -9,7 +8,7 @@ namespace MediaBrowser.Model.Dto /// This is used by the api to get information about a Person within a BaseItem /// </summary> [DebuggerDisplay("Name = {Name}, Role = {Role}, Type = {Type}")] - public class BaseItemPerson : IHasPropertyChangedEvent + public class BaseItemPerson { /// <summary> /// Gets or sets the name. @@ -53,10 +52,5 @@ namespace MediaBrowser.Model.Dto return PrimaryImageTag != null; } } - - /// <summary> - /// Occurs when [property changed]. - /// </summary> - public event PropertyChangedEventHandler PropertyChanged; } } diff --git a/MediaBrowser.Model/Dto/ChapterInfoDto.cs b/MediaBrowser.Model/Dto/ChapterInfoDto.cs index 62b1839d4..a71d97990 100644 --- a/MediaBrowser.Model/Dto/ChapterInfoDto.cs +++ b/MediaBrowser.Model/Dto/ChapterInfoDto.cs @@ -1,7 +1,5 @@ -using System.ComponentModel; -using System.Diagnostics; +using System.Diagnostics; using System.Runtime.Serialization; -using MediaBrowser.Model.Extensions; namespace MediaBrowser.Model.Dto { @@ -9,7 +7,7 @@ namespace MediaBrowser.Model.Dto /// Class ChapterInfo /// </summary> [DebuggerDisplay("Name = {Name}")] - public class ChapterInfoDto : IHasPropertyChangedEvent + public class ChapterInfoDto { /// <summary> /// Gets or sets the start position ticks. @@ -38,7 +36,5 @@ namespace MediaBrowser.Model.Dto { get { return ImageTag != null; } } - - public event PropertyChangedEventHandler PropertyChanged; } } diff --git a/MediaBrowser.Model/Dto/ItemCounts.cs b/MediaBrowser.Model/Dto/ItemCounts.cs index a3a00c341..07ddfa1ac 100644 --- a/MediaBrowser.Model/Dto/ItemCounts.cs +++ b/MediaBrowser.Model/Dto/ItemCounts.cs @@ -60,5 +60,6 @@ /// </summary> /// <value>The book count.</value> public int BookCount { get; set; } + public int ItemCount { get; set; } } } diff --git a/MediaBrowser.Model/Dto/MediaSourceInfo.cs b/MediaBrowser.Model/Dto/MediaSourceInfo.cs index 2de4aa8ea..4e3e60063 100644 --- a/MediaBrowser.Model/Dto/MediaSourceInfo.cs +++ b/MediaBrowser.Model/Dto/MediaSourceInfo.cs @@ -160,6 +160,16 @@ namespace MediaBrowser.Model.Dto public bool? IsSecondaryAudio(MediaStream stream) { + // Look for the first audio track marked as default + foreach (MediaStream currentStream in MediaStreams) + { + if (currentStream.Type == MediaStreamType.Audio && currentStream.IsDefault) + { + return currentStream.Index != stream.Index; + } + } + + // Look for the first audio track foreach (MediaStream currentStream in MediaStreams) { if (currentStream.Type == MediaStreamType.Audio) diff --git a/MediaBrowser.Model/Dto/UserDto.cs b/MediaBrowser.Model/Dto/UserDto.cs index f133f3343..18470466c 100644 --- a/MediaBrowser.Model/Dto/UserDto.cs +++ b/MediaBrowser.Model/Dto/UserDto.cs @@ -1,6 +1,5 @@ using MediaBrowser.Model.Configuration; using MediaBrowser.Model.Connect; -using MediaBrowser.Model.Extensions; using MediaBrowser.Model.Users; using System; using System.ComponentModel; @@ -13,7 +12,7 @@ namespace MediaBrowser.Model.Dto /// Class UserDto /// </summary> [DebuggerDisplay("Name = {Name}, ID = {Id}, HasPassword = {HasPassword}")] - public class UserDto : IHasPropertyChangedEvent, IItemDto, IHasServerId + public class UserDto : IItemDto, IHasServerId { /// <summary> /// Gets or sets the name. @@ -141,11 +140,6 @@ namespace MediaBrowser.Model.Dto Policy = new UserPolicy(); } - /// <summary> - /// Occurs when [property changed]. - /// </summary> - public event PropertyChangedEventHandler PropertyChanged; - public override string ToString() { return Name ?? base.ToString(); diff --git a/MediaBrowser.Model/Dto/UserItemDataDto.cs b/MediaBrowser.Model/Dto/UserItemDataDto.cs index ce0c8fa99..00491002b 100644 --- a/MediaBrowser.Model/Dto/UserItemDataDto.cs +++ b/MediaBrowser.Model/Dto/UserItemDataDto.cs @@ -1,5 +1,4 @@ -using MediaBrowser.Model.Extensions; -using System; +using System; using System.ComponentModel; namespace MediaBrowser.Model.Dto @@ -7,7 +6,7 @@ namespace MediaBrowser.Model.Dto /// <summary> /// Class UserItemDataDto /// </summary> - public class UserItemDataDto : IHasPropertyChangedEvent + public class UserItemDataDto { /// <summary> /// Gets or sets the rating. @@ -74,7 +73,5 @@ namespace MediaBrowser.Model.Dto /// </summary> /// <value>The item identifier.</value> public string ItemId { get; set; } - - public event PropertyChangedEventHandler PropertyChanged; } } diff --git a/MediaBrowser.Model/Entities/ChapterInfo.cs b/MediaBrowser.Model/Entities/ChapterInfo.cs index 9da7a9caa..7e5700965 100644 --- a/MediaBrowser.Model/Entities/ChapterInfo.cs +++ b/MediaBrowser.Model/Entities/ChapterInfo.cs @@ -1,4 +1,5 @@ - +using System; + namespace MediaBrowser.Model.Entities { /// <summary> @@ -23,5 +24,6 @@ namespace MediaBrowser.Model.Entities /// </summary> /// <value>The image path.</value> public string ImagePath { get; set; } + public DateTime ImageDateModified { get; set; } } } diff --git a/MediaBrowser.Model/Entities/DisplayPreferences.cs b/MediaBrowser.Model/Entities/DisplayPreferences.cs index 6399670c9..0ba8eaa4f 100644 --- a/MediaBrowser.Model/Entities/DisplayPreferences.cs +++ b/MediaBrowser.Model/Entities/DisplayPreferences.cs @@ -1,22 +1,15 @@ using MediaBrowser.Model.Drawing; using System; using System.Collections.Generic; -using System.ComponentModel; -using MediaBrowser.Model.Extensions; namespace MediaBrowser.Model.Entities { /// <summary> /// Defines the display preferences for any item that supports them (usually Folders) /// </summary> - public class DisplayPreferences : IHasPropertyChangedEvent + public class DisplayPreferences { /// <summary> - /// Occurs when [property changed]. - /// </summary> - public event PropertyChangedEventHandler PropertyChanged; - - /// <summary> /// The image scale /// </summary> private const double ImageScale = .9; diff --git a/MediaBrowser.Model/Entities/ImageType.cs b/MediaBrowser.Model/Entities/ImageType.cs index 18097abb4..6e0ba717f 100644 --- a/MediaBrowser.Model/Entities/ImageType.cs +++ b/MediaBrowser.Model/Entities/ImageType.cs @@ -9,50 +9,50 @@ namespace MediaBrowser.Model.Entities /// <summary> /// The primary /// </summary> - Primary, + Primary = 0, /// <summary> /// The art /// </summary> - Art, + Art = 1, /// <summary> /// The backdrop /// </summary> - Backdrop, + Backdrop = 2, /// <summary> /// The banner /// </summary> - Banner, + Banner = 3, /// <summary> /// The logo /// </summary> - Logo, + Logo = 4, /// <summary> /// The thumb /// </summary> - Thumb, + Thumb = 5, /// <summary> /// The disc /// </summary> - Disc, + Disc = 6, /// <summary> /// The box /// </summary> - Box, + Box = 7, /// <summary> /// The screenshot /// </summary> - Screenshot, + Screenshot = 8, /// <summary> /// The menu /// </summary> - Menu, + Menu = 9, /// <summary> /// The chapter image /// </summary> - Chapter, + Chapter = 10, /// <summary> /// The box rear /// </summary> - BoxRear + BoxRear = 11 } } diff --git a/MediaBrowser.Model/Entities/MediaStream.cs b/MediaBrowser.Model/Entities/MediaStream.cs index 79fa46baf..990de332e 100644 --- a/MediaBrowser.Model/Entities/MediaStream.cs +++ b/MediaBrowser.Model/Entities/MediaStream.cs @@ -1,6 +1,8 @@ -using MediaBrowser.Model.Dlna; +using System.Collections.Generic; +using MediaBrowser.Model.Dlna; using MediaBrowser.Model.Extensions; using System.Diagnostics; +using MediaBrowser.Model.MediaInfo; namespace MediaBrowser.Model.Entities { @@ -33,13 +35,96 @@ namespace MediaBrowser.Model.Entities /// </summary> /// <value>The comment.</value> public string Comment { get; set; } - + + public string TimeBase { get; set; } + public string CodecTimeBase { get; set; } + + public string Title { get; set; } + + public string DisplayTitle + { + get + { + if (!string.IsNullOrEmpty(Title)) + { + return Title; + } + + if (Type == MediaStreamType.Audio) + { + List<string> attributes = new List<string>(); + + if (!string.IsNullOrEmpty(Language)) + { + attributes.Add(StringHelper.FirstToUpper(Language)); + } + if (!string.IsNullOrEmpty(Codec) && !StringHelper.EqualsIgnoreCase(Codec, "dca")) + { + attributes.Add(AudioCodec.GetFriendlyName(Codec)); + } + else if (!string.IsNullOrEmpty(Profile) && !StringHelper.EqualsIgnoreCase(Profile, "lc")) + { + attributes.Add(Profile); + } + + if (!string.IsNullOrEmpty(ChannelLayout)) + { + attributes.Add(ChannelLayout); + } + else if (Channels.HasValue) + { + attributes.Add(StringHelper.ToStringCultureInvariant(Channels.Value) + " ch"); + } + if (IsDefault) + { + attributes.Add("Default"); + } + + return string.Join(" ", attributes.ToArray()); + } + + if (Type == MediaStreamType.Subtitle) + { + List<string> attributes = new List<string>(); + + if (!string.IsNullOrEmpty(Language)) + { + attributes.Add(StringHelper.FirstToUpper(Language)); + } + if (IsDefault) + { + attributes.Add("Default"); + } + + if (IsForced) + { + attributes.Add("Forced"); + } + + string name = string.Join(" ", attributes.ToArray()); + + return name; + } + + if (Type == MediaStreamType.Video) + { + + } + + return null; + } + } + + public string NalLengthSize { get; set; } + /// <summary> /// Gets or sets a value indicating whether this instance is interlaced. /// </summary> /// <value><c>true</c> if this instance is interlaced; otherwise, <c>false</c>.</value> public bool IsInterlaced { get; set; } + public bool? IsAVC { get; set; } + /// <summary> /// Gets or sets the channel layout. /// </summary> @@ -197,6 +282,36 @@ namespace MediaBrowser.Model.Entities !StringHelper.EqualsIgnoreCase(codec, "sub"); } + public bool SupportsSubtitleConversionTo(string codec) + { + if (!IsTextSubtitleStream) + { + return false; + } + + // Can't convert from this + if (StringHelper.EqualsIgnoreCase(Codec, "ass")) + { + return false; + } + if (StringHelper.EqualsIgnoreCase(Codec, "ssa")) + { + return false; + } + + // Can't convert to this + if (StringHelper.EqualsIgnoreCase(codec, "ass")) + { + return false; + } + if (StringHelper.EqualsIgnoreCase(codec, "ssa")) + { + return false; + } + + return true; + } + /// <summary> /// Gets or sets a value indicating whether [supports external stream]. /// </summary> @@ -232,11 +347,5 @@ namespace MediaBrowser.Model.Entities /// </summary> /// <value><c>true</c> if this instance is anamorphic; otherwise, <c>false</c>.</value> public bool? IsAnamorphic { get; set; } - - /// <summary> - /// Gets or sets a value indicating whether this instance is cabac. - /// </summary> - /// <value><c>null</c> if [is cabac] contains no value, <c>true</c> if [is cabac]; otherwise, <c>false</c>.</value> - public bool? IsCabac { get; set; } } } diff --git a/MediaBrowser.Model/Entities/MediaUrl.cs b/MediaBrowser.Model/Entities/MediaUrl.cs index 24e3b1492..2e17bba8a 100644 --- a/MediaBrowser.Model/Entities/MediaUrl.cs +++ b/MediaBrowser.Model/Entities/MediaUrl.cs @@ -5,6 +5,5 @@ namespace MediaBrowser.Model.Entities { public string Url { get; set; } public string Name { get; set; } - public VideoSize? VideoSize { get; set; } } } diff --git a/MediaBrowser.Model/Entities/VideoSize.cs b/MediaBrowser.Model/Entities/VideoSize.cs deleted file mode 100644 index 0100f3b90..000000000 --- a/MediaBrowser.Model/Entities/VideoSize.cs +++ /dev/null @@ -1,8 +0,0 @@ -namespace MediaBrowser.Model.Entities -{ - public enum VideoSize - { - StandardDefinition, - HighDefinition - } -}
\ No newline at end of file diff --git a/MediaBrowser.Model/Extensions/IHasPropertyChangedEvent.cs b/MediaBrowser.Model/Extensions/IHasPropertyChangedEvent.cs deleted file mode 100644 index c87550620..000000000 --- a/MediaBrowser.Model/Extensions/IHasPropertyChangedEvent.cs +++ /dev/null @@ -1,8 +0,0 @@ -using System.ComponentModel; - -namespace MediaBrowser.Model.Extensions -{ - public interface IHasPropertyChangedEvent : INotifyPropertyChanged - { - } -} diff --git a/MediaBrowser.Model/Extensions/StringHelper.cs b/MediaBrowser.Model/Extensions/StringHelper.cs index 99bec68a7..9cde3bfa4 100644 --- a/MediaBrowser.Model/Extensions/StringHelper.cs +++ b/MediaBrowser.Model/Extensions/StringHelper.cs @@ -125,5 +125,10 @@ namespace MediaBrowser.Model.Extensions return sb.ToString(); } + + public static string FirstToUpper(this string str) + { + return string.IsNullOrEmpty(str) ? "" : str.Substring(0, 1).ToUpper() + str.Substring(1); + } } } diff --git a/MediaBrowser.Model/Games/GameSystem.cs b/MediaBrowser.Model/Games/GameSystem.cs deleted file mode 100644 index ab8f1efa7..000000000 --- a/MediaBrowser.Model/Games/GameSystem.cs +++ /dev/null @@ -1,48 +0,0 @@ - -namespace MediaBrowser.Model.Games -{ - public class GameSystem - { - public const string Nintendo = "Nintendo"; - public const string SuperNintendo = "Super Nintendo"; - public const string Panasonic3DO = "3DO"; - public const string Amiga = "Amiga"; - public const string Arcade = "Arcade"; - public const string Atari2600 = "Atari 2600"; - public const string Atari5200 = "Atari 5200"; - public const string Atari7800 = "Atari 7800"; - public const string AtariXE = "Atari XE"; - public const string AtariJaguar = "Atari Jaguar"; - public const string AtariJaguarCD = "Atari Jaguar CD"; - public const string Colecovision = "Colecovision"; - public const string Commodore64 = "Commodore 64"; - public const string CommodoreVic20 = "Commodore Vic-20"; - public const string Intellivision = "Intellivision"; - public const string MicrosoftXBox = "Xbox"; - public const string NeoGeo = "Neo Geo"; - public const string Nintendo64 = "Nintendo 64"; - public const string NintendoDS = "Nintendo DS"; - public const string NintendoGameBoy = "Game Boy"; - public const string NintendoGameBoyAdvance = "Game Boy Advance"; - public const string NintendoGameBoyColor = "Game Boy Color"; - public const string NintendoGameCube = "Gamecube"; - public const string VirtualBoy = "Virtual Boy"; - public const string Wii = "Nintendo Wii"; - public const string DOS = "DOS"; - public const string Windows = "Windows"; - public const string Sega32X = "Sega 32X"; - public const string SegaCD = "Sega CD"; - public const string SegaDreamcast = "Dreamcast"; - public const string SegaGameGear = "Game Gear"; - public const string SegaGenesis = "Sega Genesis"; - public const string SegaMasterSystem = "Sega Master System"; - public const string SegaMegaDrive = "Sega Mega Drive"; - public const string SegaSaturn = "Sega Saturn"; - public const string SonyPlaystation = "Sony Playstation"; - public const string SonyPlaystation2 = "PS2"; - public const string SonyPSP = "PSP"; - public const string TurboGrafx16 = "TurboGrafx 16"; - public const string TurboGrafxCD = "TurboGrafx CD"; - public const string ZxSpectrum = "ZX Spectrum"; - } -} diff --git a/MediaBrowser.Model/LiveTv/BaseTimerInfoDto.cs b/MediaBrowser.Model/LiveTv/BaseTimerInfoDto.cs index 296ead5c2..4d863c6eb 100644 --- a/MediaBrowser.Model/LiveTv/BaseTimerInfoDto.cs +++ b/MediaBrowser.Model/LiveTv/BaseTimerInfoDto.cs @@ -1,18 +1,11 @@ using MediaBrowser.Model.Dto; -using MediaBrowser.Model.Extensions; using System; -using System.ComponentModel; namespace MediaBrowser.Model.LiveTv { - public class BaseTimerInfoDto : IHasPropertyChangedEvent, IHasServerId + public class BaseTimerInfoDto : IHasServerId { /// <summary> - /// Occurs when a property value changes. - /// </summary> - public event PropertyChangedEventHandler PropertyChanged; - - /// <summary> /// Id of the recording. /// </summary> public string Id { get; set; } diff --git a/MediaBrowser.Model/LiveTv/ChannelInfoDto.cs b/MediaBrowser.Model/LiveTv/ChannelInfoDto.cs index 91493def8..aa91e3c74 100644 --- a/MediaBrowser.Model/LiveTv/ChannelInfoDto.cs +++ b/MediaBrowser.Model/LiveTv/ChannelInfoDto.cs @@ -1,6 +1,5 @@ using MediaBrowser.Model.Dto; using MediaBrowser.Model.Entities; -using MediaBrowser.Model.Extensions; using MediaBrowser.Model.Library; using System.Collections.Generic; using System.ComponentModel; @@ -13,7 +12,7 @@ namespace MediaBrowser.Model.LiveTv /// Class ChannelInfoDto /// </summary> [DebuggerDisplay("Name = {Name}, Number = {Number}")] - public class ChannelInfoDto : IHasPropertyChangedEvent, IItemDto, IHasServerId + public class ChannelInfoDto : IItemDto, IHasServerId { /// <summary> /// Gets or sets the name. @@ -120,7 +119,5 @@ namespace MediaBrowser.Model.LiveTv ImageTags = new Dictionary<ImageType, string>(); MediaSources = new List<MediaSourceInfo>(); } - - public event PropertyChangedEventHandler PropertyChanged; } } diff --git a/MediaBrowser.Model/LiveTv/LiveTvOptions.cs b/MediaBrowser.Model/LiveTv/LiveTvOptions.cs index 71f87ac3a..242a2d24e 100644 --- a/MediaBrowser.Model/LiveTv/LiveTvOptions.cs +++ b/MediaBrowser.Model/LiveTv/LiveTvOptions.cs @@ -1,4 +1,6 @@ using System.Collections.Generic; +using MediaBrowser.Model.Dto; +using MediaBrowser.Model.Extensions; namespace MediaBrowser.Model.LiveTv { @@ -7,8 +9,12 @@ namespace MediaBrowser.Model.LiveTv public int? GuideDays { get; set; } public bool EnableMovieProviders { get; set; } public string RecordingPath { get; set; } + public string MovieRecordingPath { get; set; } + public string SeriesRecordingPath { get; set; } public bool EnableAutoOrganize { get; set; } public bool EnableRecordingEncoding { get; set; } + public bool EnableRecordingSubfolders { get; set; } + public bool EnableOriginalAudioWithEncodedRecordings { get; set; } public List<TunerHostInfo> TunerHosts { get; set; } public List<ListingsProviderInfo> ListingProviders { get; set; } @@ -16,11 +22,15 @@ namespace MediaBrowser.Model.LiveTv public int PrePaddingSeconds { get; set; } public int PostPaddingSeconds { get; set; } + public string[] MediaLocationsCreated { get; set; } + public LiveTvOptions() { EnableMovieProviders = true; + EnableRecordingSubfolders = true; TunerHosts = new List<TunerHostInfo>(); ListingProviders = new List<ListingsProviderInfo>(); + MediaLocationsCreated = new string[] { }; } } @@ -31,18 +41,24 @@ namespace MediaBrowser.Model.LiveTv public string Type { get; set; } public string DeviceId { get; set; } public bool ImportFavoritesOnly { get; set; } + public bool AllowHWTranscoding { get; set; } public bool IsEnabled { get; set; } public string M3UUrl { get; set; } public string InfoUrl { get; set; } public string FriendlyName { get; set; } public int Tuners { get; set; } public string DiseqC { get; set; } + public string SourceA { get; set; } + public string SourceB { get; set; } + public string SourceC { get; set; } + public string SourceD { get; set; } public int DataVersion { get; set; } public TunerHostInfo() { IsEnabled = true; + AllowHWTranscoding = true; } } @@ -59,11 +75,33 @@ namespace MediaBrowser.Model.LiveTv public string[] EnabledTuners { get; set; } public bool EnableAllTuners { get; set; } + public string[] NewsCategories { get; set; } + public string[] SportsCategories { get; set; } + public string[] KidsCategories { get; set; } + public string[] MovieCategories { get; set; } + public NameValuePair[] ChannelMappings { get; set; } public ListingsProviderInfo() { + NewsCategories = new string[] { "news", "journalism", "documentary", "current affairs" }; + SportsCategories = new string[] { "sports", "basketball", "baseball", "football" }; + KidsCategories = new string[] { "kids", "family", "children", "childrens", "disney" }; + MovieCategories = new string[] { "movie" }; EnabledTuners = new string[] { }; 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; } } -}
\ No newline at end of file +} diff --git a/MediaBrowser.Model/LiveTv/ProgramQuery.cs b/MediaBrowser.Model/LiveTv/ProgramQuery.cs index 7a877e356..0141191c1 100644 --- a/MediaBrowser.Model/LiveTv/ProgramQuery.cs +++ b/MediaBrowser.Model/LiveTv/ProgramQuery.cs @@ -14,8 +14,11 @@ namespace MediaBrowser.Model.LiveTv ChannelIds = new string[] { }; SortBy = new string[] { }; Genres = new string[] { }; + EnableTotalRecordCount = true; } + public bool EnableTotalRecordCount { get; set; } + /// <summary> /// Fields to return within the items, in addition to basic information /// </summary> diff --git a/MediaBrowser.Model/LiveTv/RecommendedProgramQuery.cs b/MediaBrowser.Model/LiveTv/RecommendedProgramQuery.cs index e83a8fda6..0e6d081a1 100644 --- a/MediaBrowser.Model/LiveTv/RecommendedProgramQuery.cs +++ b/MediaBrowser.Model/LiveTv/RecommendedProgramQuery.cs @@ -13,7 +13,14 @@ namespace MediaBrowser.Model.LiveTv public bool? EnableImages { get; set; } public int? ImageTypeLimit { get; set; } public ImageType[] EnableImageTypes { get; set; } - + + public bool EnableTotalRecordCount { get; set; } + + public RecommendedProgramQuery() + { + EnableTotalRecordCount = true; + } + /// <summary> /// Gets or sets the user identifier. /// </summary> diff --git a/MediaBrowser.Model/LiveTv/RecordingQuery.cs b/MediaBrowser.Model/LiveTv/RecordingQuery.cs index 0cf997602..923d303f8 100644 --- a/MediaBrowser.Model/LiveTv/RecordingQuery.cs +++ b/MediaBrowser.Model/LiveTv/RecordingQuery.cs @@ -70,5 +70,12 @@ namespace MediaBrowser.Model.LiveTv public bool? EnableImages { get; set; } public int? ImageTypeLimit { get; set; } public ImageType[] EnableImageTypes { get; set; } + + public bool EnableTotalRecordCount { get; set; } + + public RecordingQuery() + { + EnableTotalRecordCount = true; + } } } diff --git a/MediaBrowser.Model/LiveTv/TimerInfoDto.cs b/MediaBrowser.Model/LiveTv/TimerInfoDto.cs index c33535a3d..a95678fae 100644 --- a/MediaBrowser.Model/LiveTv/TimerInfoDto.cs +++ b/MediaBrowser.Model/LiveTv/TimerInfoDto.cs @@ -4,6 +4,11 @@ namespace MediaBrowser.Model.LiveTv { public class TimerInfoDto : BaseTimerInfoDto { + public TimerInfoDto() + { + Type = "Timer"; + } + /// <summary> /// Gets or sets the status. /// </summary> @@ -22,6 +27,8 @@ namespace MediaBrowser.Model.LiveTv /// <value>The external series timer identifier.</value> public string ExternalSeriesTimerId { get; set; } + public string Type { get; set; } + /// <summary> /// Gets or sets the run time ticks. /// </summary> diff --git a/MediaBrowser.Model/LiveTv/TimerQuery.cs b/MediaBrowser.Model/LiveTv/TimerQuery.cs index e6ceff530..87b6b89ac 100644 --- a/MediaBrowser.Model/LiveTv/TimerQuery.cs +++ b/MediaBrowser.Model/LiveTv/TimerQuery.cs @@ -13,5 +13,7 @@ /// </summary> /// <value>The series timer identifier.</value> public string SeriesTimerId { get; set; } + + public bool? IsActive { get; set; } } }
\ No newline at end of file diff --git a/MediaBrowser.Model/MediaBrowser.Model.csproj b/MediaBrowser.Model/MediaBrowser.Model.csproj index 41952963c..e3c1e52a5 100644 --- a/MediaBrowser.Model/MediaBrowser.Model.csproj +++ b/MediaBrowser.Model/MediaBrowser.Model.csproj @@ -97,8 +97,6 @@ <Compile Include="Configuration\FanartOptions.cs" /> <Compile Include="Configuration\MetadataConfiguration.cs" /> <Compile Include="Configuration\PeopleMetadataOptions.cs" /> - <Compile Include="Configuration\TheMovieDbOptions.cs" /> - <Compile Include="Configuration\TvdbOptions.cs" /> <Compile Include="Configuration\XbmcMetadataOptions.cs" /> <Compile Include="Configuration\SubtitlePlaybackMode.cs" /> <Compile Include="Connect\ConnectAuthenticationExchangeResult.cs" /> @@ -120,9 +118,8 @@ <Compile Include="Devices\DeviceInfo.cs" /> <Compile Include="Devices\DevicesOptions.cs" /> <Compile Include="Dlna\EncodingContext.cs" /> - <Compile Include="Dlna\ILocalPlayer.cs" /> + <Compile Include="Dlna\ITranscoderSupport.cs" /> <Compile Include="Dlna\StreamInfoSorter.cs" /> - <Compile Include="Dlna\NullLocalPlayer.cs" /> <Compile Include="Dlna\PlaybackErrorCode.cs" /> <Compile Include="Dlna\PlaybackException.cs" /> <Compile Include="Dlna\ResolutionConfiguration.cs" /> @@ -229,10 +226,8 @@ <Compile Include="Entities\ProviderIdsExtensions.cs" /> <Compile Include="Entities\ScrollDirection.cs" /> <Compile Include="Entities\SortOrder.cs" /> - <Compile Include="Entities\VideoSize.cs" /> <Compile Include="Events\GenericEventArgs.cs" /> <Compile Include="Extensions\DoubleHelper.cs" /> - <Compile Include="Extensions\IHasPropertyChangedEvent.cs" /> <Compile Include="Extensions\IntHelper.cs" /> <Compile Include="Extensions\ListHelper.cs" /> <Compile Include="Extensions\StringHelper.cs" /> @@ -287,7 +282,6 @@ <Compile Include="Entities\MetadataFields.cs" /> <Compile Include="Entities\UserDataSaveReason.cs" /> <Compile Include="Entities\Video3DFormat.cs" /> - <Compile Include="Games\GameSystem.cs" /> <Compile Include="IO\IIsoManager.cs" /> <Compile Include="IO\IIsoMount.cs" /> <Compile Include="IO\IIsoMounter.cs" /> @@ -399,6 +393,7 @@ <Compile Include="Sync\SyncProfileOption.cs" /> <Compile Include="Sync\SyncQualityOption.cs" /> <Compile Include="Sync\SyncTarget.cs" /> + <Compile Include="System\Architecture.cs" /> <Compile Include="System\LogFile.cs" /> <Compile Include="System\PublicSystemInfo.cs" /> <Compile Include="Updates\CheckForUpdateResult.cs" /> diff --git a/MediaBrowser.Model/MediaInfo/AudioCodec.cs b/MediaBrowser.Model/MediaInfo/AudioCodec.cs index 5353f2b3e..93aba2f43 100644 --- a/MediaBrowser.Model/MediaInfo/AudioCodec.cs +++ b/MediaBrowser.Model/MediaInfo/AudioCodec.cs @@ -5,5 +5,22 @@ public const string AAC = "aac"; public const string MP3 = "mp3"; public const string AC3 = "ac3"; + + public static string GetFriendlyName(string codec) + { + if (string.IsNullOrEmpty(codec)) return ""; + + switch (codec.ToLower()) + { + case "ac3": + return "Dolby Digital"; + case "eac3": + return "Dolby Digital+"; + case "dca": + return "DTS"; + default: + return codec.ToUpper(); + } + } } }
\ No newline at end of file diff --git a/MediaBrowser.Model/Providers/SubtitleOptions.cs b/MediaBrowser.Model/Providers/SubtitleOptions.cs index 2b15c0e1f..5587e897f 100644 --- a/MediaBrowser.Model/Providers/SubtitleOptions.cs +++ b/MediaBrowser.Model/Providers/SubtitleOptions.cs @@ -12,11 +12,14 @@ namespace MediaBrowser.Model.Providers public string OpenSubtitlesPasswordHash { get; set; } public bool IsOpenSubtitleVipAccount { get; set; } + public bool RequirePerfectMatch { get; set; } + public SubtitleOptions() { DownloadLanguages = new string[] { }; SkipIfAudioTrackMatches = true; + RequirePerfectMatch = true; } } }
\ No newline at end of file diff --git a/MediaBrowser.Model/Querying/ItemFields.cs b/MediaBrowser.Model/Querying/ItemFields.cs index 1540f178a..21f87247a 100644 --- a/MediaBrowser.Model/Querying/ItemFields.cs +++ b/MediaBrowser.Model/Querying/ItemFields.cs @@ -130,6 +130,8 @@ /// </summary> Metascore, + OriginalTitle, + /// <summary> /// The item overview /// </summary> @@ -195,6 +197,8 @@ /// </summary> SeriesGenres, + SeriesPrimaryImage, + /// <summary> /// The series studio /// </summary> diff --git a/MediaBrowser.Model/Querying/ItemQuery.cs b/MediaBrowser.Model/Querying/ItemQuery.cs index 5a88c0d43..11c046452 100644 --- a/MediaBrowser.Model/Querying/ItemQuery.cs +++ b/MediaBrowser.Model/Querying/ItemQuery.cs @@ -288,6 +288,8 @@ namespace MediaBrowser.Model.Querying [Obsolete] public string Person { get; set; } + public bool EnableTotalRecordCount { get; set; } + /// <summary> /// Initializes a new instance of the <see cref="ItemQuery" /> class. /// </summary> @@ -306,6 +308,8 @@ namespace MediaBrowser.Model.Querying VideoTypes = new VideoType[] { }; + EnableTotalRecordCount = true; + Artists = new string[] { }; Studios = new string[] { }; diff --git a/MediaBrowser.Model/Querying/ItemSortBy.cs b/MediaBrowser.Model/Querying/ItemSortBy.cs index 9c2926b54..6f4ebd0c5 100644 --- a/MediaBrowser.Model/Querying/ItemSortBy.cs +++ b/MediaBrowser.Model/Querying/ItemSortBy.cs @@ -85,5 +85,6 @@ namespace MediaBrowser.Model.Querying public const string GameSystem = "GameSystem"; public const string IsFavoriteOrLiked = "IsFavoriteOrLiked"; public const string DateLastContentAdded = "DateLastContentAdded"; + public const string SeriesDatePlayed = "SeriesDatePlayed"; } } diff --git a/MediaBrowser.Model/Session/SessionInfoDto.cs b/MediaBrowser.Model/Session/SessionInfoDto.cs index da8ab9b8a..5c3c9a79c 100644 --- a/MediaBrowser.Model/Session/SessionInfoDto.cs +++ b/MediaBrowser.Model/Session/SessionInfoDto.cs @@ -1,5 +1,4 @@ using MediaBrowser.Model.Entities; -using MediaBrowser.Model.Extensions; using System; using System.Collections.Generic; using System.ComponentModel; @@ -8,7 +7,7 @@ using System.Diagnostics; namespace MediaBrowser.Model.Session { [DebuggerDisplay("Client = {Client}, Username = {UserName}")] - public class SessionInfoDto : IHasPropertyChangedEvent + public class SessionInfoDto { /// <summary> /// Gets or sets the supported commands. @@ -116,8 +115,6 @@ namespace MediaBrowser.Model.Session public TranscodingInfo TranscodingInfo { get; set; } - public event PropertyChangedEventHandler PropertyChanged; - public SessionInfoDto() { AdditionalUsers = new List<SessionUserInfo>(); diff --git a/MediaBrowser.Model/Sync/SyncJobItem.cs b/MediaBrowser.Model/Sync/SyncJobItem.cs index 77464be58..1c72ccd52 100644 --- a/MediaBrowser.Model/Sync/SyncJobItem.cs +++ b/MediaBrowser.Model/Sync/SyncJobItem.cs @@ -102,6 +102,8 @@ namespace MediaBrowser.Model.Sync /// <value>The index of the job item.</value> public int JobItemIndex { get; set; } + public long ItemDateModifiedTicks { get; set; } + public SyncJobItem() { AdditionalFiles = new List<ItemFileInfo>(); diff --git a/MediaBrowser.Model/System/Architecture.cs b/MediaBrowser.Model/System/Architecture.cs new file mode 100644 index 000000000..09eedddc1 --- /dev/null +++ b/MediaBrowser.Model/System/Architecture.cs @@ -0,0 +1,9 @@ +namespace MediaBrowser.Model.System +{ + public enum Architecture + { + X86 = 0, + X64 = 1, + Arm = 2 + } +} diff --git a/MediaBrowser.Model/System/SystemInfo.cs b/MediaBrowser.Model/System/SystemInfo.cs index 6b54a90d4..3d1de5b37 100644 --- a/MediaBrowser.Model/System/SystemInfo.cs +++ b/MediaBrowser.Model/System/SystemInfo.cs @@ -152,6 +152,10 @@ namespace MediaBrowser.Model.System /// <value><c>true</c> if [supports automatic run at startup]; otherwise, <c>false</c>.</value> public bool SupportsAutoRunAtStartup { get; set; } + public string EncoderLocationType { get; set; } + + public Architecture SystemArchitecture { get; set; } + /// <summary> /// Initializes a new instance of the <see cref="SystemInfo" /> class. /// </summary> diff --git a/MediaBrowser.Model/Updates/PackageVersionInfo.cs b/MediaBrowser.Model/Updates/PackageVersionInfo.cs index b9bf6e7fe..22404b6f6 100644 --- a/MediaBrowser.Model/Updates/PackageVersionInfo.cs +++ b/MediaBrowser.Model/Updates/PackageVersionInfo.cs @@ -87,5 +87,7 @@ namespace MediaBrowser.Model.Updates /// </summary> /// <value>The target filename.</value> public string targetFilename { get; set; } + + public string infoUrl { get; set; } } }
\ No newline at end of file |
