diff options
| author | Mikal Stordal <mikalstordal@gmail.com> | 2024-03-24 01:11:45 +0100 |
|---|---|---|
| committer | Mikal Stordal <mikalstordal@gmail.com> | 2024-06-11 02:01:15 +0200 |
| commit | 0cf8b376acb9bb59be93865c566735df39490d0d (patch) | |
| tree | 6662dfc7a87918a0d8859a7b3260ff741dda44c9 /MediaBrowser.Controller/Providers/DirectoryService.cs | |
| parent | 8c76900470911a784b7bcbcf0d0bea24f3c6a65a (diff) | |
Don't expect `BaseItem` to be a movie/video file.
This fix is mainly so I can mass-add series _and_ movie entries using a
`IMultiItemResolver` without having to resort to complicated logic
using _both_ a `IItemResolver` and a `IMultiItemResolver` by splitting
up what gets added where.
I've also added three new interface methods to the `IDirectoryService`,
one of which is used in the modified
`ResolverHelper.SetInitialItemValues(…)` to get the file system entry
info for the item regardless of which type the file system entry is.
In my local testing so far I haven't found any issues introduced
by this change.
Diffstat (limited to 'MediaBrowser.Controller/Providers/DirectoryService.cs')
| -rw-r--r-- | MediaBrowser.Controller/Providers/DirectoryService.cs | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/MediaBrowser.Controller/Providers/DirectoryService.cs b/MediaBrowser.Controller/Providers/DirectoryService.cs index 56b07ebae..5ab1e2798 100644 --- a/MediaBrowser.Controller/Providers/DirectoryService.cs +++ b/MediaBrowser.Controller/Providers/DirectoryService.cs @@ -62,9 +62,21 @@ namespace MediaBrowser.Controller.Providers public FileSystemMetadata? GetFile(string path) { + var entry = GetFileSystemEntry(path); + return entry != null && !entry.IsDirectory ? entry : null; + } + + public FileSystemMetadata? GetDirectory(string path) + { + var entry = GetFileSystemEntry(path); + return entry != null && entry.IsDirectory ? entry : null; + } + + public FileSystemMetadata? GetFileSystemEntry(string path) + { if (!_fileCache.TryGetValue(path, out var result)) { - var file = _fileSystem.GetFileInfo(path); + var file = _fileSystem.GetFileSystemInfo(path); if (file.Exists) { result = file; |
