mirror of
https://github.com/jellyfin/jellyfin.git
synced 2026-04-21 01:24:44 +01:00
Remove more and more warnings
This commit is contained in:
@@ -807,7 +807,7 @@ namespace Emby.Server.Implementations.Dto
|
||||
|
||||
dto.MediaType = item.MediaType;
|
||||
|
||||
if (!(item is LiveTvProgram))
|
||||
if (item is not LiveTvProgram)
|
||||
{
|
||||
dto.LocationType = item.LocationType;
|
||||
}
|
||||
@@ -928,9 +928,9 @@ namespace Emby.Server.Implementations.Dto
|
||||
}
|
||||
|
||||
// if (options.ContainsField(ItemFields.MediaSourceCount))
|
||||
//{
|
||||
// {
|
||||
// Songs always have one
|
||||
//}
|
||||
// }
|
||||
}
|
||||
|
||||
if (item is IHasArtist hasArtist)
|
||||
@@ -938,10 +938,10 @@ namespace Emby.Server.Implementations.Dto
|
||||
dto.Artists = hasArtist.Artists;
|
||||
|
||||
// var artistItems = _libraryManager.GetArtists(new InternalItemsQuery
|
||||
//{
|
||||
// {
|
||||
// EnableTotalRecordCount = false,
|
||||
// ItemIds = new[] { item.Id.ToString("N", CultureInfo.InvariantCulture) }
|
||||
//});
|
||||
// });
|
||||
|
||||
// dto.ArtistItems = artistItems.Items
|
||||
// .Select(i =>
|
||||
@@ -958,7 +958,7 @@ namespace Emby.Server.Implementations.Dto
|
||||
// Include artists that are not in the database yet, e.g., just added via metadata editor
|
||||
// var foundArtists = artistItems.Items.Select(i => i.Item1.Name).ToList();
|
||||
dto.ArtistItems = hasArtist.Artists
|
||||
//.Except(foundArtists, new DistinctNameComparer())
|
||||
// .Except(foundArtists, new DistinctNameComparer())
|
||||
.Select(i =>
|
||||
{
|
||||
// This should not be necessary but we're seeing some cases of it
|
||||
@@ -990,10 +990,10 @@ namespace Emby.Server.Implementations.Dto
|
||||
dto.AlbumArtist = hasAlbumArtist.AlbumArtists.FirstOrDefault();
|
||||
|
||||
// var artistItems = _libraryManager.GetAlbumArtists(new InternalItemsQuery
|
||||
//{
|
||||
// {
|
||||
// EnableTotalRecordCount = false,
|
||||
// ItemIds = new[] { item.Id.ToString("N", CultureInfo.InvariantCulture) }
|
||||
//});
|
||||
// });
|
||||
|
||||
// dto.AlbumArtists = artistItems.Items
|
||||
// .Select(i =>
|
||||
@@ -1008,7 +1008,7 @@ namespace Emby.Server.Implementations.Dto
|
||||
// .ToList();
|
||||
|
||||
dto.AlbumArtists = hasAlbumArtist.AlbumArtists
|
||||
//.Except(foundArtists, new DistinctNameComparer())
|
||||
// .Except(foundArtists, new DistinctNameComparer())
|
||||
.Select(i =>
|
||||
{
|
||||
// This should not be necessary but we're seeing some cases of it
|
||||
@@ -1035,8 +1035,7 @@ namespace Emby.Server.Implementations.Dto
|
||||
}
|
||||
|
||||
// Add video info
|
||||
var video = item as Video;
|
||||
if (video != null)
|
||||
if (item is Video video)
|
||||
{
|
||||
dto.VideoType = video.VideoType;
|
||||
dto.Video3DFormat = video.Video3DFormat;
|
||||
@@ -1075,9 +1074,7 @@ namespace Emby.Server.Implementations.Dto
|
||||
if (options.ContainsField(ItemFields.MediaStreams))
|
||||
{
|
||||
// Add VideoInfo
|
||||
var iHasMediaSources = item as IHasMediaSources;
|
||||
|
||||
if (iHasMediaSources != null)
|
||||
if (item is IHasMediaSources)
|
||||
{
|
||||
MediaStream[] mediaStreams;
|
||||
|
||||
@@ -1146,7 +1143,7 @@ namespace Emby.Server.Implementations.Dto
|
||||
// TODO maybe remove the if statement entirely
|
||||
// if (options.ContainsField(ItemFields.SeriesPrimaryImage))
|
||||
{
|
||||
episodeSeries = episodeSeries ?? episode.Series;
|
||||
episodeSeries ??= episode.Series;
|
||||
if (episodeSeries != null)
|
||||
{
|
||||
dto.SeriesPrimaryImageTag = GetTagAndFillBlurhash(dto, episodeSeries, ImageType.Primary);
|
||||
@@ -1159,7 +1156,7 @@ namespace Emby.Server.Implementations.Dto
|
||||
|
||||
if (options.ContainsField(ItemFields.SeriesStudio))
|
||||
{
|
||||
episodeSeries = episodeSeries ?? episode.Series;
|
||||
episodeSeries ??= episode.Series;
|
||||
if (episodeSeries != null)
|
||||
{
|
||||
dto.SeriesStudio = episodeSeries.Studios.FirstOrDefault();
|
||||
@@ -1172,7 +1169,7 @@ namespace Emby.Server.Implementations.Dto
|
||||
{
|
||||
dto.AirDays = series.AirDays;
|
||||
dto.AirTime = series.AirTime;
|
||||
dto.Status = series.Status.HasValue ? series.Status.Value.ToString() : null;
|
||||
dto.Status = series.Status?.ToString();
|
||||
}
|
||||
|
||||
// Add SeasonInfo
|
||||
@@ -1185,7 +1182,7 @@ namespace Emby.Server.Implementations.Dto
|
||||
|
||||
if (options.ContainsField(ItemFields.SeriesStudio))
|
||||
{
|
||||
series = series ?? season.Series;
|
||||
series ??= season.Series;
|
||||
if (series != null)
|
||||
{
|
||||
dto.SeriesStudio = series.Studios.FirstOrDefault();
|
||||
@@ -1196,7 +1193,7 @@ namespace Emby.Server.Implementations.Dto
|
||||
// TODO maybe remove the if statement entirely
|
||||
// if (options.ContainsField(ItemFields.SeriesPrimaryImage))
|
||||
{
|
||||
series = series ?? season.Series;
|
||||
series ??= season.Series;
|
||||
if (series != null)
|
||||
{
|
||||
dto.SeriesPrimaryImageTag = GetTagAndFillBlurhash(dto, series, ImageType.Primary);
|
||||
@@ -1283,7 +1280,7 @@ namespace Emby.Server.Implementations.Dto
|
||||
|
||||
var parent = currentItem.DisplayParent ?? currentItem.GetOwner() ?? currentItem.GetParent();
|
||||
|
||||
if (parent == null && !(originalItem is UserRootFolder) && !(originalItem is UserView) && !(originalItem is AggregateFolder) && !(originalItem is ICollectionFolder) && !(originalItem is Channel))
|
||||
if (parent == null && originalItem is not UserRootFolder && originalItem is not UserView && originalItem is not AggregateFolder && originalItem is not ICollectionFolder && originalItem is not Channel)
|
||||
{
|
||||
parent = _libraryManager.GetCollectionFolders(originalItem).FirstOrDefault();
|
||||
}
|
||||
@@ -1317,7 +1314,7 @@ namespace Emby.Server.Implementations.Dto
|
||||
var imageTags = dto.ImageTags;
|
||||
|
||||
while (((!(imageTags != null && imageTags.ContainsKey(ImageType.Logo)) && logoLimit > 0) || (!(imageTags != null && imageTags.ContainsKey(ImageType.Art)) && artLimit > 0) || (!(imageTags != null && imageTags.ContainsKey(ImageType.Thumb)) && thumbLimit > 0) || parent is Series) &&
|
||||
(parent = parent ?? (isFirst ? GetImageDisplayParent(item, item) ?? owner : parent)) != null)
|
||||
(parent ??= (isFirst ? GetImageDisplayParent(item, item) ?? owner : parent)) != null)
|
||||
{
|
||||
if (parent == null)
|
||||
{
|
||||
@@ -1348,7 +1345,7 @@ namespace Emby.Server.Implementations.Dto
|
||||
}
|
||||
}
|
||||
|
||||
if (thumbLimit > 0 && !(imageTags != null && imageTags.ContainsKey(ImageType.Thumb)) && (dto.ParentThumbItemId == null || parent is Series) && !(parent is ICollectionFolder) && !(parent is UserView))
|
||||
if (thumbLimit > 0 && !(imageTags != null && imageTags.ContainsKey(ImageType.Thumb)) && (dto.ParentThumbItemId == null || parent is Series) && parent is not ICollectionFolder && parent is not UserView)
|
||||
{
|
||||
var image = allImages.FirstOrDefault(i => i.Type == ImageType.Thumb);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user