mirror of
https://github.com/jellyfin/jellyfin.git
synced 2025-12-24 01:34:45 +03:00
Update to 3.5.2 and .net core 2.1
This commit is contained in:
@@ -22,10 +22,12 @@ namespace Emby.Server.Implementations.Library
|
||||
private readonly ILibraryManager _libraryManager;
|
||||
private readonly ILogger _logger;
|
||||
|
||||
private bool _ignoreDotPrefix;
|
||||
|
||||
/// <summary>
|
||||
/// Any folder named in this list will be ignored - can be added to at runtime for extensibility
|
||||
/// </summary>
|
||||
public static readonly List<string> IgnoreFolders = new List<string>
|
||||
public static readonly Dictionary<string, string> IgnoreFolders = new List<string>
|
||||
{
|
||||
"metadata",
|
||||
"ps3_update",
|
||||
@@ -41,15 +43,24 @@ namespace Emby.Server.Implementations.Library
|
||||
"#recycle",
|
||||
|
||||
// Qnap
|
||||
"@Recycle"
|
||||
"@Recycle",
|
||||
".@__thumb",
|
||||
"$RECYCLE.BIN",
|
||||
"System Volume Information",
|
||||
".grab",
|
||||
|
||||
// macos
|
||||
".AppleDouble"
|
||||
|
||||
}.ToDictionary(i => i, StringComparer.OrdinalIgnoreCase);
|
||||
|
||||
};
|
||||
|
||||
public CoreResolutionIgnoreRule(IFileSystem fileSystem, ILibraryManager libraryManager, ILogger logger)
|
||||
{
|
||||
_fileSystem = fileSystem;
|
||||
_libraryManager = libraryManager;
|
||||
_logger = logger;
|
||||
|
||||
_ignoreDotPrefix = Environment.OSVersion.Platform != PlatformID.Win32NT;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -67,46 +78,48 @@ namespace Emby.Server.Implementations.Library
|
||||
}
|
||||
|
||||
var filename = fileInfo.Name;
|
||||
var isHidden = fileInfo.IsHidden;
|
||||
var path = fileInfo.FullName;
|
||||
|
||||
// Handle mac .DS_Store
|
||||
// https://github.com/MediaBrowser/MediaBrowser/issues/427
|
||||
if (filename.IndexOf("._", StringComparison.OrdinalIgnoreCase) == 0)
|
||||
if (_ignoreDotPrefix)
|
||||
{
|
||||
return true;
|
||||
if (filename.IndexOf('.') == 0)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
// Ignore hidden files and folders
|
||||
if (isHidden)
|
||||
{
|
||||
if (parent == null)
|
||||
{
|
||||
var parentFolderName = Path.GetFileName(_fileSystem.GetDirectoryName(path));
|
||||
//if (fileInfo.IsHidden)
|
||||
//{
|
||||
// if (parent == null)
|
||||
// {
|
||||
// var parentFolderName = Path.GetFileName(_fileSystem.GetDirectoryName(path));
|
||||
|
||||
if (string.Equals(parentFolderName, BaseItem.ThemeSongsFolderName, StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if (string.Equals(parentFolderName, BaseItem.ThemeVideosFolderName, StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
// 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(path))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
// // Sometimes these are marked hidden
|
||||
// if (_fileSystem.IsRootPath(path))
|
||||
// {
|
||||
// return false;
|
||||
// }
|
||||
|
||||
return true;
|
||||
}
|
||||
// return true;
|
||||
//}
|
||||
|
||||
if (fileInfo.IsDirectory)
|
||||
{
|
||||
// Ignore any folders in our list
|
||||
if (IgnoreFolders.Contains(filename, StringComparer.OrdinalIgnoreCase))
|
||||
if (IgnoreFolders.ContainsKey(filename))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
@@ -141,6 +154,17 @@ namespace Emby.Server.Implementations.Library
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
// Ignore samples
|
||||
var sampleFilename = " " + filename.Replace(".", " ", StringComparison.OrdinalIgnoreCase)
|
||||
.Replace("-", " ", StringComparison.OrdinalIgnoreCase)
|
||||
.Replace("_", " ", StringComparison.OrdinalIgnoreCase)
|
||||
.Replace("!", " ", StringComparison.OrdinalIgnoreCase);
|
||||
|
||||
if (sampleFilename.IndexOf(" sample ", StringComparison.OrdinalIgnoreCase) != -1)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
|
||||
Reference in New Issue
Block a user