mirror of
https://github.com/jellyfin/jellyfin.git
synced 2025-05-24 02:02:29 -04:00
Cleanup ItemFields (#13818)
* Cleanup ItemFields * Update MediaBrowser.Model/Querying/ItemFields.cs
This commit is contained in:
parent
14b785d188
commit
086fbd49cf
@ -41,7 +41,6 @@ namespace Emby.Server.Implementations.Dto
|
|||||||
private readonly ILogger<DtoService> _logger;
|
private readonly ILogger<DtoService> _logger;
|
||||||
private readonly ILibraryManager _libraryManager;
|
private readonly ILibraryManager _libraryManager;
|
||||||
private readonly IUserDataManager _userDataRepository;
|
private readonly IUserDataManager _userDataRepository;
|
||||||
private readonly IItemRepository _itemRepo;
|
|
||||||
|
|
||||||
private readonly IImageProcessor _imageProcessor;
|
private readonly IImageProcessor _imageProcessor;
|
||||||
private readonly IProviderManager _providerManager;
|
private readonly IProviderManager _providerManager;
|
||||||
@ -58,7 +57,6 @@ namespace Emby.Server.Implementations.Dto
|
|||||||
ILogger<DtoService> logger,
|
ILogger<DtoService> logger,
|
||||||
ILibraryManager libraryManager,
|
ILibraryManager libraryManager,
|
||||||
IUserDataManager userDataRepository,
|
IUserDataManager userDataRepository,
|
||||||
IItemRepository itemRepo,
|
|
||||||
IImageProcessor imageProcessor,
|
IImageProcessor imageProcessor,
|
||||||
IProviderManager providerManager,
|
IProviderManager providerManager,
|
||||||
IRecordingsManager recordingsManager,
|
IRecordingsManager recordingsManager,
|
||||||
@ -71,7 +69,6 @@ namespace Emby.Server.Implementations.Dto
|
|||||||
_logger = logger;
|
_logger = logger;
|
||||||
_libraryManager = libraryManager;
|
_libraryManager = libraryManager;
|
||||||
_userDataRepository = userDataRepository;
|
_userDataRepository = userDataRepository;
|
||||||
_itemRepo = itemRepo;
|
|
||||||
_imageProcessor = imageProcessor;
|
_imageProcessor = imageProcessor;
|
||||||
_providerManager = providerManager;
|
_providerManager = providerManager;
|
||||||
_recordingsManager = recordingsManager;
|
_recordingsManager = recordingsManager;
|
||||||
@ -99,11 +96,11 @@ namespace Emby.Server.Implementations.Dto
|
|||||||
|
|
||||||
if (item is LiveTvChannel tvChannel)
|
if (item is LiveTvChannel tvChannel)
|
||||||
{
|
{
|
||||||
(channelTuples ??= new()).Add((dto, tvChannel));
|
(channelTuples ??= []).Add((dto, tvChannel));
|
||||||
}
|
}
|
||||||
else if (item is LiveTvProgram)
|
else if (item is LiveTvProgram)
|
||||||
{
|
{
|
||||||
(programTuples ??= new()).Add((item, dto));
|
(programTuples ??= []).Add((item, dto));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (item is IItemByName byName)
|
if (item is IItemByName byName)
|
||||||
@ -590,12 +587,12 @@ namespace Emby.Server.Implementations.Dto
|
|||||||
if (dto.ImageBlurHashes is not null)
|
if (dto.ImageBlurHashes is not null)
|
||||||
{
|
{
|
||||||
// Only add BlurHash for the person's image.
|
// Only add BlurHash for the person's image.
|
||||||
baseItemPerson.ImageBlurHashes = new Dictionary<ImageType, Dictionary<string, string>>();
|
baseItemPerson.ImageBlurHashes = [];
|
||||||
foreach (var (imageType, blurHash) in dto.ImageBlurHashes)
|
foreach (var (imageType, blurHash) in dto.ImageBlurHashes)
|
||||||
{
|
{
|
||||||
if (blurHash is not null)
|
if (blurHash is not null)
|
||||||
{
|
{
|
||||||
baseItemPerson.ImageBlurHashes[imageType] = new Dictionary<string, string>();
|
baseItemPerson.ImageBlurHashes[imageType] = [];
|
||||||
foreach (var (imageId, blurHashValue) in blurHash)
|
foreach (var (imageId, blurHashValue) in blurHash)
|
||||||
{
|
{
|
||||||
if (string.Equals(baseItemPerson.PrimaryImageTag, imageId, StringComparison.OrdinalIgnoreCase))
|
if (string.Equals(baseItemPerson.PrimaryImageTag, imageId, StringComparison.OrdinalIgnoreCase))
|
||||||
@ -674,11 +671,11 @@ namespace Emby.Server.Implementations.Dto
|
|||||||
|
|
||||||
if (!string.IsNullOrEmpty(image.BlurHash))
|
if (!string.IsNullOrEmpty(image.BlurHash))
|
||||||
{
|
{
|
||||||
dto.ImageBlurHashes ??= new Dictionary<ImageType, Dictionary<string, string>>();
|
dto.ImageBlurHashes ??= [];
|
||||||
|
|
||||||
if (!dto.ImageBlurHashes.TryGetValue(image.Type, out var value))
|
if (!dto.ImageBlurHashes.TryGetValue(image.Type, out var value))
|
||||||
{
|
{
|
||||||
value = new Dictionary<string, string>();
|
value = [];
|
||||||
dto.ImageBlurHashes[image.Type] = value;
|
dto.ImageBlurHashes[image.Type] = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -709,7 +706,7 @@ namespace Emby.Server.Implementations.Dto
|
|||||||
|
|
||||||
if (hashes.Count > 0)
|
if (hashes.Count > 0)
|
||||||
{
|
{
|
||||||
dto.ImageBlurHashes ??= new Dictionary<ImageType, Dictionary<string, string>>();
|
dto.ImageBlurHashes ??= [];
|
||||||
|
|
||||||
dto.ImageBlurHashes[imageType] = hashes;
|
dto.ImageBlurHashes[imageType] = hashes;
|
||||||
}
|
}
|
||||||
@ -756,7 +753,7 @@ namespace Emby.Server.Implementations.Dto
|
|||||||
dto.AspectRatio = hasAspectRatio.AspectRatio;
|
dto.AspectRatio = hasAspectRatio.AspectRatio;
|
||||||
}
|
}
|
||||||
|
|
||||||
dto.ImageBlurHashes = new Dictionary<ImageType, Dictionary<string, string>>();
|
dto.ImageBlurHashes = [];
|
||||||
|
|
||||||
var backdropLimit = options.GetImageLimit(ImageType.Backdrop);
|
var backdropLimit = options.GetImageLimit(ImageType.Backdrop);
|
||||||
if (backdropLimit > 0)
|
if (backdropLimit > 0)
|
||||||
@ -772,7 +769,7 @@ namespace Emby.Server.Implementations.Dto
|
|||||||
|
|
||||||
if (options.EnableImages)
|
if (options.EnableImages)
|
||||||
{
|
{
|
||||||
dto.ImageTags = new Dictionary<ImageType, string>();
|
dto.ImageTags = [];
|
||||||
|
|
||||||
// Prevent implicitly captured closure
|
// Prevent implicitly captured closure
|
||||||
var currentItem = item;
|
var currentItem = item;
|
||||||
|
@ -1808,7 +1808,6 @@ namespace Emby.Server.Implementations.Session
|
|||||||
fields.Remove(ItemFields.DateLastSaved);
|
fields.Remove(ItemFields.DateLastSaved);
|
||||||
fields.Remove(ItemFields.DisplayPreferencesId);
|
fields.Remove(ItemFields.DisplayPreferencesId);
|
||||||
fields.Remove(ItemFields.Etag);
|
fields.Remove(ItemFields.Etag);
|
||||||
fields.Remove(ItemFields.InheritedParentalRatingValue);
|
|
||||||
fields.Remove(ItemFields.ItemCounts);
|
fields.Remove(ItemFields.ItemCounts);
|
||||||
fields.Remove(ItemFields.MediaSourceCount);
|
fields.Remove(ItemFields.MediaSourceCount);
|
||||||
fields.Remove(ItemFields.MediaStreams);
|
fields.Remove(ItemFields.MediaStreams);
|
||||||
|
@ -34,7 +34,7 @@ namespace MediaBrowser.Controller.Dto
|
|||||||
EnableUserData = true;
|
EnableUserData = true;
|
||||||
AddCurrentProgram = true;
|
AddCurrentProgram = true;
|
||||||
|
|
||||||
Fields = allFields ? AllItemFields : Array.Empty<ItemFields>();
|
Fields = allFields ? AllItemFields : [];
|
||||||
ImageTypes = AllImageTypes;
|
ImageTypes = AllImageTypes;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,7 +1,3 @@
|
|||||||
#pragma warning disable CS1591
|
|
||||||
|
|
||||||
using System;
|
|
||||||
|
|
||||||
namespace MediaBrowser.Model.Querying
|
namespace MediaBrowser.Model.Querying
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -39,6 +35,9 @@ namespace MediaBrowser.Model.Querying
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
Trickplay,
|
Trickplay,
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The child count.
|
||||||
|
/// </summary>
|
||||||
ChildCount,
|
ChildCount,
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -81,11 +80,6 @@ namespace MediaBrowser.Model.Querying
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
Genres,
|
Genres,
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// The home page URL.
|
|
||||||
/// </summary>
|
|
||||||
HomePageUrl,
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The item counts.
|
/// The item counts.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -101,6 +95,9 @@ namespace MediaBrowser.Model.Querying
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
MediaSources,
|
MediaSources,
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The original title.
|
||||||
|
/// </summary>
|
||||||
OriginalTitle,
|
OriginalTitle,
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -123,6 +120,9 @@ namespace MediaBrowser.Model.Querying
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
People,
|
People,
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Value indicating whether playback access is granted.
|
||||||
|
/// </summary>
|
||||||
PlayAccess,
|
PlayAccess,
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -140,6 +140,9 @@ namespace MediaBrowser.Model.Querying
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
PrimaryImageAspectRatio,
|
PrimaryImageAspectRatio,
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The recursive item count.
|
||||||
|
/// </summary>
|
||||||
RecursiveItemCount,
|
RecursiveItemCount,
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -147,14 +150,6 @@ namespace MediaBrowser.Model.Querying
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
Settings,
|
Settings,
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// The screenshot image tags.
|
|
||||||
/// </summary>
|
|
||||||
[Obsolete("Screenshot image type is no longer used.")]
|
|
||||||
ScreenshotImageTags,
|
|
||||||
|
|
||||||
SeriesPrimaryImage,
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The series studio.
|
/// The series studio.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -201,27 +196,58 @@ namespace MediaBrowser.Model.Querying
|
|||||||
SeasonUserData,
|
SeasonUserData,
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The service name.
|
/// The last time metadata was refreshed.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
ServiceName,
|
|
||||||
ThemeSongIds,
|
|
||||||
ThemeVideoIds,
|
|
||||||
ExternalEtag,
|
|
||||||
PresentationUniqueKey,
|
|
||||||
InheritedParentalRatingValue,
|
|
||||||
InheritedParentalRatingSubValue,
|
|
||||||
ExternalSeriesId,
|
|
||||||
SeriesPresentationUniqueKey,
|
|
||||||
DateLastRefreshed,
|
DateLastRefreshed,
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The last time metadata was saved.
|
||||||
|
/// </summary>
|
||||||
DateLastSaved,
|
DateLastSaved,
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The refresh state.
|
||||||
|
/// </summary>
|
||||||
RefreshState,
|
RefreshState,
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The channel image.
|
||||||
|
/// </summary>
|
||||||
ChannelImage,
|
ChannelImage,
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Value indicating whether media source display is enabled.
|
||||||
|
/// </summary>
|
||||||
EnableMediaSourceDisplay,
|
EnableMediaSourceDisplay,
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The width.
|
||||||
|
/// </summary>
|
||||||
Width,
|
Width,
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The height.
|
||||||
|
/// </summary>
|
||||||
Height,
|
Height,
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The external Ids.
|
||||||
|
/// </summary>
|
||||||
ExtraIds,
|
ExtraIds,
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The local trailer count.
|
||||||
|
/// </summary>
|
||||||
LocalTrailerCount,
|
LocalTrailerCount,
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Value indicating whether the item is HD.
|
||||||
|
/// </summary>
|
||||||
IsHD,
|
IsHD,
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The special feature count.
|
||||||
|
/// </summary>
|
||||||
SpecialFeatureCount
|
SpecialFeatureCount
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user