From 4548e6598def249d4b0fe4f4f12e2fa16d4f1e3c Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Mon, 8 Dec 2014 23:57:18 -0500 Subject: support dvd without video_ts folder --- .../Library/Resolvers/BaseVideoResolver.cs | 37 ++++++++++++++------ .../Library/Resolvers/Movies/MovieResolver.cs | 40 ++++++++++++++++++---- 2 files changed, 61 insertions(+), 16 deletions(-) (limited to 'MediaBrowser.Server.Implementations/Library') diff --git a/MediaBrowser.Server.Implementations/Library/Resolvers/BaseVideoResolver.cs b/MediaBrowser.Server.Implementations/Library/Resolvers/BaseVideoResolver.cs index a423ea3f1..8e2218b0a 100644 --- a/MediaBrowser.Server.Implementations/Library/Resolvers/BaseVideoResolver.cs +++ b/MediaBrowser.Server.Implementations/Library/Resolvers/BaseVideoResolver.cs @@ -94,6 +94,23 @@ namespace MediaBrowser.Server.Implementations.Library.Resolvers break; } } + else if (IsDvdFile(filename)) + { + videoInfo = parser.ResolveDirectory(args.Path); + + if (videoInfo == null) + { + return null; + } + + video = new TVideoType + { + Path = args.Path, + VideoType = VideoType.Dvd, + ProductionYear = videoInfo.Year + }; + break; + } } if (video != null) @@ -228,6 +245,16 @@ namespace MediaBrowser.Server.Implementations.Library.Resolvers return string.Equals(directoryName, "video_ts", StringComparison.OrdinalIgnoreCase); } + /// + /// Determines whether [is DVD file] [the specified name]. + /// + /// The name. + /// true if [is DVD file] [the specified name]; otherwise, false. + protected bool IsDvdFile(string name) + { + return string.Equals(name, "video_ts.ifo", StringComparison.OrdinalIgnoreCase); + } + /// /// Determines whether [is blu ray directory] [the specified directory name]. /// @@ -237,15 +264,5 @@ namespace MediaBrowser.Server.Implementations.Library.Resolvers { return string.Equals(directoryName, "bdmv", StringComparison.OrdinalIgnoreCase); } - - protected bool IsBluRayContainer(string path, IDirectoryService directoryService) - { - return directoryService.GetDirectories(path).Any(i => IsBluRayDirectory(i.Name)); - } - - protected bool IsDvdContainer(string path, IDirectoryService directoryService) - { - return directoryService.GetDirectories(path).Any(i => IsDvdDirectory(i.Name)); - } } } diff --git a/MediaBrowser.Server.Implementations/Library/Resolvers/Movies/MovieResolver.cs b/MediaBrowser.Server.Implementations/Library/Resolvers/Movies/MovieResolver.cs index f48b8329e..8fceb7f53 100644 --- a/MediaBrowser.Server.Implementations/Library/Resolvers/Movies/MovieResolver.cs +++ b/MediaBrowser.Server.Implementations/Library/Resolvers/Movies/MovieResolver.cs @@ -117,7 +117,7 @@ namespace MediaBrowser.Server.Implementations.Library.Resolvers.Movies FullName = i.FullName, Type = FileInfoType.File - }).ToList()); + }).ToList()).ToList(); var result = new MultiItemResolverResult { @@ -125,6 +125,8 @@ namespace MediaBrowser.Server.Implementations.Library.Resolvers.Movies Items = videos }; + var isInMixedFolder = resolverResult.Count > 0; + foreach (var video in resolverResult) { var firstVideo = video.Files.First(); @@ -132,7 +134,7 @@ namespace MediaBrowser.Server.Implementations.Library.Resolvers.Movies var videoItem = new T { Path = video.Files[0].Path, - IsInMixedFolder = true, + IsInMixedFolder = isInMixedFolder, ProductionYear = video.Year, Name = video.Name, AdditionalParts = video.Files.Skip(1).Select(i => i.Path).ToList() @@ -171,7 +173,7 @@ namespace MediaBrowser.Server.Implementations.Library.Resolvers.Movies if (string.Equals(collectionType, CollectionType.HomeVideos, StringComparison.OrdinalIgnoreCase)) { - return FindMovie