mirror of
https://github.com/jellyfin/jellyfin.git
synced 2026-05-31 04:48:27 +01:00
Replace != null with is not null
This commit is contained in:
@@ -34,7 +34,7 @@ namespace MediaBrowser.MediaEncoding.BdInfo
|
||||
get
|
||||
{
|
||||
var parentFolder = System.IO.Path.GetDirectoryName(_impl.FullName);
|
||||
if (parentFolder != null)
|
||||
if (parentFolder is not null)
|
||||
{
|
||||
return new BdInfoDirectoryInfo(_fileSystem, parentFolder);
|
||||
}
|
||||
|
||||
@@ -89,7 +89,7 @@ namespace MediaBrowser.MediaEncoding.BdInfo
|
||||
|
||||
outputStream.PlaylistName = playlist.Name;
|
||||
|
||||
if (playlist.StreamClips != null && playlist.StreamClips.Any())
|
||||
if (playlist.StreamClips is not null && playlist.StreamClips.Any())
|
||||
{
|
||||
// Get the files in the playlist
|
||||
outputStream.Files = playlist.StreamClips.Select(i => i.StreamFile.Name).ToArray();
|
||||
|
||||
@@ -188,11 +188,11 @@ namespace MediaBrowser.MediaEncoding.Encoder
|
||||
// Work out what the version under test is
|
||||
var version = GetFFmpegVersionInternal(versionOutput);
|
||||
|
||||
_logger.LogInformation("Found ffmpeg version {Version}", version != null ? version.ToString() : "unknown");
|
||||
_logger.LogInformation("Found ffmpeg version {Version}", version is not null ? version.ToString() : "unknown");
|
||||
|
||||
if (version is null)
|
||||
{
|
||||
if (MaxVersion != null) // Version is unknown
|
||||
if (MaxVersion is not null) // Version is unknown
|
||||
{
|
||||
if (MinVersion == MaxVersion)
|
||||
{
|
||||
@@ -215,7 +215,7 @@ namespace MediaBrowser.MediaEncoding.Encoder
|
||||
_logger.LogWarning("FFmpeg validation: The minimum recommended version is {MinVersion}", MinVersion);
|
||||
return false;
|
||||
}
|
||||
else if (MaxVersion != null && version > MaxVersion) // Version is above what we recommend
|
||||
else if (MaxVersion is not null && version > MaxVersion) // Version is above what we recommend
|
||||
{
|
||||
_logger.LogWarning("FFmpeg validation: The maximum recommended version is {MaxVersion}", MaxVersion);
|
||||
return false;
|
||||
|
||||
@@ -157,7 +157,7 @@ namespace MediaBrowser.MediaEncoding.Encoder
|
||||
_configurationManager.SaveConfiguration("encoding", options);
|
||||
|
||||
// Only if mpeg path is set, try and set path to probe
|
||||
if (_ffmpegPath != null)
|
||||
if (_ffmpegPath is not null)
|
||||
{
|
||||
// Determine a probe path from the mpeg path
|
||||
_ffprobePath = Regex.Replace(_ffmpegPath, @"[^\/\\]+?(\.[^\/\\\n.]+)?$", @"ffprobe$1");
|
||||
@@ -536,7 +536,7 @@ namespace MediaBrowser.MediaEncoding.Encoder
|
||||
throw new FfmpegException("ffprobe failed - streams and format are both null.");
|
||||
}
|
||||
|
||||
if (result.Streams != null)
|
||||
if (result.Streams is not null)
|
||||
{
|
||||
// Normalize aspect ratio if invalid
|
||||
foreach (var stream in result.Streams)
|
||||
@@ -660,7 +660,7 @@ namespace MediaBrowser.MediaEncoding.Encoder
|
||||
var filters = new List<string>();
|
||||
|
||||
// deinterlace using bwdif algorithm for video stream.
|
||||
if (videoStream != null && videoStream.IsInterlaced)
|
||||
if (videoStream is not null && videoStream.IsInterlaced)
|
||||
{
|
||||
filters.Add("bwdif=0:-1:0");
|
||||
}
|
||||
@@ -1017,7 +1017,7 @@ namespace MediaBrowser.MediaEncoding.Encoder
|
||||
{
|
||||
if (!_disposed)
|
||||
{
|
||||
if (Process != null)
|
||||
if (Process is not null)
|
||||
{
|
||||
Process.Exited -= OnProcessExited;
|
||||
DisposeProcess(Process);
|
||||
|
||||
@@ -17,17 +17,17 @@ namespace MediaBrowser.MediaEncoding.Probing
|
||||
{
|
||||
ArgumentNullException.ThrowIfNull(result);
|
||||
|
||||
if (result.Format?.Tags != null)
|
||||
if (result.Format?.Tags is not null)
|
||||
{
|
||||
result.Format.Tags = ConvertDictionaryToCaseInsensitive(result.Format.Tags);
|
||||
}
|
||||
|
||||
if (result.Streams != null)
|
||||
if (result.Streams is not null)
|
||||
{
|
||||
// Convert all dictionaries to case insensitive
|
||||
foreach (var stream in result.Streams)
|
||||
{
|
||||
if (stream.Tags != null)
|
||||
if (stream.Tags is not null)
|
||||
{
|
||||
stream.Tags = ConvertDictionaryToCaseInsensitive(stream.Tags);
|
||||
}
|
||||
|
||||
@@ -83,16 +83,16 @@ namespace MediaBrowser.MediaEncoding.Probing
|
||||
var internalStreams = data.Streams ?? Array.Empty<MediaStreamInfo>();
|
||||
|
||||
info.MediaStreams = internalStreams.Select(s => GetMediaStream(isAudio, s, data.Format))
|
||||
.Where(i => i != null)
|
||||
.Where(i => i is not null)
|
||||
// Drop subtitle streams if we don't know the codec because it will just cause failures if we don't know how to handle them
|
||||
.Where(i => i.Type != MediaStreamType.Subtitle || !string.IsNullOrWhiteSpace(i.Codec))
|
||||
.ToList();
|
||||
|
||||
info.MediaAttachments = internalStreams.Select(GetMediaAttachment)
|
||||
.Where(i => i != null)
|
||||
.Where(i => i is not null)
|
||||
.ToList();
|
||||
|
||||
if (data.Format != null)
|
||||
if (data.Format is not null)
|
||||
{
|
||||
info.Container = NormalizeFormat(data.Format.FormatName);
|
||||
|
||||
@@ -110,7 +110,7 @@ namespace MediaBrowser.MediaEncoding.Probing
|
||||
|
||||
var tagStream = data.Streams?.FirstOrDefault(i => string.Equals(i.CodecType, tagStreamType, StringComparison.OrdinalIgnoreCase));
|
||||
|
||||
if (tagStream?.Tags != null)
|
||||
if (tagStream?.Tags is not null)
|
||||
{
|
||||
foreach (var (key, value) in tagStream.Tags)
|
||||
{
|
||||
@@ -118,7 +118,7 @@ namespace MediaBrowser.MediaEncoding.Probing
|
||||
}
|
||||
}
|
||||
|
||||
if (data.Format?.Tags != null)
|
||||
if (data.Format?.Tags is not null)
|
||||
{
|
||||
foreach (var (key, value) in data.Format.Tags)
|
||||
{
|
||||
@@ -182,7 +182,7 @@ namespace MediaBrowser.MediaEncoding.Probing
|
||||
FetchStudios(info, tags, "copyright");
|
||||
|
||||
var iTunExtc = tags.GetFirstNotNullNorWhiteSpaceValue("iTunEXTC");
|
||||
if (iTunExtc != null)
|
||||
if (iTunExtc is not null)
|
||||
{
|
||||
var parts = iTunExtc.Split('|', StringSplitOptions.RemoveEmptyEntries);
|
||||
// Example
|
||||
@@ -199,19 +199,19 @@ namespace MediaBrowser.MediaEncoding.Probing
|
||||
}
|
||||
|
||||
var iTunXml = tags.GetFirstNotNullNorWhiteSpaceValue("iTunMOVI");
|
||||
if (iTunXml != null)
|
||||
if (iTunXml is not null)
|
||||
{
|
||||
FetchFromItunesInfo(iTunXml, info);
|
||||
}
|
||||
|
||||
if (data.Format != null && !string.IsNullOrEmpty(data.Format.Duration))
|
||||
if (data.Format is not null && !string.IsNullOrEmpty(data.Format.Duration))
|
||||
{
|
||||
info.RunTimeTicks = TimeSpan.FromSeconds(double.Parse(data.Format.Duration, CultureInfo.InvariantCulture)).Ticks;
|
||||
}
|
||||
|
||||
FetchWtvInfo(info, data);
|
||||
|
||||
if (data.Chapters != null)
|
||||
if (data.Chapters is not null)
|
||||
{
|
||||
info.Chapters = data.Chapters.Select(GetChapterInfo).ToArray();
|
||||
}
|
||||
@@ -459,7 +459,7 @@ namespace MediaBrowser.MediaEncoding.Probing
|
||||
using (var subtree = reader.ReadSubtree())
|
||||
{
|
||||
var dict = GetNameValuePair(subtree);
|
||||
if (dict != null)
|
||||
if (dict is not null)
|
||||
{
|
||||
pairs.Add(dict);
|
||||
}
|
||||
@@ -614,7 +614,7 @@ namespace MediaBrowser.MediaEncoding.Probing
|
||||
attachment.CodecTag = streamInfo.CodecTagString;
|
||||
}
|
||||
|
||||
if (streamInfo.Tags != null)
|
||||
if (streamInfo.Tags is not null)
|
||||
{
|
||||
attachment.FileName = GetDictionaryValue(streamInfo.Tags, "filename");
|
||||
attachment.MimeType = GetDictionaryValue(streamInfo.Tags, "mimetype");
|
||||
@@ -680,7 +680,7 @@ namespace MediaBrowser.MediaEncoding.Probing
|
||||
stream.CodecTag = streamInfo.CodecTagString;
|
||||
}
|
||||
|
||||
if (streamInfo.Tags != null)
|
||||
if (streamInfo.Tags is not null)
|
||||
{
|
||||
stream.Language = GetDictionaryValue(streamInfo.Tags, "language");
|
||||
stream.Comment = GetDictionaryValue(streamInfo.Tags, "comment");
|
||||
@@ -855,7 +855,7 @@ namespace MediaBrowser.MediaEncoding.Probing
|
||||
stream.ColorPrimaries = streamInfo.ColorPrimaries;
|
||||
}
|
||||
|
||||
if (streamInfo.SideDataList != null)
|
||||
if (streamInfo.SideDataList is not null)
|
||||
{
|
||||
foreach (var data in streamInfo.SideDataList)
|
||||
{
|
||||
@@ -899,7 +899,7 @@ namespace MediaBrowser.MediaEncoding.Probing
|
||||
|
||||
// The bitrate info of FLAC musics and some videos is included in formatInfo.
|
||||
if (bitrate == 0
|
||||
&& formatInfo != null
|
||||
&& formatInfo is not null
|
||||
&& !string.IsNullOrEmpty(formatInfo.BitRate)
|
||||
&& (stream.Type == MediaStreamType.Video || (isAudio && stream.Type == MediaStreamType.Audio)))
|
||||
{
|
||||
@@ -934,7 +934,7 @@ namespace MediaBrowser.MediaEncoding.Probing
|
||||
{
|
||||
var durationInSeconds = GetRuntimeSecondsFromTags(streamInfo);
|
||||
var bytes = GetNumberOfBytesFromTags(streamInfo);
|
||||
if (durationInSeconds != null && bytes != null)
|
||||
if (durationInSeconds is not null && bytes is not null)
|
||||
{
|
||||
var bps = Convert.ToInt32(bytes * 8 / durationInSeconds, CultureInfo.InvariantCulture);
|
||||
if (bps > 0)
|
||||
@@ -945,7 +945,7 @@ namespace MediaBrowser.MediaEncoding.Probing
|
||||
}
|
||||
|
||||
var disposition = streamInfo.Disposition;
|
||||
if (disposition != null)
|
||||
if (disposition is not null)
|
||||
{
|
||||
if (disposition.GetValueOrDefault("default") == 1)
|
||||
{
|
||||
@@ -1294,7 +1294,7 @@ namespace MediaBrowser.MediaEncoding.Probing
|
||||
|
||||
// Set album artist
|
||||
var albumArtist = tags.GetFirstNotNullNorWhiteSpaceValue("albumartist", "album artist", "album_artist");
|
||||
audio.AlbumArtists = albumArtist != null
|
||||
audio.AlbumArtists = albumArtist is not null
|
||||
? SplitDistinctArtists(albumArtist, _nameDelimiters, true).ToArray()
|
||||
: Array.Empty<string>();
|
||||
|
||||
@@ -1489,7 +1489,7 @@ namespace MediaBrowser.MediaEncoding.Probing
|
||||
{
|
||||
var info = new ChapterInfo();
|
||||
|
||||
if (chapter.Tags != null && chapter.Tags.TryGetValue("title", out string name))
|
||||
if (chapter.Tags is not null && chapter.Tags.TryGetValue("title", out string name))
|
||||
{
|
||||
info.Name = name;
|
||||
}
|
||||
|
||||
@@ -174,7 +174,7 @@ namespace MediaBrowser.MediaEncoding.Subtitles
|
||||
var result = CharsetDetector.DetectFromStream(stream).Detected;
|
||||
stream.Position = 0;
|
||||
|
||||
if (result != null)
|
||||
if (result is not null)
|
||||
{
|
||||
_logger.LogDebug("charset {CharSet} detected for {Path}", result.EncodingName, fileInfo.Path);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user