Merge pull request #4474 from crobibero/property-readonlylist
Convert array property to IReadOnlyList
This commit is contained in:
commit
f45b4ac11f
|
@ -1429,7 +1429,7 @@ namespace Emby.Server.Implementations.LiveTv
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Task AddInfoToProgramDto(IReadOnlyCollection<(BaseItem, BaseItemDto)> tuples, ItemFields[] fields, User user = null)
|
public Task AddInfoToProgramDto(IReadOnlyCollection<(BaseItem, BaseItemDto)> tuples, IReadOnlyList<ItemFields> fields, User user = null)
|
||||||
{
|
{
|
||||||
var programTuples = new List<Tuple<BaseItemDto, string, string>>();
|
var programTuples = new List<Tuple<BaseItemDto, string, string>>();
|
||||||
var hasChannelImage = fields.Contains(ItemFields.ChannelImage);
|
var hasChannelImage = fields.Contains(ItemFields.ChannelImage);
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
using System;
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using Jellyfin.Api.Helpers;
|
using Jellyfin.Api.Helpers;
|
||||||
|
using MediaBrowser.Common.Extensions;
|
||||||
using MediaBrowser.Controller.Dto;
|
using MediaBrowser.Controller.Dto;
|
||||||
using MediaBrowser.Model.Entities;
|
using MediaBrowser.Model.Entities;
|
||||||
using MediaBrowser.Model.Querying;
|
using MediaBrowser.Model.Querying;
|
||||||
|
@ -43,7 +45,7 @@ namespace Jellyfin.Api.Extensions
|
||||||
client.IndexOf("media center", StringComparison.OrdinalIgnoreCase) != -1 ||
|
client.IndexOf("media center", StringComparison.OrdinalIgnoreCase) != -1 ||
|
||||||
client.IndexOf("classic", StringComparison.OrdinalIgnoreCase) != -1)
|
client.IndexOf("classic", StringComparison.OrdinalIgnoreCase) != -1)
|
||||||
{
|
{
|
||||||
int oldLen = dtoOptions.Fields.Length;
|
int oldLen = dtoOptions.Fields.Count;
|
||||||
var arr = new ItemFields[oldLen + 1];
|
var arr = new ItemFields[oldLen + 1];
|
||||||
dtoOptions.Fields.CopyTo(arr, 0);
|
dtoOptions.Fields.CopyTo(arr, 0);
|
||||||
arr[oldLen] = ItemFields.RecursiveItemCount;
|
arr[oldLen] = ItemFields.RecursiveItemCount;
|
||||||
|
@ -61,7 +63,7 @@ namespace Jellyfin.Api.Extensions
|
||||||
client.IndexOf("samsung", StringComparison.OrdinalIgnoreCase) != -1 ||
|
client.IndexOf("samsung", StringComparison.OrdinalIgnoreCase) != -1 ||
|
||||||
client.IndexOf("androidtv", StringComparison.OrdinalIgnoreCase) != -1)
|
client.IndexOf("androidtv", StringComparison.OrdinalIgnoreCase) != -1)
|
||||||
{
|
{
|
||||||
int oldLen = dtoOptions.Fields.Length;
|
int oldLen = dtoOptions.Fields.Count;
|
||||||
var arr = new ItemFields[oldLen + 1];
|
var arr = new ItemFields[oldLen + 1];
|
||||||
dtoOptions.Fields.CopyTo(arr, 0);
|
dtoOptions.Fields.CopyTo(arr, 0);
|
||||||
arr[oldLen] = ItemFields.ChildCount;
|
arr[oldLen] = ItemFields.ChildCount;
|
||||||
|
@ -90,7 +92,7 @@ namespace Jellyfin.Api.Extensions
|
||||||
bool? enableImages,
|
bool? enableImages,
|
||||||
bool? enableUserData,
|
bool? enableUserData,
|
||||||
int? imageTypeLimit,
|
int? imageTypeLimit,
|
||||||
ImageType[] enableImageTypes)
|
IReadOnlyList<ImageType> enableImageTypes)
|
||||||
{
|
{
|
||||||
dtoOptions.EnableImages = enableImages ?? true;
|
dtoOptions.EnableImages = enableImages ?? true;
|
||||||
|
|
||||||
|
@ -104,7 +106,7 @@ namespace Jellyfin.Api.Extensions
|
||||||
dtoOptions.EnableUserData = enableUserData.Value;
|
dtoOptions.EnableUserData = enableUserData.Value;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (enableImageTypes.Length != 0)
|
if (enableImageTypes.Count != 0)
|
||||||
{
|
{
|
||||||
dtoOptions.ImageTypes = enableImageTypes;
|
dtoOptions.ImageTypes = enableImageTypes;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
using System.Diagnostics.CodeAnalysis;
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
|
||||||
namespace Jellyfin.Api.Models.LibraryDtos
|
namespace Jellyfin.Api.Models.LibraryDtos
|
||||||
{
|
{
|
||||||
|
@ -10,25 +11,21 @@ namespace Jellyfin.Api.Models.LibraryDtos
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the metadata savers.
|
/// Gets or sets the metadata savers.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[SuppressMessage("Microsoft.Performance", "CA1819:ReturnArrays", MessageId = "MetadataSavers", Justification = "Imported from ServiceStack")]
|
public IReadOnlyList<LibraryOptionInfoDto> MetadataSavers { get; set; } = Array.Empty<LibraryOptionInfoDto>();
|
||||||
public LibraryOptionInfoDto[] MetadataSavers { get; set; } = null!;
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the metadata readers.
|
/// Gets or sets the metadata readers.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[SuppressMessage("Microsoft.Performance", "CA1819:ReturnArrays", MessageId = "MetadataReaders", Justification = "Imported from ServiceStack")]
|
public IReadOnlyList<LibraryOptionInfoDto> MetadataReaders { get; set; } = Array.Empty<LibraryOptionInfoDto>();
|
||||||
public LibraryOptionInfoDto[] MetadataReaders { get; set; } = null!;
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the subtitle fetchers.
|
/// Gets or sets the subtitle fetchers.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[SuppressMessage("Microsoft.Performance", "CA1819:ReturnArrays", MessageId = "SubtitleFetchers", Justification = "Imported from ServiceStack")]
|
public IReadOnlyList<LibraryOptionInfoDto> SubtitleFetchers { get; set; } = Array.Empty<LibraryOptionInfoDto>();
|
||||||
public LibraryOptionInfoDto[] SubtitleFetchers { get; set; } = null!;
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the type options.
|
/// Gets or sets the type options.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[SuppressMessage("Microsoft.Performance", "CA1819:ReturnArrays", MessageId = "TypeOptions", Justification = "Imported from ServiceStack")]
|
public IReadOnlyList<LibraryTypeOptionsDto> TypeOptions { get; set; } = Array.Empty<LibraryTypeOptionsDto>();
|
||||||
public LibraryTypeOptionsDto[] TypeOptions { get; set; } = null!;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
using System.Diagnostics.CodeAnalysis;
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
using MediaBrowser.Model.Configuration;
|
using MediaBrowser.Model.Configuration;
|
||||||
using MediaBrowser.Model.Entities;
|
using MediaBrowser.Model.Entities;
|
||||||
|
|
||||||
|
@ -17,25 +18,21 @@ namespace Jellyfin.Api.Models.LibraryDtos
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the metadata fetchers.
|
/// Gets or sets the metadata fetchers.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[SuppressMessage("Microsoft.Performance", "CA1819:ReturnArrays", MessageId = "MetadataFetchers", Justification = "Imported from ServiceStack")]
|
public IReadOnlyList<LibraryOptionInfoDto> MetadataFetchers { get; set; } = Array.Empty<LibraryOptionInfoDto>();
|
||||||
public LibraryOptionInfoDto[] MetadataFetchers { get; set; } = null!;
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the image fetchers.
|
/// Gets or sets the image fetchers.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[SuppressMessage("Microsoft.Performance", "CA1819:ReturnArrays", MessageId = "ImageFetchers", Justification = "Imported from ServiceStack")]
|
public IReadOnlyList<LibraryOptionInfoDto> ImageFetchers { get; set; } = Array.Empty<LibraryOptionInfoDto>();
|
||||||
public LibraryOptionInfoDto[] ImageFetchers { get; set; } = null!;
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the supported image types.
|
/// Gets or sets the supported image types.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[SuppressMessage("Microsoft.Performance", "CA1819:ReturnArrays", MessageId = "SupportedImageTypes", Justification = "Imported from ServiceStack")]
|
public IReadOnlyList<ImageType> SupportedImageTypes { get; set; } = Array.Empty<ImageType>();
|
||||||
public ImageType[] SupportedImageTypes { get; set; } = null!;
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the default image options.
|
/// Gets or sets the default image options.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[SuppressMessage("Microsoft.Performance", "CA1819:ReturnArrays", MessageId = "DefaultImageOptions", Justification = "Imported from ServiceStack")]
|
public IReadOnlyList<ImageOption> DefaultImageOptions { get; set; } = Array.Empty<ImageOption>();
|
||||||
public ImageOption[] DefaultImageOptions { get; set; } = null!;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
using System.Collections.Generic;
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
using System.Diagnostics.CodeAnalysis;
|
using System.Diagnostics.CodeAnalysis;
|
||||||
using MediaBrowser.Controller.LiveTv;
|
using MediaBrowser.Controller.LiveTv;
|
||||||
using MediaBrowser.Model.Dto;
|
using MediaBrowser.Model.Dto;
|
||||||
|
@ -25,8 +26,7 @@ namespace Jellyfin.Api.Models.LiveTvDtos
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets list of mappings.
|
/// Gets or sets list of mappings.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[SuppressMessage("Microsoft.Performance", "CA1819:DontReturnArrays", MessageId = "Mappings", Justification = "Imported from ServiceStack")]
|
public IReadOnlyList<NameValuePair> Mappings { get; set; } = Array.Empty<NameValuePair>();
|
||||||
public NameValuePair[] Mappings { get; set; } = null!;
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets provider name.
|
/// Gets or sets provider name.
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
using System;
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
using System.Diagnostics.CodeAnalysis;
|
using System.Diagnostics.CodeAnalysis;
|
||||||
using System.Text.Json.Serialization;
|
using System.Text.Json.Serialization;
|
||||||
using MediaBrowser.Common.Json.Converters;
|
using MediaBrowser.Common.Json.Converters;
|
||||||
|
@ -143,8 +144,7 @@ namespace Jellyfin.Api.Models.LiveTvDtos
|
||||||
/// Optional.
|
/// Optional.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[JsonConverter(typeof(JsonCommaDelimitedArrayConverterFactory))]
|
[JsonConverter(typeof(JsonCommaDelimitedArrayConverterFactory))]
|
||||||
[SuppressMessage("Microsoft.Performance", "CA1819:ReturnArrays", MessageId = "EnableImageTypes", Justification = "Imported from ServiceStack")]
|
public IReadOnlyList<ImageType> EnableImageTypes { get; set; } = Array.Empty<ImageType>();
|
||||||
public ImageType[] EnableImageTypes { get; set; } = Array.Empty<ImageType>();
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets include user data.
|
/// Gets or sets include user data.
|
||||||
|
@ -169,7 +169,6 @@ namespace Jellyfin.Api.Models.LiveTvDtos
|
||||||
/// Optional.
|
/// Optional.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[JsonConverter(typeof(JsonCommaDelimitedArrayConverterFactory))]
|
[JsonConverter(typeof(JsonCommaDelimitedArrayConverterFactory))]
|
||||||
[SuppressMessage("Microsoft.Performance", "CA1819:ReturnArrays", MessageId = "Fields", Justification = "Imported from ServiceStack")]
|
public IReadOnlyList<ItemFields> Fields { get; set; } = Array.Empty<ItemFields>();
|
||||||
public ItemFields[] Fields { get; set; } = Array.Empty<ItemFields>();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
using System.Diagnostics.CodeAnalysis;
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
using MediaBrowser.Model.Dlna;
|
using MediaBrowser.Model.Dlna;
|
||||||
using MediaBrowser.Model.MediaInfo;
|
using MediaBrowser.Model.MediaInfo;
|
||||||
|
|
||||||
|
@ -17,8 +18,6 @@ namespace Jellyfin.Api.Models.MediaInfoDtos
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the device play protocols.
|
/// Gets or sets the device play protocols.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[SuppressMessage("Microsoft.Performance", "CA1819:DontReturnArrays", MessageId = "DevicePlayProtocols", Justification = "Imported from ServiceStack")]
|
public IReadOnlyList<MediaProtocol> DirectPlayProtocols { get; set; } = Array.Empty<MediaProtocol>();
|
||||||
[SuppressMessage("Microsoft.Performance", "SA1011:ClosingBracketsSpace", MessageId = "DevicePlayProtocols", Justification = "Imported from ServiceStack")]
|
|
||||||
public MediaProtocol[]? DirectPlayProtocols { get; set; }
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
#pragma warning disable CS1591
|
#pragma warning disable CS1591
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using MediaBrowser.Model.Entities;
|
using MediaBrowser.Model.Entities;
|
||||||
using MediaBrowser.Model.Querying;
|
using MediaBrowser.Model.Querying;
|
||||||
|
@ -15,9 +16,9 @@ namespace MediaBrowser.Controller.Dto
|
||||||
ItemFields.RefreshState
|
ItemFields.RefreshState
|
||||||
};
|
};
|
||||||
|
|
||||||
public ItemFields[] Fields { get; set; }
|
public IReadOnlyList<ItemFields> Fields { get; set; }
|
||||||
|
|
||||||
public ImageType[] ImageTypes { get; set; }
|
public IReadOnlyList<ImageType> ImageTypes { get; set; }
|
||||||
|
|
||||||
public int ImageTypeLimit { get; set; }
|
public int ImageTypeLimit { get; set; }
|
||||||
|
|
||||||
|
|
|
@ -225,7 +225,7 @@ namespace MediaBrowser.Controller.LiveTv
|
||||||
/// <param name="fields">The fields.</param>
|
/// <param name="fields">The fields.</param>
|
||||||
/// <param name="user">The user.</param>
|
/// <param name="user">The user.</param>
|
||||||
/// <returns>Task.</returns>
|
/// <returns>Task.</returns>
|
||||||
Task AddInfoToProgramDto(IReadOnlyCollection<(BaseItem, BaseItemDto)> programs, ItemFields[] fields, User user = null);
|
Task AddInfoToProgramDto(IReadOnlyCollection<(BaseItem, BaseItemDto)> programs, IReadOnlyList<ItemFields> fields, User user = null);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Saves the tuner host.
|
/// Saves the tuner host.
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
#pragma warning disable CS1591
|
#pragma warning disable CS1591
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
using MediaBrowser.Model.Dlna;
|
using MediaBrowser.Model.Dlna;
|
||||||
|
|
||||||
namespace MediaBrowser.Model.MediaInfo
|
namespace MediaBrowser.Model.MediaInfo
|
||||||
|
@ -55,6 +56,6 @@ namespace MediaBrowser.Model.MediaInfo
|
||||||
|
|
||||||
public bool EnableDirectStream { get; set; }
|
public bool EnableDirectStream { get; set; }
|
||||||
|
|
||||||
public MediaProtocol[] DirectPlayProtocols { get; set; }
|
public IReadOnlyList<MediaProtocol> DirectPlayProtocols { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user