Fix build

This commit is contained in:
Bond_009 2021-05-07 00:52:06 +02:00
parent fb090df0b5
commit 4367b97a54
12 changed files with 24 additions and 20 deletions

View File

@ -44,6 +44,11 @@ namespace Emby.Server.Implementations.Library
// Make sure DateCreated and DateModified have values
var fileInfo = directoryService.GetFile(item.Path);
if (fileInfo == null)
{
throw new FileNotFoundException("Can't find item path.", item.Path);
}
SetDateCreated(item, fileInfo);
EnsureName(item, fileInfo);

View File

@ -14,7 +14,7 @@ namespace MediaBrowser.Controller.Library
/// <param name="day">The day.</param>
/// <returns>List{DayOfWeek}.</returns>
[return: NotNullIfNotNull("day")]
public static DayOfWeek[] GetAirDays(string? day)
public static DayOfWeek[]? GetAirDays(string? day)
{
if (!string.IsNullOrEmpty(day))
{

View File

@ -43,18 +43,17 @@ namespace MediaBrowser.Controller.Providers
return list;
}
public FileSystemMetadata GetFile(string path)
public FileSystemMetadata? GetFile(string path)
{
var result = _fileCache.GetOrAdd(path, p =>
if (!_fileCache.TryGetValue(path, out var result))
{
var file = _fileSystem.GetFileInfo(p);
return file != null && file.Exists ? file : null;
});
if (result == null)
{
// lets not store null results in the cache
_fileCache.TryRemove(path, out _);
var file = _fileSystem.GetFileInfo(path);
var res = file != null && file.Exists ? file : null;
if (res != null)
{
result = res;
_fileCache.TryAdd(path, result);
}
}
return result;

View File

@ -11,7 +11,7 @@ namespace MediaBrowser.Controller.Providers
List<FileSystemMetadata> GetFiles(string path);
FileSystemMetadata GetFile(string path);
FileSystemMetadata? GetFile(string path);
IReadOnlyList<string> GetFilePaths(string path);

View File

@ -91,7 +91,7 @@ namespace MediaBrowser.LocalMetadata
/// <param name="info">Item inf.</param>
/// <param name="directoryService">Instance of the <see cref="IDirectoryService"/> interface.</param>
/// <returns>The file system metadata.</returns>
protected abstract FileSystemMetadata GetXmlFile(ItemInfo info, IDirectoryService directoryService);
protected abstract FileSystemMetadata? GetXmlFile(ItemInfo info, IDirectoryService directoryService);
/// <inheritdoc />
public bool HasChanged(BaseItem item, IDirectoryService directoryService)

View File

@ -36,7 +36,7 @@ namespace MediaBrowser.LocalMetadata.Providers
}
/// <inheritdoc />
protected override FileSystemMetadata GetXmlFile(ItemInfo info, IDirectoryService directoryService)
protected override FileSystemMetadata? GetXmlFile(ItemInfo info, IDirectoryService directoryService)
{
return directoryService.GetFile(Path.Combine(info.Path, "collection.xml"));
}

View File

@ -39,7 +39,7 @@ namespace MediaBrowser.LocalMetadata.Providers
}
/// <inheritdoc />
protected override FileSystemMetadata GetXmlFile(ItemInfo info, IDirectoryService directoryService)
protected override FileSystemMetadata? GetXmlFile(ItemInfo info, IDirectoryService directoryService)
{
return directoryService.GetFile(PlaylistXmlSaver.GetSavePath(info.Path));
}

View File

@ -57,7 +57,7 @@ namespace MediaBrowser.XbmcMetadata.Providers
}
/// <inheritdoc />
protected override FileSystemMetadata GetXmlFile(ItemInfo info, IDirectoryService directoryService)
protected override FileSystemMetadata? GetXmlFile(ItemInfo info, IDirectoryService directoryService)
=> directoryService.GetFile(Path.Combine(info.Path, "album.nfo"));
}
}

View File

@ -57,7 +57,7 @@ namespace MediaBrowser.XbmcMetadata.Providers
}
/// <inheritdoc />
protected override FileSystemMetadata GetXmlFile(ItemInfo info, IDirectoryService directoryService)
protected override FileSystemMetadata? GetXmlFile(ItemInfo info, IDirectoryService directoryService)
=> directoryService.GetFile(Path.Combine(info.Path, "artist.nfo"));
}
}

View File

@ -57,7 +57,7 @@ namespace MediaBrowser.XbmcMetadata.Providers
}
/// <inheritdoc />
protected override FileSystemMetadata GetXmlFile(ItemInfo info, IDirectoryService directoryService)
protected override FileSystemMetadata? GetXmlFile(ItemInfo info, IDirectoryService directoryService)
{
var path = Path.ChangeExtension(info.Path, ".nfo");

View File

@ -57,7 +57,7 @@ namespace MediaBrowser.XbmcMetadata.Providers
}
/// <inheritdoc />
protected override FileSystemMetadata GetXmlFile(ItemInfo info, IDirectoryService directoryService)
protected override FileSystemMetadata? GetXmlFile(ItemInfo info, IDirectoryService directoryService)
=> directoryService.GetFile(Path.Combine(info.Path, "season.nfo"));
}
}

View File

@ -57,7 +57,7 @@ namespace MediaBrowser.XbmcMetadata.Providers
}
/// <inheritdoc />
protected override FileSystemMetadata GetXmlFile(ItemInfo info, IDirectoryService directoryService)
protected override FileSystemMetadata? GetXmlFile(ItemInfo info, IDirectoryService directoryService)
=> directoryService.GetFile(Path.Combine(info.Path, "tvshow.nfo"));
}
}