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