Merge pull request #11204 from revam/fix-resolver-helper-init-values

Don't expect `BaseItem` to be a movie/video file.
This commit is contained in:
Bond-009
2024-06-27 09:45:56 +02:00
committed by GitHub
4 changed files with 79 additions and 11 deletions

View File

@@ -61,11 +61,23 @@ namespace MediaBrowser.Controller.Providers
}
public FileSystemMetadata? GetFile(string path)
{
var entry = GetFileSystemEntry(path);
return entry is not null && !entry.IsDirectory ? entry : null;
}
public FileSystemMetadata? GetDirectory(string path)
{
var entry = GetFileSystemEntry(path);
return entry is not null && entry.IsDirectory ? entry : null;
}
public FileSystemMetadata? GetFileSystemEntry(string path)
{
if (!_fileCache.TryGetValue(path, out var result))
{
var file = _fileSystem.GetFileInfo(path);
if (file.Exists)
var file = _fileSystem.GetFileSystemInfo(path);
if (file?.Exists ?? false)
{
result = file;
_fileCache.TryAdd(path, result);

View File

@@ -15,6 +15,10 @@ namespace MediaBrowser.Controller.Providers
FileSystemMetadata? GetFile(string path);
FileSystemMetadata? GetDirectory(string path);
FileSystemMetadata? GetFileSystemEntry(string path);
IReadOnlyList<string> GetFilePaths(string path);
IReadOnlyList<string> GetFilePaths(string path, bool clearCache, bool sort = false);