| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122 | 
							- using System;
 
- using System.IO;
 
- using System.Linq;
 
- using System.Text.RegularExpressions;
 
- using MediaBrowser.Controller.Entities;
 
- using MediaBrowser.Controller.Library;
 
- using MediaBrowser.Controller.Resolvers;
 
- using MediaBrowser.Model.IO;
 
- namespace Emby.Server.Implementations.Library
 
- {
 
-     /// <summary>
 
-     /// Provides the core resolver ignore rules
 
-     /// </summary>
 
-     public class CoreResolutionIgnoreRule : IResolverIgnoreRule
 
-     {
 
-         private readonly ILibraryManager _libraryManager;
 
-         /// <summary>
 
-         /// Any folder named in this list will be ignored
 
-         /// </summary>
 
-         private static readonly string[] _ignoreFolders =
 
-         {
 
-                 "metadata",
 
-                 "ps3_update",
 
-                 "ps3_vprm",
 
-                 "extrafanart",
 
-                 "extrathumbs",
 
-                 ".actors",
 
-                 ".wd_tv",
 
-                 // Synology
 
-                 "@eaDir",
 
-                 "eaDir",
 
-                 "#recycle",
 
-                 // Qnap
 
-                 "@Recycle",
 
-                 ".@__thumb",
 
-                 "$RECYCLE.BIN",
 
-                 "System Volume Information",
 
-                 ".grab",
 
-         };
 
-         /// <summary>
 
-         /// Initializes a new instance of the <see cref="CoreResolutionIgnoreRule"/> class.
 
-         /// </summary>
 
-         /// <param name="libraryManager">The library manager.</param>
 
-         public CoreResolutionIgnoreRule(ILibraryManager libraryManager)
 
-         {
 
-             _libraryManager = libraryManager;
 
-         }
 
-         /// <inheritdoc />
 
-         public bool ShouldIgnore(FileSystemMetadata fileInfo, BaseItem parent)
 
-         {
 
-             // Don't ignore top level folders
 
-             if (fileInfo.IsDirectory && parent is AggregateFolder)
 
-             {
 
-                 return false;
 
-             }
 
-             var filename = fileInfo.Name;
 
-             // Ignore hidden files on UNIX
 
-             if (Environment.OSVersion.Platform != PlatformID.Win32NT
 
-                 && filename[0] == '.')
 
-             {
 
-                 return true;
 
-             }
 
-             if (fileInfo.IsDirectory)
 
-             {
 
-                 // Ignore any folders in our list
 
-                 if (_ignoreFolders.Contains(filename, StringComparer.OrdinalIgnoreCase))
 
-                 {
 
-                     return true;
 
-                 }
 
-                 if (parent != null)
 
-                 {
 
-                     // Ignore trailer folders but allow it at the collection level
 
-                     if (string.Equals(filename, BaseItem.TrailerFolderName, StringComparison.OrdinalIgnoreCase)
 
-                         && !(parent is AggregateFolder)
 
-                         && !(parent is UserRootFolder))
 
-                     {
 
-                         return true;
 
-                     }
 
-                     if (string.Equals(filename, BaseItem.ThemeVideosFolderName, StringComparison.OrdinalIgnoreCase))
 
-                     {
 
-                         return true;
 
-                     }
 
-                     if (string.Equals(filename, BaseItem.ThemeSongsFolderName, StringComparison.OrdinalIgnoreCase))
 
-                     {
 
-                         return true;
 
-                     }
 
-                 }
 
-             }
 
-             else
 
-             {
 
-                 if (parent != null)
 
-                 {
 
-                     // Don't resolve these into audio files
 
-                     if (string.Equals(Path.GetFileNameWithoutExtension(filename), BaseItem.ThemeSongFilename)
 
-                         && _libraryManager.IsAudioFile(filename))
 
-                     {
 
-                         return true;
 
-                     }
 
-                 }
 
-                 // Ignore samples
 
-                 Match m = Regex.Match(filename, @"\bsample\b", RegexOptions.IgnoreCase);
 
-                 return m.Success;
 
-             }
 
-             return false;
 
-         }
 
-     }
 
- }
 
 
  |