Remove unnecessary casts and explicit array types
This commit is contained in:
parent
86c06996b1
commit
80cfcf5643
|
@ -241,7 +241,7 @@ namespace MediaBrowser.Api
|
|||
{
|
||||
Limit = request.Limit,
|
||||
StartIndex = request.StartIndex,
|
||||
ChannelIds = new Guid[] { new Guid(request.Id) },
|
||||
ChannelIds = new[] { new Guid(request.Id) },
|
||||
ParentId = string.IsNullOrWhiteSpace(request.FolderId) ? Guid.Empty : new Guid(request.FolderId),
|
||||
OrderBy = request.GetOrderBy(),
|
||||
DtoOptions = new Controller.Dto.DtoOptions
|
||||
|
|
|
@ -133,7 +133,7 @@ namespace MediaBrowser.Api
|
|||
// Non recursive not yet supported for library folders
|
||||
if ((request.Recursive ?? true) || parentItem is UserView || parentItem is ICollectionFolder)
|
||||
{
|
||||
genreQuery.AncestorIds = parentItem == null ? Array.Empty<Guid>() : new Guid[] { parentItem.Id };
|
||||
genreQuery.AncestorIds = parentItem == null ? Array.Empty<Guid>() : new[] { parentItem.Id };
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -231,7 +231,7 @@ namespace MediaBrowser.Api
|
|||
EnableTotalRecordCount = false,
|
||||
DtoOptions = new Controller.Dto.DtoOptions
|
||||
{
|
||||
Fields = new ItemFields[] { ItemFields.Genres, ItemFields.Tags },
|
||||
Fields = new[] { ItemFields.Genres, ItemFields.Tags },
|
||||
EnableImages = false,
|
||||
EnableUserData = false
|
||||
}
|
||||
|
|
|
@ -650,7 +650,7 @@ namespace MediaBrowser.Api.Images
|
|||
if (!string.IsNullOrWhiteSpace(request.Format)
|
||||
&& Enum.TryParse(request.Format, true, out ImageFormat format))
|
||||
{
|
||||
return new ImageFormat[] { format };
|
||||
return new[] { format };
|
||||
}
|
||||
|
||||
return GetClientSupportedFormats();
|
||||
|
|
|
@ -351,24 +351,24 @@ namespace MediaBrowser.Api.Library
|
|||
switch (contentType)
|
||||
{
|
||||
case CollectionType.BoxSets:
|
||||
return new string[] { "BoxSet" };
|
||||
return new[] { "BoxSet" };
|
||||
case CollectionType.Playlists:
|
||||
return new string[] { "Playlist" };
|
||||
return new[] { "Playlist" };
|
||||
case CollectionType.Movies:
|
||||
return new string[] { "Movie" };
|
||||
return new[] { "Movie" };
|
||||
case CollectionType.TvShows:
|
||||
return new string[] { "Series", "Season", "Episode" };
|
||||
return new[] { "Series", "Season", "Episode" };
|
||||
case CollectionType.Books:
|
||||
return new string[] { "Book" };
|
||||
return new[] { "Book" };
|
||||
case CollectionType.Music:
|
||||
return new string[] { "MusicAlbum", "MusicArtist", "Audio", "MusicVideo" };
|
||||
return new[] { "MusicAlbum", "MusicArtist", "Audio", "MusicVideo" };
|
||||
case CollectionType.HomeVideos:
|
||||
case CollectionType.Photos:
|
||||
return new string[] { "Video", "Photo" };
|
||||
return new[] { "Video", "Photo" };
|
||||
case CollectionType.MusicVideos:
|
||||
return new string[] { "MusicVideo" };
|
||||
return new[] { "MusicVideo" };
|
||||
default:
|
||||
return new string[] { "Series", "Season", "Episode", "Movie" };
|
||||
return new[] { "Series", "Season", "Episode", "Movie" };
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1086,7 +1086,7 @@ namespace MediaBrowser.Api.Library
|
|||
var item = string.IsNullOrEmpty(request.Id)
|
||||
? (!request.UserId.Equals(Guid.Empty)
|
||||
? _libraryManager.GetUserRootFolder()
|
||||
: (Folder)_libraryManager.RootFolder)
|
||||
: _libraryManager.RootFolder)
|
||||
: _libraryManager.GetItemById(request.Id);
|
||||
|
||||
if (item == null)
|
||||
|
@ -1152,7 +1152,7 @@ namespace MediaBrowser.Api.Library
|
|||
var item = string.IsNullOrEmpty(request.Id)
|
||||
? (!request.UserId.Equals(Guid.Empty)
|
||||
? _libraryManager.GetUserRootFolder()
|
||||
: (Folder)_libraryManager.RootFolder)
|
||||
: _libraryManager.RootFolder)
|
||||
: _libraryManager.GetItemById(request.Id);
|
||||
|
||||
if (item == null)
|
||||
|
|
|
@ -394,7 +394,7 @@ namespace MediaBrowser.Api.Movies
|
|||
{
|
||||
var people = _libraryManager.GetPeople(new InternalPeopleQuery
|
||||
{
|
||||
PersonTypes = new string[]
|
||||
PersonTypes = new[]
|
||||
{
|
||||
PersonType.Director
|
||||
}
|
||||
|
|
|
@ -234,7 +234,7 @@ namespace MediaBrowser.Api.Playback
|
|||
OpenToken = mediaSource.OpenToken
|
||||
}).ConfigureAwait(false);
|
||||
|
||||
info.MediaSources = new MediaSourceInfo[] { openStreamResult.MediaSource };
|
||||
info.MediaSources = new[] { openStreamResult.MediaSource };
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -289,7 +289,7 @@ namespace MediaBrowser.Api.Playback
|
|||
{
|
||||
var mediaSource = await _mediaSourceManager.GetLiveStream(liveStreamId, CancellationToken.None).ConfigureAwait(false);
|
||||
|
||||
mediaSources = new MediaSourceInfo[] { mediaSource };
|
||||
mediaSources = new[] { mediaSource };
|
||||
}
|
||||
|
||||
if (mediaSources.Length == 0)
|
||||
|
@ -366,7 +366,7 @@ namespace MediaBrowser.Api.Playback
|
|||
|
||||
var options = new VideoOptions
|
||||
{
|
||||
MediaSources = new MediaSourceInfo[] { mediaSource },
|
||||
MediaSources = new[] { mediaSource },
|
||||
Context = EncodingContext.Streaming,
|
||||
DeviceId = auth.DeviceId,
|
||||
ItemId = item.Id,
|
||||
|
|
|
@ -300,7 +300,7 @@ namespace MediaBrowser.Api.Playback
|
|||
|
||||
// hls segment container can only be mpegts or fmp4 per ffmpeg documentation
|
||||
// TODO: remove this when we switch back to the segment muxer
|
||||
var supportedHLSContainers = new string[] { "mpegts", "fmp4" };
|
||||
var supportedHLSContainers = new[] { "mpegts", "fmp4" };
|
||||
|
||||
var newRequest = new GetMasterHlsAudioPlaylist
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue
Block a user