aboutsummaryrefslogtreecommitdiff
path: root/MediaBrowser.Controller
diff options
context:
space:
mode:
authorBond_009 <bond.009@outlook.com>2021-05-07 00:52:06 +0200
committerBond_009 <bond.009@outlook.com>2021-05-07 00:52:06 +0200
commit4367b97a54f31233e242ef1afe6714b934ecf4d9 (patch)
tree7152a38c3fd4ffdfa8d39ca2c1a28d01113f43b7 /MediaBrowser.Controller
parentfb090df0b59b71d7f143d2181d46f18943bbc35e (diff)
Fix build
Diffstat (limited to 'MediaBrowser.Controller')
-rw-r--r--MediaBrowser.Controller/Library/TVUtils.cs2
-rw-r--r--MediaBrowser.Controller/Providers/DirectoryService.cs19
-rw-r--r--MediaBrowser.Controller/Providers/IDirectoryService.cs2
3 files changed, 11 insertions, 12 deletions
diff --git a/MediaBrowser.Controller/Library/TVUtils.cs b/MediaBrowser.Controller/Library/TVUtils.cs
index 8cbfc78aad..968338dc6a 100644
--- a/MediaBrowser.Controller/Library/TVUtils.cs
+++ b/MediaBrowser.Controller/Library/TVUtils.cs
@@ -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))
{
diff --git a/MediaBrowser.Controller/Providers/DirectoryService.cs b/MediaBrowser.Controller/Providers/DirectoryService.cs
index 5c92069b44..291a268830 100644
--- a/MediaBrowser.Controller/Providers/DirectoryService.cs
+++ b/MediaBrowser.Controller/Providers/DirectoryService.cs
@@ -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;
diff --git a/MediaBrowser.Controller/Providers/IDirectoryService.cs b/MediaBrowser.Controller/Providers/IDirectoryService.cs
index f06481c7a9..9cee06a4c6 100644
--- a/MediaBrowser.Controller/Providers/IDirectoryService.cs
+++ b/MediaBrowser.Controller/Providers/IDirectoryService.cs
@@ -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);