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