diff options
| author | Luke Pulverenti <luke.pulverenti@gmail.com> | 2014-12-28 01:21:39 -0500 |
|---|---|---|
| committer | Luke Pulverenti <luke.pulverenti@gmail.com> | 2014-12-28 01:21:39 -0500 |
| commit | 5278959edef763bdf0b4d72ace75efd151ab5024 (patch) | |
| tree | acdcd09a21cd3f549a086589e89656181df56bf5 /MediaBrowser.Server.Implementations/Library/Resolvers/TV | |
| parent | 7bce2e04b618671faafc32a39978d0d8c87cba21 (diff) | |
sync fixes
Diffstat (limited to 'MediaBrowser.Server.Implementations/Library/Resolvers/TV')
| -rw-r--r-- | MediaBrowser.Server.Implementations/Library/Resolvers/TV/SeriesResolver.cs | 124 |
1 files changed, 7 insertions, 117 deletions
diff --git a/MediaBrowser.Server.Implementations/Library/Resolvers/TV/SeriesResolver.cs b/MediaBrowser.Server.Implementations/Library/Resolvers/TV/SeriesResolver.cs index 582412562..7f1416ad6 100644 --- a/MediaBrowser.Server.Implementations/Library/Resolvers/TV/SeriesResolver.cs +++ b/MediaBrowser.Server.Implementations/Library/Resolvers/TV/SeriesResolver.cs @@ -1,14 +1,8 @@ -using MediaBrowser.Common.IO; -using MediaBrowser.Controller.Entities.TV; +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.TV; using System; -using System.Collections.Generic; using System.IO; namespace MediaBrowser.Server.Implementations.Library.Resolvers.TV @@ -18,17 +12,6 @@ namespace MediaBrowser.Server.Implementations.Library.Resolvers.TV /// </summary> public class SeriesResolver : FolderResolver<Series> { - private readonly IFileSystem _fileSystem; - private readonly ILogger _logger; - private readonly ILibraryManager _libraryManager; - - public SeriesResolver(IFileSystem fileSystem, ILogger logger, ILibraryManager libraryManager) - { - _fileSystem = fileSystem; - _logger = logger; - _libraryManager = libraryManager; - } - /// <summary> /// Gets the priority. /// </summary> @@ -50,27 +33,16 @@ namespace MediaBrowser.Server.Implementations.Library.Resolvers.TV { if (args.IsDirectory) { - // Avoid expensive tests against VF's and all their children by not allowing this - if (args.Parent.IsRoot) - { - return null; - } - var collectionType = args.GetCollectionType(); // If there's a collection type and it's not tv, it can't be a series - if (!string.Equals(collectionType, CollectionType.TvShows, StringComparison.OrdinalIgnoreCase)) - { - return null; - } - - if (args.HasParent<Series>() || args.HasParent<Season>()) - { - return null; - } - - if (IsSeriesFolder(args.Path, args.FileSystemChildren, args.DirectoryService, _fileSystem, _logger, _libraryManager)) + if (string.Equals(collectionType, CollectionType.TvShows, StringComparison.OrdinalIgnoreCase)) { + if (args.HasParent<Series>()) + { + return null; + } + return new Series { Path = args.Path, @@ -83,88 +55,6 @@ namespace MediaBrowser.Server.Implementations.Library.Resolvers.TV } /// <summary> - /// Determines whether [is series folder] [the specified path]. - /// </summary> - /// <param name="path">The path.</param> - /// <param name="fileSystemChildren">The file system children.</param> - /// <param name="directoryService">The directory service.</param> - /// <param name="fileSystem">The file system.</param> - /// <param name="logger">The logger.</param> - /// <param name="libraryManager">The library manager.</param> - /// <returns><c>true</c> if [is series folder] [the specified path]; otherwise, <c>false</c>.</returns> - public static bool IsSeriesFolder(string path, IEnumerable<FileSystemInfo> fileSystemChildren, IDirectoryService directoryService, IFileSystem fileSystem, ILogger logger, ILibraryManager libraryManager) - { - foreach (var child in fileSystemChildren) - { - var attributes = child.Attributes; - - if ((attributes & FileAttributes.Hidden) == FileAttributes.Hidden) - { - //logger.Debug("Igoring series file or folder marked hidden: {0}", child.FullName); - continue; - } - - // Can't enforce this because files saved by Bitcasa are always marked System - //if ((attributes & FileAttributes.System) == FileAttributes.System) - //{ - // logger.Debug("Igoring series subfolder marked system: {0}", child.FullName); - // continue; - //} - - if ((attributes & FileAttributes.Directory) == FileAttributes.Directory) - { - if (IsSeasonFolder(child.FullName)) - { - //logger.Debug("{0} is a series because of season folder {1}.", path, child.FullName); - return true; - } - } - else - { - var fullName = child.FullName; - - if (libraryManager.IsVideoFile(fullName) || IsVideoPlaceHolder(fullName)) - { - return true; - } - } - } - - logger.Debug("{0} is not a series folder.", path); - return false; - } - - /// <summary> - /// Determines whether [is place holder] [the specified path]. - /// </summary> - /// <param name="path">The path.</param> - /// <returns><c>true</c> if [is place holder] [the specified path]; otherwise, <c>false</c>.</returns> - /// <exception cref="System.ArgumentNullException">path</exception> - private static bool IsVideoPlaceHolder(string path) - { - if (string.IsNullOrEmpty(path)) - { - throw new ArgumentNullException("path"); - } - - var extension = Path.GetExtension(path); - - return string.Equals(extension, ".disc", StringComparison.OrdinalIgnoreCase); - } - - /// <summary> - /// Determines whether [is season folder] [the specified path]. - /// </summary> - /// <param name="path">The path.</param> - /// <returns><c>true</c> if [is season folder] [the specified path]; otherwise, <c>false</c>.</returns> - private static bool IsSeasonFolder(string path) - { - var seasonNumber = new SeasonPathParser(new ExtendedNamingOptions(), new RegexProvider()).Parse(path, true).SeasonNumber; - - return seasonNumber.HasValue; - } - - /// <summary> /// Sets the initial item values. /// </summary> /// <param name="item">The item.</param> |
