mirror of
https://github.com/jellyfin/jellyfin.git
synced 2026-07-19 04:34:18 +01:00
Replace != null with is not null
This commit is contained in:
@@ -74,7 +74,7 @@ namespace MediaBrowser.Controller.Entities
|
||||
return list;
|
||||
}
|
||||
|
||||
return _childrenIds.Select(LibraryManager.GetItemById).Where(i => i != null).ToList();
|
||||
return _childrenIds.Select(LibraryManager.GetItemById).Where(i => i is not null).ToList();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -81,8 +81,8 @@ namespace MediaBrowser.Controller.Entities.Audio
|
||||
/// <returns>System.String.</returns>
|
||||
protected override string CreateSortName()
|
||||
{
|
||||
return (ParentIndexNumber != null ? ParentIndexNumber.Value.ToString("0000 - ", CultureInfo.InvariantCulture) : string.Empty)
|
||||
+ (IndexNumber != null ? IndexNumber.Value.ToString("0000 - ", CultureInfo.InvariantCulture) : string.Empty) + Name;
|
||||
return (ParentIndexNumber is not null ? ParentIndexNumber.Value.ToString("0000 - ", CultureInfo.InvariantCulture) : string.Empty)
|
||||
+ (IndexNumber is not null ? IndexNumber.Value.ToString("0000 - ", CultureInfo.InvariantCulture) : string.Empty) + Name;
|
||||
}
|
||||
|
||||
public override List<string> GetUserDataKeys()
|
||||
|
||||
@@ -138,7 +138,7 @@ namespace MediaBrowser.Controller.Entities.Audio
|
||||
|
||||
var artist = GetMusicArtist(new DtoOptions(false));
|
||||
|
||||
if (artist != null)
|
||||
if (artist is not null)
|
||||
{
|
||||
id.ArtistProviderIds = artist.ProviderIds;
|
||||
}
|
||||
|
||||
@@ -658,7 +658,7 @@ namespace MediaBrowser.Controller.Entities
|
||||
}
|
||||
|
||||
var parent = DisplayParent;
|
||||
if (parent != null)
|
||||
if (parent is not null)
|
||||
{
|
||||
return parent.OfficialRatingForComparison;
|
||||
}
|
||||
@@ -679,7 +679,7 @@ namespace MediaBrowser.Controller.Entities
|
||||
}
|
||||
|
||||
var parent = DisplayParent;
|
||||
if (parent != null)
|
||||
if (parent is not null)
|
||||
{
|
||||
return parent.CustomRatingForComparison;
|
||||
}
|
||||
@@ -976,7 +976,7 @@ namespace MediaBrowser.Controller.Entities
|
||||
{
|
||||
var parent = GetParent();
|
||||
|
||||
while (parent != null)
|
||||
while (parent is not null)
|
||||
{
|
||||
yield return parent;
|
||||
|
||||
@@ -1114,7 +1114,7 @@ namespace MediaBrowser.Controller.Entities
|
||||
}
|
||||
|
||||
var video = item as Video;
|
||||
if (video != null)
|
||||
if (video is not null)
|
||||
{
|
||||
info.IsoType = video.IsoType;
|
||||
info.VideoType = video.VideoType;
|
||||
@@ -1153,7 +1153,7 @@ namespace MediaBrowser.Controller.Entities
|
||||
info.SupportsDirectStream = MediaSourceManager.SupportsDirectStream(info.Path, info.Protocol);
|
||||
}
|
||||
|
||||
if (video != null && video.VideoType != VideoType.VideoFile)
|
||||
if (video is not null && video.VideoType != VideoType.VideoFile)
|
||||
{
|
||||
info.SupportsDirectStream = false;
|
||||
}
|
||||
@@ -1692,7 +1692,7 @@ namespace MediaBrowser.Controller.Entities
|
||||
|
||||
var itemById = LibraryManager.GetItemById(info.ItemId.Value);
|
||||
|
||||
if (itemById != null)
|
||||
if (itemById is not null)
|
||||
{
|
||||
return itemById;
|
||||
}
|
||||
@@ -2060,7 +2060,7 @@ namespace MediaBrowser.Controller.Entities
|
||||
{
|
||||
var artist = FindParent<MusicArtist>();
|
||||
|
||||
if (artist != null)
|
||||
if (artist is not null)
|
||||
{
|
||||
return artist.GetImages(imageType).ElementAtOrDefault(imageIndex);
|
||||
}
|
||||
@@ -2274,14 +2274,14 @@ namespace MediaBrowser.Controller.Entities
|
||||
{
|
||||
var userdata = UserDataManager.GetUserData(user, this);
|
||||
|
||||
return userdata != null && userdata.Played;
|
||||
return userdata is not null && userdata.Played;
|
||||
}
|
||||
|
||||
public bool IsFavoriteOrLiked(User user)
|
||||
{
|
||||
var userdata = UserDataManager.GetUserData(user, this);
|
||||
|
||||
return userdata != null && (userdata.IsFavorite || (userdata.Likes ?? false));
|
||||
return userdata is not null && (userdata.IsFavorite || (userdata.Likes ?? false));
|
||||
}
|
||||
|
||||
public virtual bool IsUnplayed(User user)
|
||||
@@ -2565,7 +2565,7 @@ namespace MediaBrowser.Controller.Entities
|
||||
{
|
||||
return ExtraIds
|
||||
.Select(LibraryManager.GetItemById)
|
||||
.Where(i => i != null)
|
||||
.Where(i => i is not null)
|
||||
.OrderBy(i => i.SortName);
|
||||
}
|
||||
|
||||
@@ -2578,7 +2578,7 @@ namespace MediaBrowser.Controller.Entities
|
||||
{
|
||||
return ExtraIds
|
||||
.Select(LibraryManager.GetItemById)
|
||||
.Where(i => i != null)
|
||||
.Where(i => i is not null)
|
||||
.Where(i => i.ExtraType.HasValue && extraTypes.Contains(i.ExtraType.Value))
|
||||
.OrderBy(i => i.SortName);
|
||||
}
|
||||
|
||||
@@ -95,7 +95,7 @@ namespace MediaBrowser.Controller.Entities
|
||||
}
|
||||
|
||||
var p = destProps.Find(x => x.Name == sourceProp.Name);
|
||||
if (p != null)
|
||||
if (p is not null)
|
||||
{
|
||||
p.SetValue(dest, v);
|
||||
}
|
||||
|
||||
@@ -483,7 +483,7 @@ namespace MediaBrowser.Controller.Entities
|
||||
}
|
||||
});
|
||||
|
||||
if (container != null)
|
||||
if (container is not null)
|
||||
{
|
||||
await RefreshAllMetadataForContainer(container, refreshOptions, innerProgress, cancellationToken).ConfigureAwait(false);
|
||||
}
|
||||
@@ -515,7 +515,7 @@ namespace MediaBrowser.Controller.Entities
|
||||
async () =>
|
||||
{
|
||||
var series = container as Series;
|
||||
if (series != null)
|
||||
if (series is not null)
|
||||
{
|
||||
await series.RefreshMetadata(refreshOptions, cancellationToken).ConfigureAwait(false);
|
||||
}
|
||||
@@ -529,7 +529,7 @@ namespace MediaBrowser.Controller.Entities
|
||||
{
|
||||
var container = child as IMetadataContainer;
|
||||
|
||||
if (container != null)
|
||||
if (container is not null)
|
||||
{
|
||||
await RefreshAllMetadataForContainer(container, refreshOptions, progress, cancellationToken).ConfigureAwait(false);
|
||||
}
|
||||
@@ -741,7 +741,7 @@ namespace MediaBrowser.Controller.Entities
|
||||
IEnumerable<BaseItem> itemsList = LibraryManager.GetItemList(query);
|
||||
var user = query.User;
|
||||
|
||||
if (user != null)
|
||||
if (user is not null)
|
||||
{
|
||||
// needed for boxsets
|
||||
itemsList = itemsList.Where(i => i.IsVisibleStandalone(query.User));
|
||||
@@ -984,7 +984,7 @@ namespace MediaBrowser.Controller.Entities
|
||||
var user = query.User;
|
||||
|
||||
// Check recursive - don't substitute in plain folder views
|
||||
if (user != null)
|
||||
if (user is not null)
|
||||
{
|
||||
items = CollapseBoxSetItemsIfNeeded(items, query, this, user, ConfigurationManager, CollectionManager);
|
||||
}
|
||||
@@ -1069,7 +1069,7 @@ namespace MediaBrowser.Controller.Entities
|
||||
|
||||
if (!param.HasValue)
|
||||
{
|
||||
if (user != null && !configurationManager.Configuration.EnableGroupingIntoCollections)
|
||||
if (user is not null && !configurationManager.Configuration.EnableGroupingIntoCollections)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
@@ -1441,7 +1441,7 @@ namespace MediaBrowser.Controller.Entities
|
||||
{
|
||||
var child = GetLinkedChild(i);
|
||||
|
||||
if (child != null)
|
||||
if (child is not null)
|
||||
{
|
||||
list.Add(child);
|
||||
}
|
||||
@@ -1467,7 +1467,7 @@ namespace MediaBrowser.Controller.Entities
|
||||
|
||||
var child = GetLinkedChild(i);
|
||||
|
||||
if (child != null && child.Id.Equals(itemId))
|
||||
if (child is not null && child.Id.Equals(itemId))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
@@ -1547,7 +1547,7 @@ namespace MediaBrowser.Controller.Entities
|
||||
{
|
||||
return LinkedChildren
|
||||
.Select(i => new Tuple<LinkedChild, BaseItem>(i, GetLinkedChild(i)))
|
||||
.Where(i => i.Item2 != null);
|
||||
.Where(i => i.Item2 is not null);
|
||||
}
|
||||
|
||||
protected override async Task<bool> RefreshedOwnedItems(MetadataRefreshOptions options, IReadOnlyList<FileSystemMetadata> fileSystemChildren, CancellationToken cancellationToken)
|
||||
@@ -1605,7 +1605,7 @@ namespace MediaBrowser.Controller.Entities
|
||||
return null;
|
||||
}
|
||||
})
|
||||
.Where(i => i != null)
|
||||
.Where(i => i is not null)
|
||||
.ToList();
|
||||
|
||||
var currentShortcutLinks = LinkedChildren.Where(i => i.Type == LinkedChildType.Shortcut).ToList();
|
||||
@@ -1662,7 +1662,7 @@ namespace MediaBrowser.Controller.Entities
|
||||
{
|
||||
// The querying doesn't support virtual unaired
|
||||
var episode = item as Episode;
|
||||
if (episode != null && episode.IsUnaired)
|
||||
if (episode is not null && episode.IsUnaired)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
@@ -1719,7 +1719,7 @@ namespace MediaBrowser.Controller.Entities
|
||||
return;
|
||||
}
|
||||
|
||||
if (itemDto != null)
|
||||
if (itemDto is not null)
|
||||
{
|
||||
if (fields.ContainsField(ItemFields.RecursiveItemCount))
|
||||
{
|
||||
|
||||
@@ -55,7 +55,7 @@ namespace MediaBrowser.Controller.Entities
|
||||
public InternalItemsQuery(User? user)
|
||||
: this()
|
||||
{
|
||||
if (user != null)
|
||||
if (user is not null)
|
||||
{
|
||||
SetUser(user);
|
||||
}
|
||||
|
||||
@@ -22,7 +22,7 @@ namespace MediaBrowser.Controller.Entities.Movies
|
||||
/// <inheritdoc />
|
||||
[JsonIgnore]
|
||||
public IReadOnlyList<Guid> SpecialFeatureIds => GetExtras()
|
||||
.Where(extra => extra.ExtraType != null && extra is Video)
|
||||
.Where(extra => extra.ExtraType is not null && extra is Video)
|
||||
.Select(extra => extra.Id)
|
||||
.ToArray();
|
||||
|
||||
|
||||
@@ -41,7 +41,7 @@ namespace MediaBrowser.Controller.Entities
|
||||
{
|
||||
var existing = people.FirstOrDefault(p => p.Name.Equals(person.Name, StringComparison.OrdinalIgnoreCase) && p.Type.Equals(PersonType.Actor, StringComparison.OrdinalIgnoreCase));
|
||||
|
||||
if (existing != null)
|
||||
if (existing is not null)
|
||||
{
|
||||
existing.Type = PersonType.GuestStar;
|
||||
MergeExisting(existing, person);
|
||||
|
||||
@@ -155,7 +155,7 @@ namespace MediaBrowser.Controller.Entities.TV
|
||||
var list = base.GetUserDataKeys();
|
||||
|
||||
var series = Series;
|
||||
if (series != null && ParentIndexNumber.HasValue && IndexNumber.HasValue)
|
||||
if (series is not null && ParentIndexNumber.HasValue && IndexNumber.HasValue)
|
||||
{
|
||||
var seriesUserDataKeys = series.GetUserDataKeys();
|
||||
var take = seriesUserDataKeys.Count;
|
||||
@@ -216,7 +216,7 @@ namespace MediaBrowser.Controller.Entities.TV
|
||||
{
|
||||
var series = Series;
|
||||
|
||||
if (series != null && ParentIndexNumber.HasValue)
|
||||
if (series is not null && ParentIndexNumber.HasValue)
|
||||
{
|
||||
var findNumber = ParentIndexNumber.Value;
|
||||
|
||||
@@ -235,8 +235,8 @@ namespace MediaBrowser.Controller.Entities.TV
|
||||
/// <returns>System.String.</returns>
|
||||
protected override string CreateSortName()
|
||||
{
|
||||
return (ParentIndexNumber != null ? ParentIndexNumber.Value.ToString("000 - ", CultureInfo.InvariantCulture) : string.Empty)
|
||||
+ (IndexNumber != null ? IndexNumber.Value.ToString("0000 - ", CultureInfo.InvariantCulture) : string.Empty) + Name;
|
||||
return (ParentIndexNumber is not null ? ParentIndexNumber.Value.ToString("000 - ", CultureInfo.InvariantCulture) : string.Empty)
|
||||
+ (IndexNumber is not null ? IndexNumber.Value.ToString("0000 - ", CultureInfo.InvariantCulture) : string.Empty) + Name;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -302,7 +302,7 @@ namespace MediaBrowser.Controller.Entities.TV
|
||||
|
||||
var series = Series;
|
||||
|
||||
if (series != null)
|
||||
if (series is not null)
|
||||
{
|
||||
id.SeriesProviderIds = series.ProviderIds;
|
||||
id.SeriesDisplayOrder = series.DisplayOrder;
|
||||
|
||||
@@ -64,7 +64,7 @@ namespace MediaBrowser.Controller.Entities.TV
|
||||
{
|
||||
var series = Series;
|
||||
|
||||
if (series != null)
|
||||
if (series is not null)
|
||||
{
|
||||
return series.Path;
|
||||
}
|
||||
@@ -101,7 +101,7 @@ namespace MediaBrowser.Controller.Entities.TV
|
||||
var list = base.GetUserDataKeys();
|
||||
|
||||
var series = Series;
|
||||
if (series != null)
|
||||
if (series is not null)
|
||||
{
|
||||
var newList = series.GetUserDataKeys();
|
||||
var suffix = (IndexNumber ?? 0).ToString("000", CultureInfo.InvariantCulture);
|
||||
@@ -129,7 +129,7 @@ namespace MediaBrowser.Controller.Entities.TV
|
||||
if (IndexNumber.HasValue)
|
||||
{
|
||||
var series = Series;
|
||||
if (series != null)
|
||||
if (series is not null)
|
||||
{
|
||||
return series.PresentationUniqueKey + "-" + (IndexNumber ?? 0).ToString("000", CultureInfo.InvariantCulture);
|
||||
}
|
||||
@@ -144,7 +144,7 @@ namespace MediaBrowser.Controller.Entities.TV
|
||||
/// <returns>System.String.</returns>
|
||||
protected override string CreateSortName()
|
||||
{
|
||||
return IndexNumber != null ? IndexNumber.Value.ToString("0000", CultureInfo.InvariantCulture) : Name;
|
||||
return IndexNumber is not null ? IndexNumber.Value.ToString("0000", CultureInfo.InvariantCulture) : Name;
|
||||
}
|
||||
|
||||
protected override QueryResult<BaseItem> GetItemsInternal(InternalItemsQuery query)
|
||||
@@ -233,7 +233,7 @@ namespace MediaBrowser.Controller.Entities.TV
|
||||
|
||||
var series = Series;
|
||||
|
||||
if (series != null)
|
||||
if (series is not null)
|
||||
{
|
||||
id.SeriesProviderIds = series.ProviderIds;
|
||||
}
|
||||
|
||||
@@ -218,7 +218,7 @@ namespace MediaBrowser.Controller.Entities.TV
|
||||
query.IncludeItemTypes = new[] { BaseItemKind.Season };
|
||||
query.OrderBy = new[] { (ItemSortBy.SortName, SortOrder.Ascending) };
|
||||
|
||||
if (user != null && !user.DisplayMissingEpisodes)
|
||||
if (user is not null && !user.DisplayMissingEpisodes)
|
||||
{
|
||||
query.IsMissing = false;
|
||||
}
|
||||
@@ -369,7 +369,7 @@ namespace MediaBrowser.Controller.Entities.TV
|
||||
OrderBy = new[] { (ItemSortBy.SortName, SortOrder.Ascending) },
|
||||
DtoOptions = options
|
||||
};
|
||||
if (user != null)
|
||||
if (user is not null)
|
||||
{
|
||||
if (!user.DisplayMissingEpisodes)
|
||||
{
|
||||
@@ -426,7 +426,7 @@ namespace MediaBrowser.Controller.Entities.TV
|
||||
}
|
||||
|
||||
var season = episodeItem.Season;
|
||||
return season != null && string.Equals(GetUniqueSeriesKey(season), seasonPresentationKey, StringComparison.OrdinalIgnoreCase);
|
||||
return season is not null && string.Equals(GetUniqueSeriesKey(season), seasonPresentationKey, StringComparison.OrdinalIgnoreCase);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -448,7 +448,7 @@ namespace MediaBrowser.Controller.Entities.TV
|
||||
{
|
||||
var episode = i;
|
||||
|
||||
if (episode != null)
|
||||
if (episode is not null)
|
||||
{
|
||||
var currentSeasonNumber = episode.AiredSeasonNumber;
|
||||
|
||||
|
||||
@@ -105,7 +105,7 @@ namespace MediaBrowser.Controller.Entities
|
||||
{
|
||||
get
|
||||
{
|
||||
if (Rating != null)
|
||||
if (Rating is not null)
|
||||
{
|
||||
return Rating >= MinLikeValue;
|
||||
}
|
||||
|
||||
@@ -63,7 +63,7 @@ namespace MediaBrowser.Controller.Entities
|
||||
return list;
|
||||
}
|
||||
|
||||
return _childrenIds.Select(LibraryManager.GetItemById).Where(i => i != null).ToList();
|
||||
return _childrenIds.Select(LibraryManager.GetItemById).Where(i => i is not null).ToList();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -46,7 +46,7 @@ namespace MediaBrowser.Controller.Entities
|
||||
{
|
||||
var user = query.User;
|
||||
|
||||
// if (query.IncludeItemTypes != null &&
|
||||
// if (query.IncludeItemTypes is not null &&
|
||||
// query.IncludeItemTypes.Length == 1 &&
|
||||
// string.Equals(query.IncludeItemTypes[0], "Playlist", StringComparison.OrdinalIgnoreCase))
|
||||
// {
|
||||
@@ -263,7 +263,7 @@ namespace MediaBrowser.Controller.Entities
|
||||
return null;
|
||||
}
|
||||
})
|
||||
.Where(i => i != null)
|
||||
.Where(i => i is not null)
|
||||
.Select(i => GetUserViewWithName(SpecialFolder.MovieGenre, i.SortName, parent));
|
||||
|
||||
return GetResult(genres, query);
|
||||
@@ -391,7 +391,7 @@ namespace MediaBrowser.Controller.Entities
|
||||
return null;
|
||||
}
|
||||
})
|
||||
.Where(i => i != null)
|
||||
.Where(i => i is not null)
|
||||
.Select(i => GetUserViewWithName(SpecialFolder.TvGenre, i.SortName, parent));
|
||||
|
||||
return GetResult(genres, query);
|
||||
@@ -791,7 +791,7 @@ namespace MediaBrowser.Controller.Entities
|
||||
if (query.StudioIds.Length > 0 && !query.StudioIds.Any(id =>
|
||||
{
|
||||
var studioItem = libraryManager.GetItemById(id);
|
||||
return studioItem != null && item.Studios.Contains(studioItem.Name, StringComparison.OrdinalIgnoreCase);
|
||||
return studioItem is not null && item.Studios.Contains(studioItem.Name, StringComparison.OrdinalIgnoreCase);
|
||||
}))
|
||||
{
|
||||
return false;
|
||||
@@ -801,7 +801,7 @@ namespace MediaBrowser.Controller.Entities
|
||||
if (query.GenreIds.Count > 0 && !query.GenreIds.Any(id =>
|
||||
{
|
||||
var genreItem = libraryManager.GetItemById(id);
|
||||
return genreItem != null && item.Genres.Contains(genreItem.Name, StringComparison.OrdinalIgnoreCase);
|
||||
return genreItem is not null && item.Genres.Contains(genreItem.Name, StringComparison.OrdinalIgnoreCase);
|
||||
}))
|
||||
{
|
||||
return false;
|
||||
@@ -952,7 +952,7 @@ namespace MediaBrowser.Controller.Entities
|
||||
{
|
||||
var folder = i as ICollectionFolder;
|
||||
|
||||
return folder != null && viewTypes.Contains(folder.CollectionType ?? string.Empty, StringComparison.OrdinalIgnoreCase);
|
||||
return folder is not null && viewTypes.Contains(folder.CollectionType ?? string.Empty, StringComparison.OrdinalIgnoreCase);
|
||||
}).ToArray();
|
||||
}
|
||||
|
||||
@@ -961,7 +961,7 @@ namespace MediaBrowser.Controller.Entities
|
||||
{
|
||||
var folder = i as ICollectionFolder;
|
||||
|
||||
return folder != null && viewTypes.Contains(folder.CollectionType ?? string.Empty, StringComparison.OrdinalIgnoreCase);
|
||||
return folder is not null && viewTypes.Contains(folder.CollectionType ?? string.Empty, StringComparison.OrdinalIgnoreCase);
|
||||
}).ToArray();
|
||||
}
|
||||
|
||||
|
||||
@@ -373,7 +373,7 @@ namespace MediaBrowser.Controller.Entities
|
||||
{
|
||||
return LinkedAlternateVersions
|
||||
.Select(GetLinkedChild)
|
||||
.Where(i => i != null)
|
||||
.Where(i => i is not null)
|
||||
.OfType<Video>()
|
||||
.OrderBy(i => i.SortName);
|
||||
}
|
||||
@@ -386,7 +386,7 @@ namespace MediaBrowser.Controller.Entities
|
||||
{
|
||||
return GetAdditionalPartIds()
|
||||
.Select(i => LibraryManager.GetItemById(i))
|
||||
.Where(i => i != null)
|
||||
.Where(i => i is not null)
|
||||
.OfType<Video>()
|
||||
.OrderBy(i => i.SortName);
|
||||
}
|
||||
@@ -469,7 +469,7 @@ namespace MediaBrowser.Controller.Entities
|
||||
|
||||
var localAlternates = GetLocalAlternateVersionIds()
|
||||
.Select(i => LibraryManager.GetItemById(i))
|
||||
.Where(i => i != null);
|
||||
.Where(i => i is not null);
|
||||
|
||||
foreach (var item in localAlternates)
|
||||
{
|
||||
@@ -542,7 +542,7 @@ namespace MediaBrowser.Controller.Entities
|
||||
return i.Item1 is Video video ? video.GetLocalAlternateVersionIds() : Enumerable.Empty<Guid>();
|
||||
})
|
||||
.Select(LibraryManager.GetItemById)
|
||||
.Where(i => i != null)
|
||||
.Where(i => i is not null)
|
||||
.ToList();
|
||||
|
||||
list.AddRange(localAlternates.Select(i => (i, MediaSourceType.Default)));
|
||||
|
||||
Reference in New Issue
Block a user