diff options
Diffstat (limited to 'MediaBrowser.Controller')
12 files changed, 71 insertions, 54 deletions
diff --git a/MediaBrowser.Controller/Entities/AggregateFolder.cs b/MediaBrowser.Controller/Entities/AggregateFolder.cs index a6b9d860a..a1de23c93 100644 --- a/MediaBrowser.Controller/Entities/AggregateFolder.cs +++ b/MediaBrowser.Controller/Entities/AggregateFolder.cs @@ -27,6 +27,7 @@ namespace MediaBrowser.Controller.Entities /// <summary> /// We don't support manual shortcuts /// </summary> + [IgnoreDataMember] protected override bool SupportsShortcutChildren { get diff --git a/MediaBrowser.Controller/Entities/BaseItem.cs b/MediaBrowser.Controller/Entities/BaseItem.cs index 52e150aa4..c8ea4c506 100644 --- a/MediaBrowser.Controller/Entities/BaseItem.cs +++ b/MediaBrowser.Controller/Entities/BaseItem.cs @@ -1926,8 +1926,7 @@ namespace MediaBrowser.Controller.Entities .Where(i => i.IsLocalFile) .Select(i => System.IO.Path.GetDirectoryName(i.Path)) .Distinct(StringComparer.OrdinalIgnoreCase) - .SelectMany(directoryService.GetFiles) - .Select(i => i.FullName) + .SelectMany(directoryService.GetFilePaths) .ToList(); var deletedImages = ImageInfos @@ -2100,8 +2099,8 @@ namespace MediaBrowser.Controller.Entities var extensions = new[] { ".nfo", ".xml", ".srt" }.ToList(); extensions.AddRange(SupportedImageExtensionsList); - return FileSystem.GetFiles(System.IO.Path.GetDirectoryName(Path)) - .Where(i => extensions.Contains(i.Extension, StringComparer.OrdinalIgnoreCase) && System.IO.Path.GetFileNameWithoutExtension(i.FullName).StartsWith(filename, StringComparison.OrdinalIgnoreCase)) + return FileSystem.GetFiles(System.IO.Path.GetDirectoryName(Path), extensions.ToArray(), false, false) + .Where(i => System.IO.Path.GetFileNameWithoutExtension(i.FullName).StartsWith(filename, StringComparison.OrdinalIgnoreCase)) .ToList(); } diff --git a/MediaBrowser.Controller/Entities/Folder.cs b/MediaBrowser.Controller/Entities/Folder.cs index a323a2439..be41d896d 100644 --- a/MediaBrowser.Controller/Entities/Folder.cs +++ b/MediaBrowser.Controller/Entities/Folder.cs @@ -761,11 +761,6 @@ namespace MediaBrowser.Controller.Entities Logger.Debug("Query requires post-filtering due to ItemSortBy.GameSystem"); return true; } - if (query.SortBy.Contains(ItemSortBy.Metascore, StringComparer.OrdinalIgnoreCase)) - { - Logger.Debug("Query requires post-filtering due to ItemSortBy.Metascore"); - return true; - } if (query.SortBy.Contains(ItemSortBy.Players, StringComparer.OrdinalIgnoreCase)) { Logger.Debug("Query requires post-filtering due to ItemSortBy.Players"); @@ -778,12 +773,6 @@ namespace MediaBrowser.Controller.Entities } } - if (query.ItemIds.Length > 0) - { - Logger.Debug("Query requires post-filtering due to ItemIds"); - return true; - } - if (query.IsInBoxSet.HasValue) { Logger.Debug("Query requires post-filtering due to IsInBoxSet"); diff --git a/MediaBrowser.Controller/Entities/IHasMetascore.cs b/MediaBrowser.Controller/Entities/IHasMetascore.cs deleted file mode 100644 index a3445bbba..000000000 --- a/MediaBrowser.Controller/Entities/IHasMetascore.cs +++ /dev/null @@ -1,15 +0,0 @@ - -namespace MediaBrowser.Controller.Entities -{ - /// <summary> - /// Interface IHasMetascore - /// </summary> - public interface IHasMetascore - { - /// <summary> - /// Gets or sets the metascore. - /// </summary> - /// <value>The metascore.</value> - float? Metascore { get; set; } - } -} diff --git a/MediaBrowser.Controller/Entities/Movies/Movie.cs b/MediaBrowser.Controller/Entities/Movies/Movie.cs index dfa9ac416..ce671a2dc 100644 --- a/MediaBrowser.Controller/Entities/Movies/Movie.cs +++ b/MediaBrowser.Controller/Entities/Movies/Movie.cs @@ -17,7 +17,7 @@ namespace MediaBrowser.Controller.Entities.Movies /// <summary> /// Class Movie /// </summary> - public class Movie : Video, IHasSpecialFeatures, IHasTrailers, IHasAwards, IHasMetascore, IHasLookupInfo<MovieInfo>, ISupportsBoxSetGrouping + public class Movie : Video, IHasSpecialFeatures, IHasTrailers, IHasAwards, IHasLookupInfo<MovieInfo>, ISupportsBoxSetGrouping { public List<Guid> SpecialFeatureIds { get; set; } diff --git a/MediaBrowser.Controller/Library/IUserManager.cs b/MediaBrowser.Controller/Library/IUserManager.cs index a167cdbed..ef68d2560 100644 --- a/MediaBrowser.Controller/Library/IUserManager.cs +++ b/MediaBrowser.Controller/Library/IUserManager.cs @@ -66,7 +66,7 @@ namespace MediaBrowser.Controller.Library /// <param name="remoteEndPoint">The remote end point.</param> /// <returns>Task{System.Boolean}.</returns> /// <exception cref="System.ArgumentNullException">user</exception> - Task<bool> AuthenticateUser(string username, string passwordSha1, string remoteEndPoint); + Task<User> AuthenticateUser(string username, string passwordSha1, string remoteEndPoint); /// <summary> /// Refreshes metadata for each user @@ -164,7 +164,7 @@ namespace MediaBrowser.Controller.Library /// <param name="passwordMd5">The password MD5.</param> /// <param name="remoteEndPoint">The remote end point.</param> /// <returns>Task<System.Boolean>.</returns> - Task<bool> AuthenticateUser(string username, string passwordSha1, string passwordMd5, string remoteEndPoint); + Task<User> AuthenticateUser(string username, string passwordSha1, string passwordMd5, string remoteEndPoint); /// <summary> /// Starts the forgot password process. diff --git a/MediaBrowser.Controller/LiveTv/ILiveTvManager.cs b/MediaBrowser.Controller/LiveTv/ILiveTvManager.cs index 5242c5b1f..c8fa6be8c 100644 --- a/MediaBrowser.Controller/LiveTv/ILiveTvManager.cs +++ b/MediaBrowser.Controller/LiveTv/ILiveTvManager.cs @@ -157,7 +157,7 @@ namespace MediaBrowser.Controller.LiveTv /// <param name="mediaSourceId">The media source identifier.</param> /// <param name="cancellationToken">The cancellation token.</param> /// <returns>Task{StreamResponseInfo}.</returns> - Task<Tuple<MediaSourceInfo, IDirectStreamProvider, bool>> GetChannelStream(string id, string mediaSourceId, CancellationToken cancellationToken); + Task<Tuple<MediaSourceInfo, IDirectStreamProvider>> GetChannelStream(string id, string mediaSourceId, CancellationToken cancellationToken); /// <summary> /// Gets the program. diff --git a/MediaBrowser.Controller/MediaBrowser.Controller.csproj b/MediaBrowser.Controller/MediaBrowser.Controller.csproj index 88153868f..1f10fab73 100644 --- a/MediaBrowser.Controller/MediaBrowser.Controller.csproj +++ b/MediaBrowser.Controller/MediaBrowser.Controller.csproj @@ -114,7 +114,6 @@ <Compile Include="Entities\IHasImages.cs" /> <Compile Include="Entities\KeywordExtensions.cs" /> <Compile Include="Entities\IHasMediaSources.cs" /> - <Compile Include="Entities\IHasMetascore.cs" /> <Compile Include="Entities\IHasProgramAttributes.cs" /> <Compile Include="Entities\IHasScreenshots.cs" /> <Compile Include="Entities\IHasSeries.cs" /> diff --git a/MediaBrowser.Controller/MediaEncoding/EncodingHelper.cs b/MediaBrowser.Controller/MediaEncoding/EncodingHelper.cs index 1c716a620..90ec5aac7 100644 --- a/MediaBrowser.Controller/MediaEncoding/EncodingHelper.cs +++ b/MediaBrowser.Controller/MediaEncoding/EncodingHelper.cs @@ -377,7 +377,7 @@ namespace MediaBrowser.Controller.MediaEncoding var arg = string.Format("-i {0}", GetInputPathArgument(state)); - if (state.SubtitleStream != null && request.SubtitleMethod == SubtitleDeliveryMethod.Encode) + if (state.SubtitleStream != null && state.SubtitleDeliveryMethod == SubtitleDeliveryMethod.Encode) { if (state.SubtitleStream.IsExternal && !state.SubtitleStream.IsTextSubtitleStream) { @@ -410,7 +410,7 @@ namespace MediaBrowser.Controller.MediaEncoding { if (GetVideoEncoder(state, encodingOptions).IndexOf("vaapi", StringComparison.OrdinalIgnoreCase) != -1) { - var hasGraphicalSubs = state.SubtitleStream != null && !state.SubtitleStream.IsTextSubtitleStream && request.SubtitleMethod == SubtitleDeliveryMethod.Encode; + var hasGraphicalSubs = state.SubtitleStream != null && !state.SubtitleStream.IsTextSubtitleStream && state.SubtitleDeliveryMethod == SubtitleDeliveryMethod.Encode; var hwOutputFormat = "vaapi"; if (hasGraphicalSubs) @@ -751,8 +751,18 @@ namespace MediaBrowser.Controller.MediaEncoding public bool CanStreamCopyVideo(EncodingJobInfo state, MediaStream videoStream) { + if (!videoStream.AllowStreamCopy) + { + return false; + } + var request = state.BaseRequest; + if (!request.AllowVideoStreamCopy) + { + return false; + } + if (videoStream.IsInterlaced) { if (request.DeInterlace) @@ -772,7 +782,7 @@ namespace MediaBrowser.Controller.MediaEncoding // Can't stream copy if we're burning in subtitles if (request.SubtitleStreamIndex.HasValue) { - if (request.SubtitleMethod == SubtitleDeliveryMethod.Encode) + if (state.SubtitleDeliveryMethod == SubtitleDeliveryMethod.Encode) { return false; } @@ -891,8 +901,18 @@ namespace MediaBrowser.Controller.MediaEncoding public bool CanStreamCopyAudio(EncodingJobInfo state, MediaStream audioStream, List<string> supportedAudioCodecs) { + if (!audioStream.AllowStreamCopy) + { + return false; + } + var request = state.BaseRequest; + if (!request.AllowAudioStreamCopy) + { + return false; + } + // Source and target codecs must match if (string.IsNullOrEmpty(audioStream.Codec) || !supportedAudioCodecs.Contains(audioStream.Codec, StringComparer.OrdinalIgnoreCase)) { @@ -1022,7 +1042,7 @@ namespace MediaBrowser.Controller.MediaEncoding var pts = string.Empty; - if (state.SubtitleStream != null && state.SubtitleStream.IsTextSubtitleStream && state.BaseRequest.SubtitleMethod == SubtitleDeliveryMethod.Encode && !state.CopyTimestamps) + if (state.SubtitleStream != null && state.SubtitleStream.IsTextSubtitleStream && state.SubtitleDeliveryMethod == SubtitleDeliveryMethod.Encode && !state.CopyTimestamps) { var seconds = TimeSpan.FromTicks(state.StartTimeTicks ?? 0).TotalSeconds; @@ -1185,7 +1205,7 @@ namespace MediaBrowser.Controller.MediaEncoding args += " -map -0:a"; } - var subtitleMethod = state.BaseRequest.SubtitleMethod; + var subtitleMethod = state.SubtitleDeliveryMethod; if (state.SubtitleStream == null || subtitleMethod == SubtitleDeliveryMethod.Hls) { args += " -map -0:s"; @@ -1401,7 +1421,7 @@ namespace MediaBrowser.Controller.MediaEncoding var output = string.Empty; - if (state.SubtitleStream != null && state.SubtitleStream.IsTextSubtitleStream && request.SubtitleMethod == SubtitleDeliveryMethod.Encode) + if (state.SubtitleStream != null && state.SubtitleStream.IsTextSubtitleStream && state.SubtitleDeliveryMethod == SubtitleDeliveryMethod.Encode) { var subParam = GetTextSubtitleParam(state); @@ -1676,6 +1696,8 @@ namespace MediaBrowser.Controller.MediaEncoding } EnforceResolutionLimit(state); + + NormalizeSubtitleEmbed(state); } else { @@ -1685,6 +1707,21 @@ namespace MediaBrowser.Controller.MediaEncoding state.MediaSource = mediaSource; } + private void NormalizeSubtitleEmbed(EncodingJobInfo state) + { + if (state.SubtitleStream == null || state.SubtitleDeliveryMethod != SubtitleDeliveryMethod.Embed) + { + return ; + } + + // This is tricky to remux in, after converting to dvdsub it's not positioned correctly + // Therefore, let's just burn it in + if (string.Equals(state.SubtitleStream.Codec, "DVBSUB", StringComparison.OrdinalIgnoreCase)) + { + state.SubtitleDeliveryMethod = SubtitleDeliveryMethod.Encode; + } + } + /// <summary> /// Gets the name of the output video codec /// </summary> @@ -1790,16 +1827,6 @@ namespace MediaBrowser.Controller.MediaEncoding codec = format; } - // Muxing in dvbsub via either copy or -codec dvbsub does not seem to work - // It doesn't throw any errors but vlc on android will not render them - // They will need to be converted to an alternative format - // TODO: This is incorrectly assuming that dvdsub will be supported by the player - // The api will need to be expanded to accomodate this. - if (string.Equals(state.SubtitleStream.Codec, "DVBSUB", StringComparison.OrdinalIgnoreCase)) - { - codec = "dvdsub"; - } - var args = " -codec:s:0 " + codec; args += " -disposition:s:0 default"; @@ -1874,7 +1901,7 @@ namespace MediaBrowser.Controller.MediaEncoding args += keyFrameArg; - var hasGraphicalSubs = state.SubtitleStream != null && !state.SubtitleStream.IsTextSubtitleStream && state.BaseRequest.SubtitleMethod == SubtitleDeliveryMethod.Encode; + var hasGraphicalSubs = state.SubtitleStream != null && !state.SubtitleStream.IsTextSubtitleStream && state.SubtitleDeliveryMethod == SubtitleDeliveryMethod.Encode; var hasCopyTs = false; // Add resolution params, if specified diff --git a/MediaBrowser.Controller/MediaEncoding/EncodingJobOptions.cs b/MediaBrowser.Controller/MediaEncoding/EncodingJobOptions.cs index 73be78dc9..30deae842 100644 --- a/MediaBrowser.Controller/MediaEncoding/EncodingJobOptions.cs +++ b/MediaBrowser.Controller/MediaEncoding/EncodingJobOptions.cs @@ -72,6 +72,9 @@ namespace MediaBrowser.Controller.MediaEncoding [ApiMember(Name = "EnableAutoStreamCopy", Description = "Whether or not to allow automatic stream copy if requested values match the original source. Defaults to true.", IsRequired = false, DataType = "bool", ParameterType = "query", Verb = "GET")] public bool EnableAutoStreamCopy { get; set; } + public bool AllowVideoStreamCopy { get; set; } + public bool AllowAudioStreamCopy { get; set; } + /// <summary> /// Gets or sets the audio sample rate. /// </summary> @@ -189,6 +192,7 @@ namespace MediaBrowser.Controller.MediaEncoding public int? TranscodingMaxAudioChannels { get; set; } public int? CpuCoreLimit { get; set; } public string OutputContainer { get; set; } + public string LiveStreamId { get; set; } /// <summary> /// Gets or sets the video codec. @@ -218,6 +222,8 @@ namespace MediaBrowser.Controller.MediaEncoding public BaseEncodingJobOptions() { EnableAutoStreamCopy = true; + AllowVideoStreamCopy = true; + AllowAudioStreamCopy = true; Context = EncodingContext.Streaming; } } diff --git a/MediaBrowser.Controller/Providers/DirectoryService.cs b/MediaBrowser.Controller/Providers/DirectoryService.cs index 01218c293..40093df3a 100644 --- a/MediaBrowser.Controller/Providers/DirectoryService.cs +++ b/MediaBrowser.Controller/Providers/DirectoryService.cs @@ -103,6 +103,16 @@ namespace MediaBrowser.Controller.Providers return GetFileSystemEntries(path, clearCache).Where(i => !i.IsDirectory); } + public IEnumerable<string> GetFilePaths(string path) + { + return _fileSystem.GetFilePaths(path); + } + + public IEnumerable<string> GetFilePaths(string path, bool clearCache) + { + return _fileSystem.GetFilePaths(path); + } + public FileSystemMetadata GetFile(string path) { FileSystemMetadata file; diff --git a/MediaBrowser.Controller/Providers/IDirectoryService.cs b/MediaBrowser.Controller/Providers/IDirectoryService.cs index 54ae7e12b..f78d9cd6a 100644 --- a/MediaBrowser.Controller/Providers/IDirectoryService.cs +++ b/MediaBrowser.Controller/Providers/IDirectoryService.cs @@ -8,9 +8,10 @@ namespace MediaBrowser.Controller.Providers public interface IDirectoryService { IEnumerable<FileSystemMetadata> GetFileSystemEntries(string path); - IEnumerable<FileSystemMetadata> GetFiles(string path); IEnumerable<FileSystemMetadata> GetDirectories(string path); - IEnumerable<FileSystemMetadata> GetFiles(string path, bool clearCache); + IEnumerable<FileSystemMetadata> GetFiles(string path); + IEnumerable<string> GetFilePaths(string path); + IEnumerable<string> GetFilePaths(string path, bool clearCache); FileSystemMetadata GetFile(string path); Dictionary<string, FileSystemMetadata> GetFileSystemDictionary(string path); } |
