mirror of
https://github.com/jellyfin/jellyfin.git
synced 2025-06-02 13:15:25 -04:00
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.
This commit is contained in:
parent
8c76900470
commit
0cf8b376ac
@ -39,7 +39,7 @@ namespace Emby.Server.Implementations.Library
|
|||||||
item.GetParents().Any(i => i.IsLocked);
|
item.GetParents().Any(i => i.IsLocked);
|
||||||
|
|
||||||
// Make sure DateCreated and DateModified have values
|
// Make sure DateCreated and DateModified have values
|
||||||
var fileInfo = directoryService.GetFile(item.Path);
|
var fileInfo = directoryService.GetFileSystemEntry(item.Path);
|
||||||
if (fileInfo is null)
|
if (fileInfo is null)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
|
@ -61,10 +61,22 @@ namespace MediaBrowser.Controller.Providers
|
|||||||
}
|
}
|
||||||
|
|
||||||
public FileSystemMetadata? GetFile(string path)
|
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))
|
if (!_fileCache.TryGetValue(path, out var result))
|
||||||
{
|
{
|
||||||
var file = _fileSystem.GetFileInfo(path);
|
var file = _fileSystem.GetFileSystemInfo(path);
|
||||||
if (file.Exists)
|
if (file.Exists)
|
||||||
{
|
{
|
||||||
result = file;
|
result = file;
|
||||||
|
@ -15,6 +15,10 @@ namespace MediaBrowser.Controller.Providers
|
|||||||
|
|
||||||
FileSystemMetadata? GetFile(string path);
|
FileSystemMetadata? GetFile(string path);
|
||||||
|
|
||||||
|
FileSystemMetadata? GetDirectory(string path);
|
||||||
|
|
||||||
|
FileSystemMetadata? GetFileSystemEntry(string path);
|
||||||
|
|
||||||
IReadOnlyList<string> GetFilePaths(string path);
|
IReadOnlyList<string> GetFilePaths(string path);
|
||||||
|
|
||||||
IReadOnlyList<string> GetFilePaths(string path, bool clearCache, bool sort = false);
|
IReadOnlyList<string> GetFilePaths(string path, bool clearCache, bool sort = false);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user