mirror of
https://github.com/jellyfin/jellyfin.git
synced 2026-04-20 17:14:42 +01:00
Merge pull request #4499 from crobibero/more-param
Reduce RequestHelpers.Split usage and remove RequestHelpers.GetGuids
This commit is contained in:
@@ -634,7 +634,7 @@ namespace Emby.Server.Implementations.Channels
|
||||
{
|
||||
var channels = GetAllChannels().Where(i => i is ISupportsLatestMedia).ToArray();
|
||||
|
||||
if (query.ChannelIds.Length > 0)
|
||||
if (query.ChannelIds.Count > 0)
|
||||
{
|
||||
// Avoid implicitly captured closure
|
||||
var ids = query.ChannelIds;
|
||||
|
||||
@@ -3611,12 +3611,12 @@ namespace Emby.Server.Implementations.Data
|
||||
whereClauses.Add($"type in ({inClause})");
|
||||
}
|
||||
|
||||
if (query.ChannelIds.Length == 1)
|
||||
if (query.ChannelIds.Count == 1)
|
||||
{
|
||||
whereClauses.Add("ChannelId=@ChannelId");
|
||||
statement?.TryBind("@ChannelId", query.ChannelIds[0].ToString("N", CultureInfo.InvariantCulture));
|
||||
}
|
||||
else if (query.ChannelIds.Length > 1)
|
||||
else if (query.ChannelIds.Count > 1)
|
||||
{
|
||||
var inClause = string.Join(",", query.ChannelIds.Select(i => "'" + i.ToString("N", CultureInfo.InvariantCulture) + "'"));
|
||||
whereClauses.Add($"ChannelId in ({inClause})");
|
||||
@@ -4076,7 +4076,7 @@ namespace Emby.Server.Implementations.Data
|
||||
whereClauses.Add(clause);
|
||||
}
|
||||
|
||||
if (query.GenreIds.Length > 0)
|
||||
if (query.GenreIds.Count > 0)
|
||||
{
|
||||
var clauses = new List<string>();
|
||||
var index = 0;
|
||||
@@ -4097,7 +4097,7 @@ namespace Emby.Server.Implementations.Data
|
||||
whereClauses.Add(clause);
|
||||
}
|
||||
|
||||
if (query.Genres.Length > 0)
|
||||
if (query.Genres.Count > 0)
|
||||
{
|
||||
var clauses = new List<string>();
|
||||
var index = 0;
|
||||
|
||||
@@ -1503,7 +1503,7 @@ namespace Emby.Server.Implementations.Library
|
||||
{
|
||||
if (query.AncestorIds.Length == 0 &&
|
||||
query.ParentId.Equals(Guid.Empty) &&
|
||||
query.ChannelIds.Length == 0 &&
|
||||
query.ChannelIds.Count == 0 &&
|
||||
query.TopParentIds.Length == 0 &&
|
||||
string.IsNullOrEmpty(query.AncestorWithPresentationUniqueKey) &&
|
||||
string.IsNullOrEmpty(query.SeriesPresentationUniqueKey) &&
|
||||
|
||||
@@ -150,7 +150,7 @@ namespace Emby.Server.Implementations.Playlists
|
||||
await playlist.RefreshMetadata(new MetadataRefreshOptions(new DirectoryService(_fileSystem)) { ForceSave = true }, CancellationToken.None)
|
||||
.ConfigureAwait(false);
|
||||
|
||||
if (options.ItemIdList.Length > 0)
|
||||
if (options.ItemIdList.Count > 0)
|
||||
{
|
||||
await AddToPlaylistInternal(playlist.Id, options.ItemIdList, user, new DtoOptions(false)
|
||||
{
|
||||
@@ -184,7 +184,7 @@ namespace Emby.Server.Implementations.Playlists
|
||||
return Playlist.GetPlaylistItems(playlistMediaType, items, user, options);
|
||||
}
|
||||
|
||||
public Task AddToPlaylistAsync(Guid playlistId, ICollection<Guid> itemIds, Guid userId)
|
||||
public Task AddToPlaylistAsync(Guid playlistId, IReadOnlyCollection<Guid> itemIds, Guid userId)
|
||||
{
|
||||
var user = userId.Equals(Guid.Empty) ? null : _userManager.GetUserById(userId);
|
||||
|
||||
@@ -194,7 +194,7 @@ namespace Emby.Server.Implementations.Playlists
|
||||
});
|
||||
}
|
||||
|
||||
private async Task AddToPlaylistInternal(Guid playlistId, ICollection<Guid> newItemIds, User user, DtoOptions options)
|
||||
private async Task AddToPlaylistInternal(Guid playlistId, IReadOnlyCollection<Guid> newItemIds, User user, DtoOptions options)
|
||||
{
|
||||
// Retrieve the existing playlist
|
||||
var playlist = _libraryManager.GetItemById(playlistId) as Playlist
|
||||
|
||||
Reference in New Issue
Block a user