mirror of
https://github.com/jellyfin/jellyfin.git
synced 2026-06-02 13:58:29 +01:00
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:
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user