diff options
| author | Luke Pulverenti <luke.pulverenti@gmail.com> | 2014-12-04 00:24:41 -0500 |
|---|---|---|
| committer | Luke Pulverenti <luke.pulverenti@gmail.com> | 2014-12-04 00:24:41 -0500 |
| commit | 5eb44c42c586af34dd16efc76240d0d6c8e02069 (patch) | |
| tree | da16bbb5f3ab9d7e7ba642aca82628794b7f7847 /MediaBrowser.Server.Implementations/Library/Resolvers | |
| parent | 56f6b0335ce40aeab275f1038b96a8ecc642f18f (diff) | |
resolve mixed folder detection
Diffstat (limited to 'MediaBrowser.Server.Implementations/Library/Resolvers')
7 files changed, 263 insertions, 208 deletions
diff --git a/MediaBrowser.Server.Implementations/Library/Resolvers/BaseVideoResolver.cs b/MediaBrowser.Server.Implementations/Library/Resolvers/BaseVideoResolver.cs index f8cd209a1..a423ea3f1 100644 --- a/MediaBrowser.Server.Implementations/Library/Resolvers/BaseVideoResolver.cs +++ b/MediaBrowser.Server.Implementations/Library/Resolvers/BaseVideoResolver.cs @@ -1,10 +1,12 @@ using MediaBrowser.Controller.Entities; using MediaBrowser.Controller.Library; +using MediaBrowser.Controller.Providers; using MediaBrowser.Model.Entities; using MediaBrowser.Naming.Common; using MediaBrowser.Naming.Video; using System; using System.IO; +using System.Linq; namespace MediaBrowser.Server.Implementations.Library.Resolvers { @@ -29,7 +31,7 @@ namespace MediaBrowser.Server.Implementations.Library.Resolvers /// <returns>`0.</returns> protected override T Resolve(ItemResolveArgs args) { - return ResolveVideo<T>(args, true); + return ResolveVideo<T>(args, false); } /// <summary> @@ -96,14 +98,9 @@ namespace MediaBrowser.Server.Implementations.Library.Resolvers if (video != null) { - if (parseName) - { - video.Name = videoInfo.Name; - } - else - { - video.Name = Path.GetFileName(args.Path); - } + video.Name = parseName ? + videoInfo.Name : + Path.GetFileName(args.Path); Set3DFormat(video, videoInfo); } @@ -119,50 +116,22 @@ namespace MediaBrowser.Server.Implementations.Library.Resolvers return null; } - var isShortcut = string.Equals(videoInfo.Container, "strm", StringComparison.OrdinalIgnoreCase); - - if (LibraryManager.IsVideoFile(args.Path) || videoInfo.IsStub || isShortcut) + if (LibraryManager.IsVideoFile(args.Path) || videoInfo.IsStub) { - var type = string.Equals(videoInfo.Container, "iso", StringComparison.OrdinalIgnoreCase) || string.Equals(videoInfo.Container, "img", StringComparison.OrdinalIgnoreCase) ? - VideoType.Iso : - VideoType.VideoFile; - var path = args.Path; var video = new TVideoType { - VideoType = type, Path = path, IsInMixedFolder = true, - IsPlaceHolder = videoInfo.IsStub, - IsShortcut = isShortcut, ProductionYear = videoInfo.Year }; - if (parseName) - { - video.Name = videoInfo.Name; - } - else - { - video.Name = Path.GetFileNameWithoutExtension(path); - } - - if (videoInfo.IsStub) - { - if (string.Equals(videoInfo.StubType, "dvd", StringComparison.OrdinalIgnoreCase)) - { - video.VideoType = VideoType.Dvd; - } - else if (string.Equals(videoInfo.StubType, "hddvd", StringComparison.OrdinalIgnoreCase)) - { - video.VideoType = VideoType.HdDvd; - } - else if (string.Equals(videoInfo.StubType, "bluray", StringComparison.OrdinalIgnoreCase)) - { - video.VideoType = VideoType.BluRay; - } - } + SetVideoType(video, videoInfo); + + video.Name = parseName ? + videoInfo.Name : + Path.GetFileNameWithoutExtension(args.Path); Set3DFormat(video, videoInfo); @@ -173,41 +142,82 @@ namespace MediaBrowser.Server.Implementations.Library.Resolvers return null; } - private void Set3DFormat(Video video, VideoFileInfo videoInfo) + protected void SetVideoType(Video video, VideoFileInfo videoInfo) { - if (videoInfo.Is3D) + var extension = Path.GetExtension(video.Path); + video.VideoType = string.Equals(extension, ".iso", StringComparison.OrdinalIgnoreCase) || + string.Equals(extension, ".img", StringComparison.OrdinalIgnoreCase) ? + VideoType.Iso : + VideoType.VideoFile; + + video.IsShortcut = string.Equals(extension, ".strm", StringComparison.OrdinalIgnoreCase); + video.IsPlaceHolder = videoInfo.IsStub; + + if (videoInfo.IsStub) { - if (string.Equals(videoInfo.Format3D, "fsbs", StringComparison.OrdinalIgnoreCase)) + if (string.Equals(videoInfo.StubType, "dvd", StringComparison.OrdinalIgnoreCase)) + { + video.VideoType = VideoType.Dvd; + } + else if (string.Equals(videoInfo.StubType, "hddvd", StringComparison.OrdinalIgnoreCase)) + { + video.VideoType = VideoType.HdDvd; + } + else if (string.Equals(videoInfo.StubType, "bluray", StringComparison.OrdinalIgnoreCase)) + { + video.VideoType = VideoType.BluRay; + } + } + } + + protected void Set3DFormat(Video video, bool is3D, string format3D) + { + if (is3D) + { + if (string.Equals(format3D, "fsbs", StringComparison.OrdinalIgnoreCase)) { video.Video3DFormat = Video3DFormat.FullSideBySide; } - else if (string.Equals(videoInfo.Format3D, "ftab", StringComparison.OrdinalIgnoreCase)) + else if (string.Equals(format3D, "ftab", StringComparison.OrdinalIgnoreCase)) { video.Video3DFormat = Video3DFormat.FullTopAndBottom; } - else if (string.Equals(videoInfo.Format3D, "hsbs", StringComparison.OrdinalIgnoreCase)) + else if (string.Equals(format3D, "hsbs", StringComparison.OrdinalIgnoreCase)) { video.Video3DFormat = Video3DFormat.HalfSideBySide; } - else if (string.Equals(videoInfo.Format3D, "htab", StringComparison.OrdinalIgnoreCase)) + else if (string.Equals(format3D, "htab", StringComparison.OrdinalIgnoreCase)) { video.Video3DFormat = Video3DFormat.HalfTopAndBottom; } - else if (string.Equals(videoInfo.Format3D, "sbs", StringComparison.OrdinalIgnoreCase)) + else if (string.Equals(format3D, "sbs", StringComparison.OrdinalIgnoreCase)) { video.Video3DFormat = Video3DFormat.HalfSideBySide; } - else if (string.Equals(videoInfo.Format3D, "sbs3d", StringComparison.OrdinalIgnoreCase)) + else if (string.Equals(format3D, "sbs3d", StringComparison.OrdinalIgnoreCase)) { video.Video3DFormat = Video3DFormat.HalfSideBySide; } - else if (string.Equals(videoInfo.Format3D, "tab", StringComparison.OrdinalIgnoreCase)) + else if (string.Equals(format3D, "tab", StringComparison.OrdinalIgnoreCase)) { video.Video3DFormat = Video3DFormat.HalfTopAndBottom; } } } + protected void Set3DFormat(Video video, VideoFileInfo videoInfo) + { + Set3DFormat(video, videoInfo.Is3D, videoInfo.Format3D); + } + + protected void Set3DFormat(Video video) + { + var resolver = new Format3DParser(new ExtendedNamingOptions(), new Naming.Logging.NullLogger()); + var result = resolver.Parse(video.Path); + + Set3DFormat(video, result.Is3D, result.Format3D); + } + /// <summary> /// Determines whether [is DVD directory] [the specified directory name]. /// </summary> @@ -227,5 +237,15 @@ 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/BoxSetResolver.cs b/MediaBrowser.Server.Implementations/Library/Resolvers/Movies/BoxSetResolver.cs index 7f9b16d95..cc261c3e7 100644 --- a/MediaBrowser.Server.Implementations/Library/Resolvers/Movies/BoxSetResolver.cs +++ b/MediaBrowser.Server.Implementations/Library/Resolvers/Movies/BoxSetResolver.cs @@ -1,5 +1,4 @@ -using MediaBrowser.Common.Extensions; -using MediaBrowser.Controller.Entities; +using MediaBrowser.Controller.Entities; using MediaBrowser.Controller.Entities.Movies; using MediaBrowser.Controller.Library; using MediaBrowser.Model.Entities; @@ -38,7 +37,8 @@ namespace MediaBrowser.Server.Implementations.Library.Resolvers.Movies return null; } - if (filename.IndexOf("[boxset]", StringComparison.OrdinalIgnoreCase) != -1 || args.ContainsFileSystemEntryByName("collection.xml")) + if (filename.IndexOf("[boxset]", StringComparison.OrdinalIgnoreCase) != -1 || + args.ContainsFileSystemEntryByName("collection.xml")) { return new BoxSet { diff --git a/MediaBrowser.Server.Implementations/Library/Resolvers/Movies/MovieResolver.cs b/MediaBrowser.Server.Implementations/Library/Resolvers/Movies/MovieResolver.cs index 6d396ad9c..f48b8329e 100644 --- a/MediaBrowser.Server.Implementations/Library/Resolvers/Movies/MovieResolver.cs +++ b/MediaBrowser.Server.Implementations/Library/Resolvers/Movies/MovieResolver.cs @@ -2,12 +2,14 @@ using MediaBrowser.Controller; using MediaBrowser.Controller.Entities; using MediaBrowser.Controller.Entities.Movies; +using MediaBrowser.Controller.Entities.TV; using MediaBrowser.Controller.Library; using MediaBrowser.Controller.Providers; using MediaBrowser.Controller.Resolvers; using MediaBrowser.Model.Entities; using MediaBrowser.Model.Logging; using MediaBrowser.Naming.Common; +using MediaBrowser.Naming.IO; using MediaBrowser.Naming.Video; using System; using System.Collections.Generic; @@ -19,13 +21,14 @@ namespace MediaBrowser.Server.Implementations.Library.Resolvers.Movies /// <summary> /// Class MovieResolver /// </summary> - public class MovieResolver : BaseVideoResolver<Video> + public class MovieResolver : BaseVideoResolver<Video>, IMultiItemResolver { private readonly IServerApplicationPaths _applicationPaths; private readonly ILogger _logger; private readonly IFileSystem _fileSystem; - public MovieResolver(ILibraryManager libraryManager, IServerApplicationPaths applicationPaths, ILogger logger, IFileSystem fileSystem) : base(libraryManager) + public MovieResolver(ILibraryManager libraryManager, IServerApplicationPaths applicationPaths, ILogger logger, IFileSystem fileSystem) + : base(libraryManager) { _applicationPaths = applicationPaths; _logger = logger; @@ -43,10 +46,107 @@ namespace MediaBrowser.Server.Implementations.Library.Resolvers.Movies // Give plugins a chance to catch iso's first // Also since we have to loop through child files looking for videos, // see if we can avoid some of that by letting other resolvers claim folders first - return ResolverPriority.Second; + // Also run after series resolver + return ResolverPriority.Third; } } + public MultiItemResolverResult ResolveMultiple(Folder parent, + List<FileSystemInfo> files, + string collectionType, + IDirectoryService directoryService) + { + if (IsInvalid(parent, collectionType, files)) + { + return null; + } + + if (string.Equals(collectionType, CollectionType.MusicVideos, StringComparison.OrdinalIgnoreCase)) + { + return ResolveVideos<MusicVideo>(parent, files, directoryService, collectionType); + } + + if (string.Equals(collectionType, CollectionType.HomeVideos, StringComparison.OrdinalIgnoreCase)) + { + return ResolveVideos<Video>(parent, files, directoryService, collectionType); + } + + if (string.IsNullOrEmpty(collectionType)) + { + // Owned items should just use the plain video type + if (parent == null) + { + return ResolveVideos<Video>(parent, files, directoryService, collectionType); + } + + return ResolveVideos<Movie>(parent, files, directoryService, collectionType); + } + + if (string.Equals(collectionType, CollectionType.Movies, StringComparison.OrdinalIgnoreCase) || + string.Equals(collectionType, CollectionType.BoxSets, StringComparison.OrdinalIgnoreCase)) + { + return ResolveVideos<Movie>(parent, files, directoryService, collectionType); + } + + return null; + } + + private MultiItemResolverResult ResolveVideos<T>(Folder parent, IEnumerable<FileSystemInfo> fileSystemEntries, IDirectoryService directoryService, string collectionType) + where T : Video, new() + { + var files = new List<FileSystemInfo>(); + var videos = new List<BaseItem>(); + var leftOver = new List<FileSystemInfo>(); + + // Loop through each child file/folder and see if we find a video + foreach (var child in fileSystemEntries) + { + if ((child.Attributes & FileAttributes.Directory) == FileAttributes.Directory) + { + leftOver.Add(child); + } + else + { + files.Add(child); + } + } + + var resolver = new VideoListResolver(new ExtendedNamingOptions(), new Naming.Logging.NullLogger()); + var resolverResult = resolver.Resolve(files.Select(i => new PortableFileInfo + { + FullName = i.FullName, + Type = FileInfoType.File + + }).ToList()); + + var result = new MultiItemResolverResult + { + ExtraFiles = leftOver, + Items = videos + }; + + foreach (var video in resolverResult) + { + var firstVideo = video.Files.First(); + + var videoItem = new T + { + Path = video.Files[0].Path, + IsInMixedFolder = true, + ProductionYear = video.Year, + Name = video.Name, + AdditionalParts = video.Files.Skip(1).Select(i => i.Path).ToList() + }; + + SetVideoType(videoItem, firstVideo); + Set3DFormat(videoItem, firstVideo); + + result.Items.Add(videoItem); + } + + return result; + } + /// <summary> /// Resolves the specified args. /// </summary> @@ -54,28 +154,24 @@ namespace MediaBrowser.Server.Implementations.Library.Resolvers.Movies /// <returns>Video.</returns> protected override Video Resolve(ItemResolveArgs args) { - // Avoid expensive tests against VF's and all their children by not allowing this - if (args.Parent != null) + var collectionType = args.GetCollectionType(); + + if (IsInvalid(args.Parent, collectionType, args.FileSystemChildren)) { - if (args.Parent.IsRoot) - { - return null; - } + return null; } - var collectionType = args.GetCollectionType(); - // Find movies with their own folders if (args.IsDirectory) { if (string.Equals(collectionType, CollectionType.MusicVideos, StringComparison.OrdinalIgnoreCase)) { - return FindMovie<MusicVideo>(args.Path, args.Parent, args.FileSystemChildren.ToList(), args.DirectoryService, false, collectionType); + return FindMovie<MusicVideo>(args.Path, args.Parent, args.FileSystemChildren.ToList(), args.DirectoryService, collectionType); } if (string.Equals(collectionType, CollectionType.HomeVideos, StringComparison.OrdinalIgnoreCase)) { - return FindMovie<Video>(args.Path, args.Parent, args.FileSystemChildren.ToList(), args.DirectoryService, false, collectionType); + return FindMovie<Video>(args.Path, args.Parent, args.FileSystemChildren.ToList(), args.DirectoryService, collectionType); } if (string.IsNullOrEmpty(collectionType)) @@ -83,7 +179,7 @@ namespace MediaBrowser.Server.Implementations.Library.Resolvers.Movies // Owned items should just use the plain video type if (args.Parent == null) { - return FindMovie<Video>(args.Path, args.Parent, args.FileSystemChildren.ToList(), args.DirectoryService, false, collectionType); + return FindMovie<Video>(args.Path, args.Parent, args.FileSystemChildren.ToList(), args.DirectoryService, collectionType); } // Since the looping is expensive, this is an optimization to help us avoid it @@ -91,22 +187,21 @@ namespace MediaBrowser.Server.Implementations.Library.Resolvers.Movies { return null; } - - return FindMovie<Movie>(args.Path, args.Parent, args.FileSystemChildren.ToList(), args.DirectoryService, true, collectionType); + + return FindMovie<Movie>(args.Path, args.Parent, args.FileSystemChildren.ToList(), args.DirectoryService, collectionType); } if (string.Equals(collectionType, CollectionType.Movies, StringComparison.OrdinalIgnoreCase) || string.Equals(collectionType, CollectionType.BoxSets, StringComparison.OrdinalIgnoreCase)) { - return FindMovie<Movie>(args.Path, args.Parent, args.FileSystemChildren.ToList(), args.DirectoryService, true, collectionType); + return FindMovie<Movie>(args.Path, args.Parent, args.FileSystemChildren.ToList(), args.DirectoryService, collectionType); } - + return null; } - var filename = Path.GetFileName(args.Path); - // Don't misidentify extras or trailers - if (BaseItem.ExtraSuffixes.Any(i => filename.IndexOf(i.Key, StringComparison.OrdinalIgnoreCase) != -1)) + // Owned items will be caught by the plain video resolver + if (args.Parent == null) { return null; } @@ -115,7 +210,7 @@ namespace MediaBrowser.Server.Implementations.Library.Resolvers.Movies if (string.Equals(collectionType, CollectionType.MusicVideos, StringComparison.OrdinalIgnoreCase)) { - item = ResolveVideo<MusicVideo>(args, true); + item = ResolveVideo<MusicVideo>(args, false); } // To find a movie file, the collection type must be movies or boxsets @@ -124,7 +219,16 @@ namespace MediaBrowser.Server.Implementations.Library.Resolvers.Movies { item = ResolveVideo<Movie>(args, true); } - + + else if (string.Equals(collectionType, CollectionType.HomeVideos, StringComparison.OrdinalIgnoreCase)) + { + item = ResolveVideo<Video>(args, false); + } + else if (string.IsNullOrEmpty(collectionType)) + { + item = ResolveVideo<Movie>(args, false); + } + if (item != null) { item.IsInMixedFolder = true; @@ -170,17 +274,14 @@ namespace MediaBrowser.Server.Implementations.Library.Resolvers.Movies /// <param name="parent">The parent.</param> /// <param name="fileSystemEntries">The file system entries.</param> /// <param name="directoryService">The directory service.</param> - /// <param name="supportsMultipleSources">if set to <c>true</c> [supports multiple sources].</param> /// <param name="collectionType">Type of the collection.</param> /// <returns>Movie.</returns> - private T FindMovie<T>(string path, Folder parent, IEnumerable<FileSystemInfo> fileSystemEntries, IDirectoryService directoryService, bool supportsMultipleSources, string collectionType) + private T FindMovie<T>(string path, Folder parent, List<FileSystemInfo> fileSystemEntries, IDirectoryService directoryService, string collectionType) where T : Video, new() { - var movies = new List<T>(); - var multiDiscFolders = new List<FileSystemInfo>(); - - // Loop through each child file/folder and see if we find a video + + // Search for a folder rip foreach (var child in fileSystemEntries) { var filename = child.Name; @@ -189,76 +290,59 @@ namespace MediaBrowser.Server.Implementations.Library.Resolvers.Movies { if (IsDvdDirectory(filename)) { - return new T + var movie = new T { Path = path, VideoType = VideoType.Dvd }; + Set3DFormat(movie); + return movie; } if (IsBluRayDirectory(filename)) { - return new T + var movie = new T { Path = path, VideoType = VideoType.BluRay }; + Set3DFormat(movie); + return movie; } multiDiscFolders.Add(child); - - continue; - } - - // Don't misidentify extras or trailers as a movie - if (BaseItem.ExtraSuffixes.Any(i => filename.IndexOf(i.Key, StringComparison.OrdinalIgnoreCase) != -1)) - { - continue; - } - - var childArgs = new ItemResolveArgs(_applicationPaths, LibraryManager, directoryService) - { - FileInfo = child, - Path = child.FullName, - Parent = parent, - CollectionType = collectionType - }; - - var item = ResolveVideo<T>(childArgs, true); - - if (item != null) - { - item.IsInMixedFolder = false; - movies.Add(item); } } + + var result = ResolveVideos<T>(parent, fileSystemEntries, directoryService, collectionType); - if (movies.Count > 1) + // Test for multi-editions + if (result.Items.Count > 1) { - var multiFileResult = GetMultiFileMovie(movies); + var filenamePrefix = Path.GetFileName(path); - if (multiFileResult != null) + if (!string.IsNullOrWhiteSpace(filenamePrefix)) { - return multiFileResult; - } + if (result.Items.All(i => _fileSystem.GetFileNameWithoutExtension(i.Path).StartsWith(filenamePrefix + " - ", StringComparison.OrdinalIgnoreCase))) + { + var movie = (T)result.Items[0]; + movie.Name = filenamePrefix; + movie.LocalAlternateVersions = result.Items.Skip(1).Select(i => i.Path).ToList(); - if (supportsMultipleSources) - { - var result = GetMovieWithMultipleSources(movies); + _logger.Debug("Multi-version video found: " + movie.Path); - if (result != null) - { - return result; + return movie; } } - return null; } - if (movies.Count == 1) + if (result.Items.Count == 1) { - return movies[0]; + var movie = (T)result.Items[0]; + movie.IsInMixedFolder = false; + return movie; } - if (multiDiscFolders.Count > 0) + if (result.Items.Count == 0 && multiDiscFolders.Count > 0) { return GetMultiDiscMovie<T>(multiDiscFolders, directoryService); } @@ -318,7 +402,7 @@ namespace MediaBrowser.Server.Implementations.Library.Resolvers.Movies { return null; } - + return new T { Path = folderPaths[0], @@ -331,65 +415,42 @@ namespace MediaBrowser.Server.Implementations.Library.Resolvers.Movies }; } - /// <summary> - /// Gets the multi file movie. - /// </summary> - /// <typeparam name="T"></typeparam> - /// <param name="movies">The movies.</param> - /// <returns>``0.</returns> - private T GetMultiFileMovie<T>(IEnumerable<T> movies) - where T : Video, new() - { - var sortedMovies = movies.OrderBy(i => i.Path).ToList(); - - var firstMovie = sortedMovies[0]; - - var paths = sortedMovies.Select(i => i.Path).ToList(); - - var resolver = new StackResolver(new ExtendedNamingOptions(), new Naming.Logging.NullLogger()); - - var result = resolver.ResolveFiles(paths); - - if (result.Stacks.Count != 1) - { - return null; - } - - firstMovie.AdditionalParts = result.Stacks[0].Files.Skip(1).ToList(); - firstMovie.Name = result.Stacks[0].Name; - - // They must all be part of the sequence if we're going to consider it a multi-part movie - return firstMovie; - } - - private T GetMovieWithMultipleSources<T>(IEnumerable<T> movies) - where T : Video, new() + private bool IsInvalid(Folder parent, string collectionType, IEnumerable<FileSystemInfo> files) { - var sortedMovies = movies.OrderBy(i => i.Path).ToList(); - - // Cap this at five to help avoid incorrect matching - if (sortedMovies.Count > 5) + if (parent != null) { - return null; + if (parent.IsRoot) + { + return true; + } } - var firstMovie = sortedMovies[0]; - - var filenamePrefix = Path.GetFileName(Path.GetDirectoryName(firstMovie.Path)); - - if (!string.IsNullOrWhiteSpace(filenamePrefix)) + // Don't do any resolving within a series structure + if (string.IsNullOrEmpty(collectionType)) { - if (sortedMovies.All(i => _fileSystem.GetFileNameWithoutExtension(i.Path).StartsWith(filenamePrefix + " - ", StringComparison.OrdinalIgnoreCase))) + if (parent is Season || parent is Series) { - firstMovie.LocalAlternateVersions = sortedMovies.Skip(1).Select(i => i.Path).ToList(); - - _logger.Debug("Multi-version video found: " + firstMovie.Path); + return true; + } - return firstMovie; + // Since the looping is expensive, this is an optimization to help us avoid it + if (files.Select(i => i.Name).Contains("series.xml", StringComparer.OrdinalIgnoreCase)) + { + return true; } } - return null; + var validCollectionTypes = new[] + { + string.Empty, + CollectionType.Movies, + CollectionType.HomeVideos, + CollectionType.MusicVideos, + CollectionType.BoxSets, + CollectionType.Movies + }; + + return !validCollectionTypes.Contains(collectionType ?? string.Empty, StringComparer.OrdinalIgnoreCase); } } } diff --git a/MediaBrowser.Server.Implementations/Library/Resolvers/PhotoResolver.cs b/MediaBrowser.Server.Implementations/Library/Resolvers/PhotoResolver.cs index e3fe37be8..5580b442c 100644 --- a/MediaBrowser.Server.Implementations/Library/Resolvers/PhotoResolver.cs +++ b/MediaBrowser.Server.Implementations/Library/Resolvers/PhotoResolver.cs @@ -17,7 +17,9 @@ namespace MediaBrowser.Server.Implementations.Library.Resolvers protected override Photo Resolve(ItemResolveArgs args) { // Must be an image file within a photo collection - if (!args.IsDirectory && IsImageFile(args.Path) && string.Equals(args.GetCollectionType(), CollectionType.Photos, StringComparison.OrdinalIgnoreCase)) + if (!args.IsDirectory && + string.Equals(args.GetCollectionType(), CollectionType.Photos, StringComparison.OrdinalIgnoreCase) && + IsImageFile(args.Path)) { return new Photo { diff --git a/MediaBrowser.Server.Implementations/Library/Resolvers/TV/EpisodeResolver.cs b/MediaBrowser.Server.Implementations/Library/Resolvers/TV/EpisodeResolver.cs index 112490ccd..057425ca9 100644 --- a/MediaBrowser.Server.Implementations/Library/Resolvers/TV/EpisodeResolver.cs +++ b/MediaBrowser.Server.Implementations/Library/Resolvers/TV/EpisodeResolver.cs @@ -1,8 +1,5 @@ -using System; -using MediaBrowser.Controller.Entities.TV; +using MediaBrowser.Controller.Entities.TV; using MediaBrowser.Controller.Library; -using MediaBrowser.Controller.Resolvers; -using MediaBrowser.Model.Entities; using System.Linq; namespace MediaBrowser.Server.Implementations.Library.Resolvers.TV @@ -42,10 +39,6 @@ namespace MediaBrowser.Server.Implementations.Library.Resolvers.TV // If the parent is a Season or Series, then this is an Episode if the VideoResolver returns something if (season != null || parent is Series || parent.Parents.OfType<Series>().Any()) { - if (args.IsDirectory && args.Path.IndexOf("dead like me", StringComparison.OrdinalIgnoreCase) != -1) - { - var b = true; - } var episode = ResolveVideo<Episode>(args, false); if (episode != null) diff --git a/MediaBrowser.Server.Implementations/Library/Resolvers/TV/SeriesResolver.cs b/MediaBrowser.Server.Implementations/Library/Resolvers/TV/SeriesResolver.cs index 52a95a300..1efe4e880 100644 --- a/MediaBrowser.Server.Implementations/Library/Resolvers/TV/SeriesResolver.cs +++ b/MediaBrowser.Server.Implementations/Library/Resolvers/TV/SeriesResolver.cs @@ -1,5 +1,4 @@ -using MediaBrowser.Common.Extensions; -using MediaBrowser.Common.IO; +using MediaBrowser.Common.IO; using MediaBrowser.Controller.Entities; using MediaBrowser.Controller.Entities.Audio; using MediaBrowser.Controller.Entities.TV; @@ -84,7 +83,7 @@ namespace MediaBrowser.Server.Implementations.Library.Resolvers.TV return new Series { Path = args.Path, - Name = ResolverHelper.StripBrackets(Path.GetFileName(args.Path)) + Name = Path.GetFileName(args.Path) }; } } diff --git a/MediaBrowser.Server.Implementations/Library/Resolvers/VideoResolver.cs b/MediaBrowser.Server.Implementations/Library/Resolvers/VideoResolver.cs index cecf2d699..97682db66 100644 --- a/MediaBrowser.Server.Implementations/Library/Resolvers/VideoResolver.cs +++ b/MediaBrowser.Server.Implementations/Library/Resolvers/VideoResolver.cs @@ -1,9 +1,6 @@ using MediaBrowser.Controller.Entities; using MediaBrowser.Controller.Library; using MediaBrowser.Controller.Resolvers; -using MediaBrowser.Model.Entities; -using System; -using System.Linq; namespace MediaBrowser.Server.Implementations.Library.Resolvers { @@ -22,22 +19,7 @@ namespace MediaBrowser.Server.Implementations.Library.Resolvers if (args.Parent != null) { // The movie resolver will handle this - if (args.IsDirectory) - { - return null; - } - - var collectionType = args.GetCollectionType() ?? string.Empty; - var accepted = new[] - { - string.Empty, - CollectionType.HomeVideos - }; - - if (!accepted.Contains(collectionType, StringComparer.OrdinalIgnoreCase)) - { - return null; - } + return null; } return base.Resolve(args); @@ -52,6 +34,4 @@ namespace MediaBrowser.Server.Implementations.Library.Resolvers get { return ResolverPriority.Last; } } } - - } |
