aboutsummaryrefslogtreecommitdiff
path: root/MediaBrowser.Server.Implementations/Library/CoreResolutionIgnoreRule.cs
diff options
context:
space:
mode:
authorLuke Pulverenti <luke.pulverenti@gmail.com>2015-11-04 18:49:06 -0500
committerLuke Pulverenti <luke.pulverenti@gmail.com>2015-11-04 18:49:06 -0500
commit6aa3313bc05fe5a26cee8944c00489c022612069 (patch)
tree81330692c8f5f7fae10e1f9ec2f2f610aefa15f2 /MediaBrowser.Server.Implementations/Library/CoreResolutionIgnoreRule.cs
parent60067b4c29ccdfe19102a47eb9347715e1904b22 (diff)
make sure ._ osx files are properly ignored
Diffstat (limited to 'MediaBrowser.Server.Implementations/Library/CoreResolutionIgnoreRule.cs')
-rw-r--r--MediaBrowser.Server.Implementations/Library/CoreResolutionIgnoreRule.cs63
1 files changed, 36 insertions, 27 deletions
diff --git a/MediaBrowser.Server.Implementations/Library/CoreResolutionIgnoreRule.cs b/MediaBrowser.Server.Implementations/Library/CoreResolutionIgnoreRule.cs
index 9035d6479..043996403 100644
--- a/MediaBrowser.Server.Implementations/Library/CoreResolutionIgnoreRule.cs
+++ b/MediaBrowser.Server.Implementations/Library/CoreResolutionIgnoreRule.cs
@@ -47,11 +47,14 @@ namespace MediaBrowser.Server.Implementations.Library
/// <summary>
/// Shoulds the ignore.
/// </summary>
- /// <param name="args">The args.</param>
+ /// <param name="fileInfo">The file information.</param>
+ /// <param name="parent">The parent.</param>
/// <returns><c>true</c> if XXXX, <c>false</c> otherwise</returns>
- public bool ShouldIgnore(ItemResolveArgs args)
+ public bool ShouldIgnore(FileSystemMetadata fileInfo, BaseItem parent)
{
- var filename = args.FileInfo.Name;
+ var filename = fileInfo.Name;
+ var isHidden = (fileInfo.Attributes & FileAttributes.Hidden) == FileAttributes.Hidden;
+ var path = fileInfo.FullName;
// Handle mac .DS_Store
// https://github.com/MediaBrowser/MediaBrowser/issues/427
@@ -61,21 +64,24 @@ namespace MediaBrowser.Server.Implementations.Library
}
// Ignore hidden files and folders
- if (args.IsHidden)
+ if (isHidden)
{
- var parentFolderName = Path.GetFileName(Path.GetDirectoryName(args.Path));
-
- if (string.Equals(parentFolderName, BaseItem.ThemeSongsFolderName, StringComparison.OrdinalIgnoreCase))
- {
- return false;
- }
- if (string.Equals(parentFolderName, BaseItem.ThemeVideosFolderName, StringComparison.OrdinalIgnoreCase))
+ if (parent != null)
{
- return false;
+ var parentFolderName = Path.GetFileName(Path.GetDirectoryName(path));
+
+ if (string.Equals(parentFolderName, BaseItem.ThemeSongsFolderName, StringComparison.OrdinalIgnoreCase))
+ {
+ return false;
+ }
+ if (string.Equals(parentFolderName, BaseItem.ThemeVideosFolderName, StringComparison.OrdinalIgnoreCase))
+ {
+ return false;
+ }
}
// Sometimes these are marked hidden
- if (_fileSystem.IsRootPath(args.Path))
+ if (_fileSystem.IsRootPath(path))
{
return false;
}
@@ -83,7 +89,7 @@ namespace MediaBrowser.Server.Implementations.Library
return true;
}
- if (args.IsDirectory)
+ if (fileInfo.IsDirectory)
{
// Ignore any folders in our list
if (IgnoreFolders.Contains(filename, StringComparer.OrdinalIgnoreCase))
@@ -91,26 +97,29 @@ namespace MediaBrowser.Server.Implementations.Library
return true;
}
- // Ignore trailer folders but allow it at the collection level
- if (string.Equals(filename, BaseItem.TrailerFolderName, StringComparison.OrdinalIgnoreCase) &&
- !(args.Parent is AggregateFolder) && !(args.Parent is UserRootFolder))
+ if (parent != null)
{
- return true;
- }
+ // 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.ThemeVideosFolderName, StringComparison.OrdinalIgnoreCase))
+ {
+ return true;
+ }
- if (string.Equals(filename, BaseItem.ThemeSongsFolderName, StringComparison.OrdinalIgnoreCase))
- {
- return true;
+ if (string.Equals(filename, BaseItem.ThemeSongsFolderName, StringComparison.OrdinalIgnoreCase))
+ {
+ return true;
+ }
}
}
else
{
- if (args.Parent != null)
+ if (parent != null)
{
// Don't resolve these into audio files
if (string.Equals(_fileSystem.GetFileNameWithoutExtension(filename), BaseItem.ThemeSongFilename) && _libraryManager.IsAudioFile(filename))