mirror of
https://github.com/jellyfin/jellyfin.git
synced 2026-06-14 11:40:42 +01:00
Replace == null with is null
This commit is contained in:
@@ -176,7 +176,7 @@ namespace Emby.Server.Implementations.Library
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_rootFolder == null)
|
||||
if (_rootFolder is null)
|
||||
{
|
||||
lock (_rootFolderSyncLock)
|
||||
{
|
||||
@@ -656,7 +656,7 @@ namespace Emby.Server.Implementations.Library
|
||||
|
||||
if (parent != null)
|
||||
{
|
||||
var multiItemResolvers = resolvers == null ? MultiItemResolvers : resolvers.OfType<IMultiItemResolver>().ToArray();
|
||||
var multiItemResolvers = resolvers is null ? MultiItemResolvers : resolvers.OfType<IMultiItemResolver>().ToArray();
|
||||
|
||||
foreach (var resolver in multiItemResolvers)
|
||||
{
|
||||
@@ -770,11 +770,11 @@ namespace Emby.Server.Implementations.Library
|
||||
|
||||
public Folder GetUserRootFolder()
|
||||
{
|
||||
if (_userRootFolder == null)
|
||||
if (_userRootFolder is null)
|
||||
{
|
||||
lock (_userRootFolderSyncLock)
|
||||
{
|
||||
if (_userRootFolder == null)
|
||||
if (_userRootFolder is null)
|
||||
{
|
||||
var userRootPath = _configurationManager.ApplicationPaths.DefaultUserViewsPath;
|
||||
|
||||
@@ -792,7 +792,7 @@ namespace Emby.Server.Implementations.Library
|
||||
_logger.LogError(ex, "Error creating UserRootFolder {Path}", newItemId);
|
||||
}
|
||||
|
||||
if (tmpItem == null)
|
||||
if (tmpItem is null)
|
||||
{
|
||||
_logger.LogDebug("Creating new userRootFolder with DeepCopy");
|
||||
tmpItem = ((Folder)ResolvePath(_fileSystem.GetDirectoryInfo(userRootPath))).DeepCopy<Folder, UserRootFolder>();
|
||||
@@ -961,7 +961,7 @@ namespace Emby.Server.Implementations.Library
|
||||
var path = getPathFn(name);
|
||||
var id = GetItemByNameId<T>(path);
|
||||
var item = GetItemById(id) as T;
|
||||
if (item == null)
|
||||
if (item is null)
|
||||
{
|
||||
item = new T
|
||||
{
|
||||
@@ -1627,7 +1627,7 @@ namespace Emby.Server.Implementations.Library
|
||||
// Get an existing item by Id
|
||||
video = GetItemById(info.ItemId.Value) as Video;
|
||||
|
||||
if (video == null)
|
||||
if (video is null)
|
||||
{
|
||||
_logger.LogError("Unable to locate item with Id {ID}.", info.ItemId.Value);
|
||||
}
|
||||
@@ -1639,7 +1639,7 @@ namespace Emby.Server.Implementations.Library
|
||||
// Try to resolve the path into a video
|
||||
video = ResolvePath(_fileSystem.GetFileSystemInfo(info.Path)) as Video;
|
||||
|
||||
if (video == null)
|
||||
if (video is null)
|
||||
{
|
||||
_logger.LogError("Intro resolver returned null for {Path}.", info.Path);
|
||||
}
|
||||
@@ -1711,7 +1711,7 @@ namespace Emby.Server.Implementations.Library
|
||||
foreach (var (name, sortOrder) in orderBy)
|
||||
{
|
||||
var comparer = GetComparer(name, user);
|
||||
if (comparer == null)
|
||||
if (comparer is null)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
@@ -2010,7 +2010,7 @@ namespace Emby.Server.Implementations.Library
|
||||
{
|
||||
var parent = item.GetParent();
|
||||
|
||||
if (parent == null || parent is AggregateFolder)
|
||||
if (parent is null || parent is AggregateFolder)
|
||||
{
|
||||
break;
|
||||
}
|
||||
@@ -2018,7 +2018,7 @@ namespace Emby.Server.Implementations.Library
|
||||
item = parent;
|
||||
}
|
||||
|
||||
if (item == null)
|
||||
if (item is null)
|
||||
{
|
||||
return new List<Folder>();
|
||||
}
|
||||
@@ -2032,7 +2032,7 @@ namespace Emby.Server.Implementations.Library
|
||||
{
|
||||
var parent = item.GetParent();
|
||||
|
||||
if (parent == null || parent is AggregateFolder)
|
||||
if (parent is null || parent is AggregateFolder)
|
||||
{
|
||||
break;
|
||||
}
|
||||
@@ -2040,7 +2040,7 @@ namespace Emby.Server.Implementations.Library
|
||||
item = parent;
|
||||
}
|
||||
|
||||
if (item == null)
|
||||
if (item is null)
|
||||
{
|
||||
return new List<Folder>();
|
||||
}
|
||||
@@ -2064,7 +2064,7 @@ namespace Emby.Server.Implementations.Library
|
||||
.Find(folder => folder is CollectionFolder) as CollectionFolder;
|
||||
}
|
||||
|
||||
return collectionFolder == null ? new LibraryOptions() : collectionFolder.GetLibraryOptions();
|
||||
return collectionFolder is null ? new LibraryOptions() : collectionFolder.GetLibraryOptions();
|
||||
}
|
||||
|
||||
public string GetContentType(BaseItem item)
|
||||
@@ -2129,7 +2129,7 @@ namespace Emby.Server.Implementations.Library
|
||||
|
||||
private string GetTopFolderContentType(BaseItem item)
|
||||
{
|
||||
if (item == null)
|
||||
if (item is null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
@@ -2137,7 +2137,7 @@ namespace Emby.Server.Implementations.Library
|
||||
while (!item.ParentId.Equals(default))
|
||||
{
|
||||
var parent = item.GetParent();
|
||||
if (parent == null || parent is AggregateFolder)
|
||||
if (parent is null || parent is AggregateFolder)
|
||||
{
|
||||
break;
|
||||
}
|
||||
@@ -2177,7 +2177,7 @@ namespace Emby.Server.Implementations.Library
|
||||
|
||||
var refresh = false;
|
||||
|
||||
if (item == null || !string.Equals(item.Path, path, StringComparison.OrdinalIgnoreCase))
|
||||
if (item is null || !string.Equals(item.Path, path, StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
Directory.CreateDirectory(path);
|
||||
|
||||
@@ -2225,7 +2225,7 @@ namespace Emby.Server.Implementations.Library
|
||||
|
||||
var isNew = false;
|
||||
|
||||
if (item == null)
|
||||
if (item is null)
|
||||
{
|
||||
Directory.CreateDirectory(path);
|
||||
|
||||
@@ -2289,7 +2289,7 @@ namespace Emby.Server.Implementations.Library
|
||||
|
||||
var isNew = false;
|
||||
|
||||
if (item == null)
|
||||
if (item is null)
|
||||
{
|
||||
Directory.CreateDirectory(path);
|
||||
|
||||
@@ -2362,7 +2362,7 @@ namespace Emby.Server.Implementations.Library
|
||||
|
||||
var isNew = false;
|
||||
|
||||
if (item == null)
|
||||
if (item is null)
|
||||
{
|
||||
Directory.CreateDirectory(path);
|
||||
|
||||
@@ -2459,7 +2459,7 @@ namespace Emby.Server.Implementations.Library
|
||||
episodeInfo = resolver.Resolve(episode.Path, isFolder, null, null, isAbsoluteNaming);
|
||||
// Resolve from parent folder if it's not the Season folder
|
||||
var parent = episode.GetParent();
|
||||
if (episodeInfo == null && parent.GetType() == typeof(Folder))
|
||||
if (episodeInfo is null && parent.GetType() == typeof(Folder))
|
||||
{
|
||||
episodeInfo = resolver.Resolve(parent.Path, true, null, null, isAbsoluteNaming);
|
||||
if (episodeInfo != null)
|
||||
@@ -2620,7 +2620,7 @@ namespace Emby.Server.Implementations.Library
|
||||
public IEnumerable<BaseItem> FindExtras(BaseItem owner, IReadOnlyList<FileSystemMetadata> fileSystemChildren, IDirectoryService directoryService)
|
||||
{
|
||||
var ownerVideoInfo = VideoResolver.Resolve(owner.Path, owner.IsFolder, _namingOptions);
|
||||
if (ownerVideoInfo == null)
|
||||
if (ownerVideoInfo is null)
|
||||
{
|
||||
yield break;
|
||||
}
|
||||
@@ -2754,7 +2754,7 @@ namespace Emby.Server.Implementations.Library
|
||||
}
|
||||
})
|
||||
.Where(i => i != null)
|
||||
.Where(i => query.User == null ?
|
||||
.Where(i => query.User is null ?
|
||||
true :
|
||||
i.IsVisible(query.User))
|
||||
.ToList();
|
||||
|
||||
@@ -60,7 +60,7 @@ namespace Emby.Server.Implementations.Library
|
||||
}
|
||||
}
|
||||
|
||||
if (mediaInfo == null)
|
||||
if (mediaInfo is null)
|
||||
{
|
||||
if (addProbeDelay)
|
||||
{
|
||||
@@ -130,7 +130,7 @@ namespace Emby.Server.Implementations.Library
|
||||
|
||||
var audioStream = mediaStreams.FirstOrDefault(i => i.Type == MediaStreamType.Audio);
|
||||
|
||||
if (audioStream == null || audioStream.Index == -1)
|
||||
if (audioStream is null || audioStream.Index == -1)
|
||||
{
|
||||
mediaSource.DefaultAudioStreamIndex = null;
|
||||
}
|
||||
|
||||
@@ -383,7 +383,7 @@ namespace Emby.Server.Implementations.Library
|
||||
var preferredSubs = NormalizeLanguage(user.SubtitleLanguagePreference);
|
||||
|
||||
var defaultAudioIndex = source.DefaultAudioStreamIndex;
|
||||
var audioLangage = defaultAudioIndex == null
|
||||
var audioLangage = defaultAudioIndex is null
|
||||
? null
|
||||
: source.MediaStreams.Where(i => i.Type == MediaStreamType.Audio && i.Index == defaultAudioIndex).Select(i => i.Language).FirstOrDefault();
|
||||
|
||||
@@ -417,13 +417,13 @@ namespace Emby.Server.Implementations.Library
|
||||
public void SetDefaultAudioAndSubtitleStreamIndexes(BaseItem item, MediaSourceInfo source, User user)
|
||||
{
|
||||
// Item would only be null if the app didn't supply ItemId as part of the live stream open request
|
||||
var mediaType = item == null ? MediaType.Video : item.MediaType;
|
||||
var mediaType = item is null ? MediaType.Video : item.MediaType;
|
||||
|
||||
if (string.Equals(mediaType, MediaType.Video, StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
var userData = item == null ? new UserItemData() : _userDataManager.GetUserData(user, item);
|
||||
var userData = item is null ? new UserItemData() : _userDataManager.GetUserData(user, item);
|
||||
|
||||
var allowRememberingSelection = item == null || item.EnableRememberingTrackSelections;
|
||||
var allowRememberingSelection = item is null || item.EnableRememberingTrackSelections;
|
||||
|
||||
SetDefaultAudioStreamIndex(source, userData, user, allowRememberingSelection);
|
||||
SetDefaultSubtitleStreamIndex(source, userData, user, allowRememberingSelection);
|
||||
@@ -543,7 +543,7 @@ namespace Emby.Server.Implementations.Library
|
||||
|
||||
var audioStream = mediaSource.MediaStreams.FirstOrDefault(i => i.Type == MediaStreamType.Audio);
|
||||
|
||||
if (audioStream == null || audioStream.Index == -1)
|
||||
if (audioStream is null || audioStream.Index == -1)
|
||||
{
|
||||
mediaSource.DefaultAudioStreamIndex = null;
|
||||
}
|
||||
@@ -638,7 +638,7 @@ namespace Emby.Server.Implementations.Library
|
||||
}
|
||||
}
|
||||
|
||||
if (mediaInfo == null)
|
||||
if (mediaInfo is null)
|
||||
{
|
||||
if (addProbeDelay)
|
||||
{
|
||||
@@ -713,7 +713,7 @@ namespace Emby.Server.Implementations.Library
|
||||
|
||||
var audioStream = mediaStreams.FirstOrDefault(i => i.Type == MediaStreamType.Audio);
|
||||
|
||||
if (audioStream == null || audioStream.Index == -1)
|
||||
if (audioStream is null || audioStream.Index == -1)
|
||||
{
|
||||
mediaSource.DefaultAudioStreamIndex = null;
|
||||
}
|
||||
|
||||
@@ -43,7 +43,7 @@ namespace Emby.Server.Implementations.Library
|
||||
|
||||
// Make sure DateCreated and DateModified have values
|
||||
var fileInfo = directoryService.GetFile(item.Path);
|
||||
if (fileInfo == null)
|
||||
if (fileInfo is null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -116,7 +116,7 @@ namespace Emby.Server.Implementations.Library.Resolvers.Audio
|
||||
|
||||
// Use regular audio type for mixed libraries, owned items and music
|
||||
if (isMixedCollectionType ||
|
||||
args.Parent == null ||
|
||||
args.Parent is null ||
|
||||
isMusicCollectionType)
|
||||
{
|
||||
item = new MediaBrowser.Controller.Entities.Audio.Audio();
|
||||
@@ -144,7 +144,7 @@ namespace Emby.Server.Implementations.Library.Resolvers.Audio
|
||||
// TODO: Allow GetMultiDiscMovie in here
|
||||
var result = ResolveMultipleAudio(args.Parent, args.GetActualFileSystemChildren(), parseName);
|
||||
|
||||
if (result == null || result.Items.Count != 1 || result.Items[0] is not AudioBook item)
|
||||
if (result is null || result.Items.Count != 1 || result.Items[0] is not AudioBook item)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -79,7 +79,7 @@ namespace Emby.Server.Implementations.Library.Resolvers
|
||||
videoType = VideoType.Dvd;
|
||||
}
|
||||
|
||||
if (videoType == null)
|
||||
if (videoType is null)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
@@ -93,7 +93,7 @@ namespace Emby.Server.Implementations.Library.Resolvers
|
||||
videoInfo = VideoResolver.Resolve(args.Path, false, NamingOptions, parseName);
|
||||
}
|
||||
|
||||
if (videoInfo == null || (!videoInfo.IsStub && !VideoResolver.IsVideoFile(args.Path, NamingOptions)))
|
||||
if (videoInfo is null || (!videoInfo.IsStub && !VideoResolver.IsVideoFile(args.Path, NamingOptions)))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -48,7 +48,7 @@ namespace Emby.Server.Implementations.Library.Resolvers
|
||||
public bool TryGetExtraTypeForOwner(string path, VideoFileInfo ownerVideoFileInfo, [NotNullWhen(true)] out ExtraType? extraType)
|
||||
{
|
||||
var extraResult = GetExtraInfo(path, _namingOptions);
|
||||
if (extraResult.ExtraType == null)
|
||||
if (extraResult.ExtraType is null)
|
||||
{
|
||||
extraType = null;
|
||||
return false;
|
||||
|
||||
@@ -22,7 +22,7 @@ namespace Emby.Server.Implementations.Library.Resolvers
|
||||
{
|
||||
base.SetInitialItemValues(item, args);
|
||||
|
||||
item.IsRoot = args.Parent == null;
|
||||
item.IsRoot = args.Parent is null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -108,7 +108,7 @@ namespace Emby.Server.Implementations.Library.Resolvers.Movies
|
||||
if (string.IsNullOrEmpty(collectionType))
|
||||
{
|
||||
// Owned items will be caught by the video extra resolver
|
||||
if (args.Parent == null)
|
||||
if (args.Parent is null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
@@ -127,10 +127,10 @@ namespace Emby.Server.Implementations.Library.Resolvers.Movies
|
||||
}
|
||||
|
||||
// ignore extras
|
||||
return movie?.ExtraType == null ? movie : null;
|
||||
return movie?.ExtraType is null ? movie : null;
|
||||
}
|
||||
|
||||
if (args.Parent == null)
|
||||
if (args.Parent is null)
|
||||
{
|
||||
return base.Resolve(args);
|
||||
}
|
||||
@@ -205,7 +205,7 @@ namespace Emby.Server.Implementations.Library.Resolvers.Movies
|
||||
if (string.IsNullOrEmpty(collectionType))
|
||||
{
|
||||
// Owned items should just use the plain video type
|
||||
if (parent == null)
|
||||
if (parent is null)
|
||||
{
|
||||
return ResolveVideos<Video>(parent, files, false, collectionType, false);
|
||||
}
|
||||
|
||||
@@ -34,7 +34,7 @@ namespace Emby.Server.Implementations.Library.Resolvers.TV
|
||||
{
|
||||
var parent = args.Parent;
|
||||
|
||||
if (parent == null)
|
||||
if (parent is null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
@@ -53,7 +53,7 @@ namespace Emby.Server.Implementations.Library.Resolvers.TV
|
||||
var episode = ResolveVideo<Episode>(args, false);
|
||||
|
||||
// Ignore extras
|
||||
if (episode == null || episode.ExtraType != null)
|
||||
if (episode is null || episode.ExtraType != null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
@@ -73,7 +73,7 @@ namespace Emby.Server.Implementations.Library.Resolvers.TV
|
||||
}
|
||||
|
||||
// Assume season 1 if there's no season folder and a season number could not be determined
|
||||
if (season == null && !episode.ParentIndexNumber.HasValue && (episode.IndexNumber.HasValue || episode.PremiereDate.HasValue))
|
||||
if (season is null && !episode.ParentIndexNumber.HasValue && (episode.IndexNumber.HasValue || episode.PremiereDate.HasValue))
|
||||
{
|
||||
episode.ParentIndexNumber = 1;
|
||||
}
|
||||
|
||||
@@ -47,7 +47,7 @@ namespace Emby.Server.Implementations.Library
|
||||
{
|
||||
var user = _userManager.GetUserById(query.UserId);
|
||||
|
||||
if (user == null)
|
||||
if (user is null)
|
||||
{
|
||||
throw new ArgumentException("User Id specified in the query does not exist.", nameof(query));
|
||||
}
|
||||
@@ -208,7 +208,7 @@ namespace Emby.Server.Implementations.Library
|
||||
// Only grab the index container for media
|
||||
var container = item.IsFolder || !request.GroupItems ? null : item.LatestItemsIndexContainer;
|
||||
|
||||
if (container == null)
|
||||
if (container is null)
|
||||
{
|
||||
list.Add(new Tuple<BaseItem, List<BaseItem>>(null, new List<BaseItem> { item }));
|
||||
}
|
||||
|
||||
@@ -118,7 +118,7 @@ namespace Emby.Server.Implementations.Library.Validators
|
||||
try
|
||||
{
|
||||
var boxSet = boxSets.FirstOrDefault(b => b?.Name == collectionName) as BoxSet;
|
||||
if (boxSet == null)
|
||||
if (boxSet is null)
|
||||
{
|
||||
// won't automatically create collection if only one movie in it
|
||||
if (movieIds.Count >= 2)
|
||||
|
||||
Reference in New Issue
Block a user