diff options
| author | Bond_009 <bond.009@outlook.com> | 2022-12-05 15:01:13 +0100 |
|---|---|---|
| committer | Bond_009 <bond.009@outlook.com> | 2022-12-05 15:01:13 +0100 |
| commit | 52194f56b5f07e3ae01e2fb6d121452e37d1e93f (patch) | |
| tree | fd638972f72ec49734ad07f831a3aae3b2501a1d /MediaBrowser.MediaEncoding/Probing | |
| parent | c7d50d640e614a3c13699e3041fbfcb258861c5a (diff) | |
Replace != null with is not null
Diffstat (limited to 'MediaBrowser.MediaEncoding/Probing')
| -rw-r--r-- | MediaBrowser.MediaEncoding/Probing/FFProbeHelpers.cs | 6 | ||||
| -rw-r--r-- | MediaBrowser.MediaEncoding/Probing/ProbeResultNormalizer.cs | 36 |
2 files changed, 21 insertions, 21 deletions
diff --git a/MediaBrowser.MediaEncoding/Probing/FFProbeHelpers.cs b/MediaBrowser.MediaEncoding/Probing/FFProbeHelpers.cs index 205e84153..1b5b5262a 100644 --- a/MediaBrowser.MediaEncoding/Probing/FFProbeHelpers.cs +++ b/MediaBrowser.MediaEncoding/Probing/FFProbeHelpers.cs @@ -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); } diff --git a/MediaBrowser.MediaEncoding/Probing/ProbeResultNormalizer.cs b/MediaBrowser.MediaEncoding/Probing/ProbeResultNormalizer.cs index d5e90e855..7a3462b97 100644 --- a/MediaBrowser.MediaEncoding/Probing/ProbeResultNormalizer.cs +++ b/MediaBrowser.MediaEncoding/Probing/ProbeResultNormalizer.cs @@ -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; } |
