The Free Software Media System - Server Backend & API
update live tv data transfer
Luke Pulverenti1ad990ad7209
diff --git a/Emby.Dlna/ContentDirectory/ControlHandler.cs b/Emby.Dlna/ContentDirectory/ControlHandler.csindex 96b282d04b..5ce1d1925f 100644--- a/Emby.Dlna/ContentDirectory/ControlHandler.cs+++ b/Emby.Dlna/ContentDirectory/ControlHandler.cs@@ -487,6 +487,11 @@ namespace Emby.Dlna.ContentDirectoryreturn GetMusicArtistItems(item, null, user, sort, startIndex, limit);}+ if (item is Genre)+ {+ return GetGenreItems(item, null, user, sort, startIndex, limit);+ }+var collectionFolder = item as ICollectionFolder;if (collectionFolder != null && string.Equals(CollectionType.Music, collectionFolder.CollectionType, StringComparison.OrdinalIgnoreCase)){@@ -1173,6 +1178,26 @@ namespace Emby.Dlna.ContentDirectoryreturn ToResult(result);}+ private QueryResult<ServerItem> GetGenreItems(BaseItem item, Guid? parentId, User user, SortCriteria sort, int? startIndex, int? limit)+ {+ var query = new InternalItemsQuery(user)+ {+ Recursive = true,+ ParentId = parentId,+ GenreIds = new[] { item.Id.ToString("N") },+ IncludeItemTypes = new[] { typeof(Movie).Name, typeof(Series).Name },+ Limit = limit,+ StartIndex = startIndex,+ DtoOptions = GetDtoOptions()+ };++ SetSorting(query, sort, false);++ var result = _libraryManager.GetItemsResult(query);++ return ToResult(result);+ }+private QueryResult<ServerItem> GetMusicGenreItems(BaseItem item, Guid? parentId, User user, SortCriteria sort, int? startIndex, int? limit){var query = new InternalItemsQuery(user)diff --git a/Emby.Dlna/Didl/DidlBuilder.cs b/Emby.Dlna/Didl/DidlBuilder.csindex 64e76276cf..65410bd67d 100644--- a/Emby.Dlna/Didl/DidlBuilder.cs+++ b/Emby.Dlna/Didl/DidlBuilder.cs@@ -198,7 +198,7 @@ namespace Emby.Dlna.DidlstreamInfo = new StreamBuilder(_mediaEncoder, GetStreamBuilderLogger(options)).BuildVideoItem(new VideoOptions{ItemId = GetClientId(video),- MediaSources = sources,+ MediaSources = sources.ToArray(sources.Count),Profile = _profile,DeviceId = deviceId,MaxBitrate = _profile.MaxStreamingBitrate@@ -513,7 +513,7 @@ namespace Emby.Dlna.DidlstreamInfo = new StreamBuilder(_mediaEncoder, GetStreamBuilderLogger(options)).BuildAudioItem(new AudioOptions{ItemId = GetClientId(audio),- MediaSources = sources,+ MediaSources = sources.ToArray(sources.Count),Profile = _profile,DeviceId = deviceId});diff --git a/Emby.Dlna/PlayTo/PlayToController.cs b/Emby.Dlna/PlayTo/PlayToController.csindex 7164cf5989..d563b5addd 100644--- a/Emby.Dlna/PlayTo/PlayToController.cs+++ b/Emby.Dlna/PlayTo/PlayToController.cs@@ -20,6 +20,7 @@ using MediaBrowser.Common.Configuration;using MediaBrowser.Controller.MediaEncoding;using MediaBrowser.Model.Events;using MediaBrowser.Model.Globalization;+using MediaBrowser.Model.Extensions;namespace Emby.Dlna.PlayTo{@@ -589,7 +590,7 @@ namespace Emby.Dlna.PlayToStreamInfo = new StreamBuilder(_mediaEncoder, GetStreamBuilderLogger()).BuildVideoItem(new VideoOptions{ItemId = item.Id.ToString("N"),- MediaSources = mediaSources,+ MediaSources = mediaSources.ToArray(mediaSources.Count),Profile = profile,DeviceId = deviceId,MaxBitrate = profile.MaxStreamingBitrate,@@ -609,7 +610,7 @@ namespace Emby.Dlna.PlayToStreamInfo = new StreamBuilder(_mediaEncoder, GetStreamBuilderLogger()).BuildAudioItem(new AudioOptions{ItemId = item.Id.ToString("N"),- MediaSources = mediaSources,+ MediaSources = mediaSources.ToArray(mediaSources.Count),Profile = profile,DeviceId = deviceId,MaxBitrate = profile.MaxStreamingBitrate,diff --git a/Emby.Dlna/PlayTo/PlayToManager.cs b/Emby.Dlna/PlayTo/PlayToManager.csindex 32f542e73f..e29ef78a88 100644--- a/Emby.Dlna/PlayTo/PlayToManager.cs+++ b/Emby.Dlna/PlayTo/PlayToManager.cs@@ -182,7 +182,7 @@ namespace Emby.Dlna.PlayTo{PlayableMediaTypes = profile.GetSupportedMediaTypes(),- SupportedCommands = new List<string>+ SupportedCommands = new string[]{GeneralCommandType.VolumeDown.ToString(),GeneralCommandType.VolumeUp.ToString(),diff --git a/Emby.Server.Implementations/ApplicationHost.cs b/Emby.Server.Implementations/ApplicationHost.csindex 39b554afe7..ea6c2aaf5f 100644--- a/Emby.Server.Implementations/ApplicationHost.cs+++ b/Emby.Server.Implementations/ApplicationHost.cs@@ -1853,9 +1853,9 @@ namespace Emby.Server.ImplementationsHasPendingRestart = HasPendingRestart,Version = ApplicationVersion.ToString(),WebSocketPortNumber = HttpPort,- FailedPluginAssemblies = FailedAssemblies.ToList(),- InProgressInstallations = InstallationManager.CurrentInstallations.Select(i => i.Item1).ToList(),- CompletedInstallations = InstallationManager.CompletedInstallations.ToList(),+ FailedPluginAssemblies = FailedAssemblies.ToArray(),+ InProgressInstallations = InstallationManager.CurrentInstallations.Select(i => i.Item1).ToArray(),+ CompletedInstallations = InstallationManager.CompletedInstallations.ToArray(),Id = SystemId,ProgramDataPath = ApplicationPaths.ProgramDataPath,LogPath = ApplicationPaths.LogDirectoryPath,diff --git a/Emby.Server.Implementations/Channels/ChannelManager.cs b/Emby.Server.Implementations/Channels/ChannelManager.csindex e41e0ea87f..28a1503700 100644--- a/Emby.Server.Implementations/Channels/ChannelManager.cs+++ b/Emby.Server.Implementations/Channels/ChannelManager.cs@@ -182,10 +182,8 @@ namespace Emby.Server.Implementations.Channels{};- var returnList = (await _dtoService.GetBaseItemDtos(internalResult.Items, dtoOptions, user)+ var returnItems = (await _dtoService.GetBaseItemDtos(internalResult.Items, dtoOptions, user).ConfigureAwait(false));- var returnItems = returnList- .ToArray(returnList.Count);var result = new QueryResult<BaseItemDto>{@@ -464,14 +462,14 @@ namespace Emby.Server.Implementations.Channelsreturn _libraryManager.GetItemById(id) as Channel;}- public IEnumerable<ChannelFeatures> GetAllChannelFeatures()+ public ChannelFeatures[] GetAllChannelFeatures(){return _libraryManager.GetItemIds(new InternalItemsQuery{IncludeItemTypes = new[] { typeof(Channel).Name },SortBy = new[] { ItemSortBy.SortName }- }).Select(i => GetChannelFeatures(i.ToString("N")));+ }).Select(i => GetChannelFeatures(i.ToString("N"))).ToArray();}public ChannelFeatures GetChannelFeatures(string id)@@ -511,10 +509,10 @@ namespace Emby.Server.Implementations.Channels{CanFilter = !features.MaxPageSize.HasValue,CanSearch = provider is ISearchableChannel,- ContentTypes = features.ContentTypes,- DefaultSortFields = features.DefaultSortFields,+ ContentTypes = features.ContentTypes.ToArray(),+ DefaultSortFields = features.DefaultSortFields.ToArray(),MaxPageSize = features.MaxPageSize,- MediaTypes = features.MediaTypes,+ MediaTypes = features.MediaTypes.ToArray(),SupportsSortOrderToggle = features.SupportsSortOrderToggle,SupportsLatestMedia = supportsLatest,Name = channel.Name,@@ -566,12 +564,10 @@ namespace Emby.Server.Implementations.Channelsvar dtoOptions = new DtoOptions(){- Fields = query.Fields.ToList()+ Fields = query.Fields};- var returnList = (await _dtoService.GetBaseItemDtos(items, dtoOptions, user).ConfigureAwait(false));- var returnItems = returnList- .ToArray(returnList.Count);+ var returnItems = (await _dtoService.GetBaseItemDtos(items, dtoOptions, user).ConfigureAwait(false));var result = new QueryResult<BaseItemDto>{@@ -833,13 +829,11 @@ namespace Emby.Server.Implementations.Channelsvar dtoOptions = new DtoOptions(){- Fields = query.Fields.ToList()+ Fields = query.Fields};- var returnList = (await _dtoService.GetBaseItemDtos(internalResult.Items, dtoOptions, user)+ var returnItems = (await _dtoService.GetBaseItemDtos(internalResult.Items, dtoOptions, user).ConfigureAwait(false));- var returnItems = returnList- .ToArray(returnList.Count);var result = new QueryResult<BaseItemDto>{@@ -987,13 +981,11 @@ namespace Emby.Server.Implementations.Channelsvar dtoOptions = new DtoOptions(){- Fields = query.Fields.ToList()+ Fields = query.Fields};- var returnList = (await _dtoService.GetBaseItemDtos(internalResult.Items, dtoOptions, user)+ var returnItems = (await _dtoService.GetBaseItemDtos(internalResult.Items, dtoOptions, user).ConfigureAwait(false));- var returnItems = returnList- .ToArray(returnList.Count);var result = new QueryResult<BaseItemDto>{diff --git a/Emby.Server.Implementations/Collections/CollectionManager.cs b/Emby.Server.Implementations/Collections/CollectionManager.csindex 5b168f6cc1..18823fa9dc 100644--- a/Emby.Server.Implementations/Collections/CollectionManager.cs+++ b/Emby.Server.Implementations/Collections/CollectionManager.cs@@ -84,7 +84,7 @@ namespace Emby.Server.Implementations.CollectionsProviderIds = options.ProviderIds,Shares = options.UserIds.Select(i => new Share{- UserId = i.ToString("N"),+ UserId = i,CanEdit = true}).ToList()@@ -92,7 +92,7 @@ namespace Emby.Server.Implementations.Collectionsawait parentFolder.AddChild(collection, CancellationToken.None).ConfigureAwait(false);- if (options.ItemIdList.Count > 0)+ if (options.ItemIdList.Length > 0){await AddToCollection(collection.Id, options.ItemIdList, false, new MetadataRefreshOptions(_fileSystem){@@ -149,12 +149,12 @@ namespace Emby.Server.Implementations.Collectionsreturn GetCollectionsFolder(string.Empty);}- public Task AddToCollection(Guid collectionId, IEnumerable<Guid> ids)+ public Task AddToCollection(Guid collectionId, string[] ids){return AddToCollection(collectionId, ids, true, new MetadataRefreshOptions(_fileSystem));}- private async Task AddToCollection(Guid collectionId, IEnumerable<Guid> ids, bool fireEvent, MetadataRefreshOptions refreshOptions)+ private async Task AddToCollection(Guid collectionId, string[] ids, bool fireEvent, MetadataRefreshOptions refreshOptions){var collection = _libraryManager.GetItemById(collectionId) as BoxSet;@@ -165,11 +165,12 @@ namespace Emby.Server.Implementations.Collectionsvar list = new List<LinkedChild>();var itemList = new List<BaseItem>();- var currentLinkedChildren = collection.GetLinkedChildren().ToList();+ var currentLinkedChildrenIds = collection.GetLinkedChildren().Select(i => i.Id).ToList();foreach (var itemId in ids){- var item = _libraryManager.GetItemById(itemId);+ var guidId = new Guid(itemId);+ var item = _libraryManager.GetItemById(guidId);if (string.IsNullOrWhiteSpace(item.Path)){@@ -183,7 +184,7 @@ namespace Emby.Server.Implementations.CollectionsitemList.Add(item);- if (currentLinkedChildren.All(i => i.Id != itemId))+ if (!currentLinkedChildrenIds.Contains(guidId)){list.Add(LinkedChild.Create(item));}@@ -213,7 +214,7 @@ namespace Emby.Server.Implementations.Collections}}- public async Task RemoveFromCollection(Guid collectionId, IEnumerable<Guid> itemIds)+ public async Task RemoveFromCollection(Guid collectionId, string[] itemIds){var collection = _libraryManager.GetItemById(collectionId) as BoxSet;@@ -227,9 +228,10 @@ namespace Emby.Server.Implementations.Collectionsforeach (var itemId in itemIds){- var childItem = _libraryManager.GetItemById(itemId);+ var guidId = new Guid(itemId);+ var childItem = _libraryManager.GetItemById(guidId);- var child = collection.LinkedChildren.FirstOrDefault(i => (i.ItemId.HasValue && i.ItemId.Value == itemId) || (childItem != null && string.Equals(childItem.Path, i.Path, StringComparison.OrdinalIgnoreCase)));+ var child = collection.LinkedChildren.FirstOrDefault(i => (i.ItemId.HasValue && i.ItemId.Value == guidId) || (childItem != null && string.Equals(childItem.Path, i.Path, StringComparison.OrdinalIgnoreCase)));if (child == null){diff --git a/Emby.Server.Implementations/Data/SqliteItemRepository.cs b/Emby.Server.Implementations/Data/SqliteItemRepository.csindex 6743e96fd3..d7cbdf9e58 100644--- a/Emby.Server.Implementations/Data/SqliteItemRepository.cs+++ b/Emby.Server.Implementations/Data/SqliteItemRepository.cs@@ -149,7 +149,7 @@ namespace Emby.Server.Implementations.Data"create table if not exists AncestorIds (ItemId GUID, AncestorId GUID, AncestorIdText TEXT, PRIMARY KEY (ItemId, AncestorId))","create index if not exists idx_AncestorIds1 on AncestorIds(AncestorId)",- "create index if not exists idx_AncestorIds2 on AncestorIds(AncestorIdText)",+ "create index if not exists idx_AncestorIds5 on AncestorIds(AncestorIdText,ItemId)","create table if not exists ItemValues (ItemId GUID, Type INT, Value TEXT, CleanValue TEXT)",@@ -308,6 +308,7 @@ namespace Emby.Server.Implementations.Data"drop index if exists idx_TypeSeriesPresentationUniqueKey2","drop index if exists idx_AncestorIds3","drop index if exists idx_AncestorIds4",+ "drop index if exists idx_AncestorIds2","create index if not exists idx_PathTypedBaseItems on TypedBaseItems(Path)","create index if not exists idx_ParentIdTypedBaseItems on TypedBaseItems(ParentId)",diff --git a/Emby.Server.Implementations/Devices/DeviceRepository.cs b/Emby.Server.Implementations/Devices/DeviceRepository.csindex de0dfda2ed..b286a3bb07 100644--- a/Emby.Server.Implementations/Devices/DeviceRepository.cs+++ b/Emby.Server.Implementations/Devices/DeviceRepository.cs@@ -11,6 +11,7 @@ using MediaBrowser.Model.IO;using MediaBrowser.Model.Logging;using MediaBrowser.Model.Serialization;using MediaBrowser.Model.Session;+using MediaBrowser.Model.Extensions;namespace Emby.Server.Implementations.Devices{@@ -199,7 +200,10 @@ namespace Emby.Server.Implementations.Devices}history.DeviceId = deviceId;- history.FilesUploaded.Add(file);++ var list = history.FilesUploaded.ToList();+ list.Add(file);+ history.FilesUploaded = list.ToArray(list.Count);_json.SerializeToFile(history, path);}diff --git a/Emby.Server.Implementations/Dto/DtoService.cs b/Emby.Server.Implementations/Dto/DtoService.csindex e1d0a1858f..9dbf299ab8 100644--- a/Emby.Server.Implementations/Dto/DtoService.cs+++ b/Emby.Server.Implementations/Dto/DtoService.cs@@ -77,7 +77,7 @@ namespace Emby.Server.Implementations.Dto/// <param name="owner">The owner.</param>/// <returns>Task{DtoBaseItem}.</returns>/// <exception cref="System.ArgumentNullException">item</exception>- public BaseItemDto GetBaseItemDto(BaseItem item, List<ItemFields> fields, User user = null, BaseItem owner = null)+ public BaseItemDto GetBaseItemDto(BaseItem item, ItemFields[] fields, User user = null, BaseItem owner = null){var options = new DtoOptions{@@ -87,7 +87,17 @@ namespace Emby.Server.Implementations.Dtoreturn GetBaseItemDto(item, options, user, owner);}- public async Task<List<BaseItemDto>> GetBaseItemDtos(IEnumerable<BaseItem> items, DtoOptions options, User user = null, BaseItem owner = null)+ public Task<BaseItemDto[]> GetBaseItemDtos(List<BaseItem> items, DtoOptions options, User user = null, BaseItem owner = null)+ {+ return GetBaseItemDtos(items, items.Count, options, user, owner);+ }++ public Task<BaseItemDto[]> GetBaseItemDtos(BaseItem[] items, DtoOptions options, User user = null, BaseItem owner = null)+ {+ return GetBaseItemDtos(items, items.Length, options, user, owner);+ }++ public async Task<BaseItemDto[]> GetBaseItemDtos(IEnumerable<BaseItem> items, int itemCount, DtoOptions options, User user = null, BaseItem owner = null){if (items == null){@@ -101,7 +111,7 @@ namespace Emby.Server.Implementations.Dtovar syncDictionary = GetSyncedItemProgress(options);- var list = new List<BaseItemDto>();+ var returnItems = new BaseItemDto[itemCount];var programTuples = new List<Tuple<BaseItem, BaseItemDto>>();var channelTuples = new List<Tuple<BaseItemDto, LiveTvChannel>>();@@ -109,6 +119,7 @@ namespace Emby.Server.Implementations.Dto? _providerManager.GetRefreshQueue(): null;+ var index = 0;foreach (var item in items){var dto = GetBaseItemDtoInternal(item, options, refreshQueue, user, owner);@@ -144,7 +155,8 @@ namespace Emby.Server.Implementations.DtoFillSyncInfo(dto, item, options, user, syncDictionary);- list.Add(dto);+ returnItems[index] = dto;+ index++;}if (programTuples.Count > 0)@@ -157,7 +169,7 @@ namespace Emby.Server.Implementations.Dtoawait _livetvManager().AddChannelInfo(channelTuples, options, user).ConfigureAwait(false);}- return list;+ return returnItems;}public BaseItemDto GetBaseItemDto(BaseItem item, DtoOptions options, User user = null, BaseItem owner = null)@@ -992,7 +1004,7 @@ namespace Emby.Server.Implementations.Dto{dto.RemoteTrailers = hasTrailers != null ?hasTrailers.RemoteTrailers :- new MediaUrl[] {};+ new MediaUrl[] { };}dto.Name = item.Name;@@ -1053,7 +1065,7 @@ namespace Emby.Server.Implementations.Dtoif (dto.Taglines == null){- dto.Taglines = new string[]{};+ dto.Taglines = new string[] { };}}@@ -1243,17 +1255,17 @@ namespace Emby.Server.Implementations.Dtoif (iHasMediaSources != null){- List<MediaStream> mediaStreams;+ MediaStream[] mediaStreams;if (dto.MediaSources != null && dto.MediaSources.Count > 0){mediaStreams = dto.MediaSources.Where(i => new Guid(i.Id) == item.Id).SelectMany(i => i.MediaStreams)- .ToList();+ .ToArray();}else{- mediaStreams = _mediaSourceManager().GetStaticMediaSources(iHasMediaSources, true).First().MediaStreams;+ mediaStreams = _mediaSourceManager().GetStaticMediaSources(iHasMediaSources, true).First().MediaStreams.ToArray();}dto.MediaStreams = mediaStreams;diff --git a/Emby.Server.Implementations/EntryPoints/LibraryChangedNotifier.cs b/Emby.Server.Implementations/EntryPoints/LibraryChangedNotifier.csindex 69a205dda9..80a188bc0f 100644--- a/Emby.Server.Implementations/EntryPoints/LibraryChangedNotifier.cs+++ b/Emby.Server.Implementations/EntryPoints/LibraryChangedNotifier.cs@@ -367,15 +367,15 @@ namespace Emby.Server.Implementations.EntryPointsreturn new LibraryUpdateInfo{- ItemsAdded = itemsAdded.SelectMany(i => TranslatePhysicalItemToUserLibrary(i, user)).Select(i => i.Id.ToString("N")).Distinct().ToList(),+ ItemsAdded = itemsAdded.SelectMany(i => TranslatePhysicalItemToUserLibrary(i, user)).Select(i => i.Id.ToString("N")).Distinct().ToArray(),- ItemsUpdated = itemsUpdated.SelectMany(i => TranslatePhysicalItemToUserLibrary(i, user)).Select(i => i.Id.ToString("N")).Distinct().ToList(),+ ItemsUpdated = itemsUpdated.SelectMany(i => TranslatePhysicalItemToUserLibrary(i, user)).Select(i => i.Id.ToString("N")).Distinct().ToArray(),- ItemsRemoved = itemsRemoved.SelectMany(i => TranslatePhysicalItemToUserLibrary(i, user, true)).Select(i => i.Id.ToString("N")).Distinct().ToList(),+ ItemsRemoved = itemsRemoved.SelectMany(i => TranslatePhysicalItemToUserLibrary(i, user, true)).Select(i => i.Id.ToString("N")).Distinct().ToArray(),- FoldersAddedTo = foldersAddedTo.SelectMany(i => TranslatePhysicalItemToUserLibrary(i, user)).Select(i => i.Id.ToString("N")).Distinct().ToList(),+ FoldersAddedTo = foldersAddedTo.SelectMany(i => TranslatePhysicalItemToUserLibrary(i, user)).Select(i => i.Id.ToString("N")).Distinct().ToArray(),- FoldersRemovedFrom = foldersRemovedFrom.SelectMany(i => TranslatePhysicalItemToUserLibrary(i, user)).Select(i => i.Id.ToString("N")).Distinct().ToList()+ FoldersRemovedFrom = foldersRemovedFrom.SelectMany(i => TranslatePhysicalItemToUserLibrary(i, user)).Select(i => i.Id.ToString("N")).Distinct().ToArray()};}diff --git a/Emby.Server.Implementations/EntryPoints/UserDataChangeNotifier.cs b/Emby.Server.Implementations/EntryPoints/UserDataChangeNotifier.csindex 71e31d4d4f..accdc5e9d4 100644--- a/Emby.Server.Implementations/EntryPoints/UserDataChangeNotifier.cs+++ b/Emby.Server.Implementations/EntryPoints/UserDataChangeNotifier.cs@@ -126,7 +126,7 @@ namespace Emby.Server.Implementations.EntryPointsdto.ItemId = i.Id.ToString("N");return dto;})- .ToList();+ .ToArray();var info = new UserDataChangeInfo{diff --git a/Emby.Server.Implementations/HttpServer/HttpListenerHost.cs b/Emby.Server.Implementations/HttpServer/HttpListenerHost.csindex f150e47859..f1fea2085b 100644--- a/Emby.Server.Implementations/HttpServer/HttpListenerHost.cs+++ b/Emby.Server.Implementations/HttpServer/HttpListenerHost.cs@@ -162,7 +162,7 @@ namespace Emby.Server.Implementations.HttpServerreturn serviceType;}- public void AddServiceInfo(Type serviceType, Type requestType, Type responseType)+ public void AddServiceInfo(Type serviceType, Type requestType){ServiceOperationsMap[requestType] = serviceType;}diff --git a/Emby.Server.Implementations/IO/LibraryMonitor.cs b/Emby.Server.Implementations/IO/LibraryMonitor.csindex c452c01be3..1467d9426a 100644--- a/Emby.Server.Implementations/IO/LibraryMonitor.cs+++ b/Emby.Server.Implementations/IO/LibraryMonitor.cs@@ -35,7 +35,7 @@ namespace Emby.Server.Implementations.IO/// <summary>/// Any file name ending in any of these will be ignored by the watchers/// </summary>- private readonly IReadOnlyList<string> _alwaysIgnoreFiles = new List<string>+ private readonly string[] _alwaysIgnoreFiles = new string[]{"small.jpg","albumart.jpg",@@ -45,7 +45,7 @@ namespace Emby.Server.Implementations.IO"TempSBE"};- private readonly IReadOnlyList<string> _alwaysIgnoreSubstrings = new List<string>+ private readonly string[] _alwaysIgnoreSubstrings = new string[]{// Synology"eaDir",@@ -54,7 +54,7 @@ namespace Emby.Server.Implementations.IO".actors"};- private readonly IReadOnlyList<string> _alwaysIgnoreExtensions = new List<string>+ private readonly string[] _alwaysIgnoreExtensions = new string[]{// thumbs.db".db",diff --git a/Emby.Server.Implementations/Library/LibraryManager.cs b/Emby.Server.Implementations/Library/LibraryManager.csindex 40dccf9bad..bf3afd0507 100644--- a/Emby.Server.Implementations/Library/LibraryManager.cs+++ b/Emby.Server.Implementations/Library/LibraryManager.cs@@ -1208,7 +1208,7 @@ namespace Emby.Server.Implementations.Library.Where(i => string.Equals(ShortcutFileExtension, Path.GetExtension(i), StringComparison.OrdinalIgnoreCase)).Select(_fileSystem.ResolveShortcut).OrderBy(i => i)- .ToList(),+ .ToArray(),CollectionType = GetCollectionType(dir)};@@ -1554,7 +1554,7 @@ namespace Emby.Server.Implementations.LibraryIncludeHidden = true,IncludeExternalContent = allowExternalContent- }, CancellationToken.None).Result.ToList();+ }, CancellationToken.None).Result;query.TopParentIds = userViews.SelectMany(i => GetTopParentIdsForQuery(i, user)).Select(i => i.ToString("N")).ToArray();}@@ -3061,7 +3061,7 @@ namespace Emby.Server.Implementations.Libraryvar topLibraryFolders = GetUserRootFolder().Children.ToList();var info = GetVirtualFolderInfo(virtualFolderPath, topLibraryFolders, null);- if (info.Locations.Count > 0 && info.Locations.Count != options.PathInfos.Length)+ if (info.Locations.Length > 0 && info.Locations.Length != options.PathInfos.Length){var list = options.PathInfos.ToList();diff --git a/Emby.Server.Implementations/Library/SearchEngine.cs b/Emby.Server.Implementations/Library/SearchEngine.csindex 658558ec05..d4c4f27942 100644--- a/Emby.Server.Implementations/Library/SearchEngine.cs+++ b/Emby.Server.Implementations/Library/SearchEngine.cs@@ -181,7 +181,7 @@ namespace Emby.Server.Implementations.LibraryDtoOptions = new DtoOptions{- Fields = new List<ItemFields>+ Fields = new ItemFields[]{ItemFields.AirTime,ItemFields.DateCreated,diff --git a/Emby.Server.Implementations/Library/UserDataManager.cs b/Emby.Server.Implementations/Library/UserDataManager.csindex e066ab61bd..1f2bf97a39 100644--- a/Emby.Server.Implementations/Library/UserDataManager.cs+++ b/Emby.Server.Implementations/Library/UserDataManager.cs@@ -187,11 +187,11 @@ namespace Emby.Server.Implementations.Libraryvar userData = GetUserData(user.Id, item);var dto = GetUserItemDataDto(userData);- item.FillUserDataDtoValues(dto, userData, null, user, new List<ItemFields>());+ item.FillUserDataDtoValues(dto, userData, null, user, new ItemFields[]{});return dto;}- public UserItemDataDto GetUserDataDto(IHasUserData item, BaseItemDto itemDto, User user, List<ItemFields> fields)+ public UserItemDataDto GetUserDataDto(IHasUserData item, BaseItemDto itemDto, User user, ItemFields[] fields){var userData = GetUserData(user.Id, item);var dto = GetUserItemDataDto(userData);diff --git a/Emby.Server.Implementations/Library/UserViewManager.cs b/Emby.Server.Implementations/Library/UserViewManager.csindex 0d4303b168..25c3e10e89 100644--- a/Emby.Server.Implementations/Library/UserViewManager.cs+++ b/Emby.Server.Implementations/Library/UserViewManager.cs@@ -39,7 +39,7 @@ namespace Emby.Server.Implementations.Library_config = config;}- public async Task<IEnumerable<Folder>> GetUserViews(UserViewQuery query, CancellationToken cancellationToken)+ public async Task<Folder[]> GetUserViews(UserViewQuery query, CancellationToken cancellationToken){var user = _userManager.GetUserById(query.UserId);@@ -154,7 +154,8 @@ namespace Emby.Server.Implementations.Libraryreturn index == -1 ? int.MaxValue : index;}).ThenBy(sorted.IndexOf)- .ThenBy(i => i.SortName);+ .ThenBy(i => i.SortName)+ .ToArray();}public Task<UserView> GetUserSubView(string name, string parentId, string type, string sortName, CancellationToken cancellationToken)diff --git a/Emby.Server.Implementations/LiveTv/EmbyTV/EmbyTV.cs b/Emby.Server.Implementations/LiveTv/EmbyTV/EmbyTV.csindex 99b5558a2d..ecad5c0eb2 100644--- a/Emby.Server.Implementations/LiveTv/EmbyTV/EmbyTV.cs+++ b/Emby.Server.Implementations/LiveTv/EmbyTV/EmbyTV.cs@@ -208,7 +208,7 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTVcontinue;}- if (virtualFolder.Locations.Count == 1)+ if (virtualFolder.Locations.Length == 1){// remove entire virtual foldertry@@ -458,7 +458,7 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTVreturn GetEpgChannelFromTunerChannel(info, tunerChannel, epgChannels);}- private string GetMappedChannel(string channelId, List<NameValuePair> mappings)+ private string GetMappedChannel(string channelId, NameValuePair[] mappings){foreach (NameValuePair mapping in mappings){@@ -472,10 +472,10 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTVprivate ChannelInfo GetEpgChannelFromTunerChannel(ListingsProviderInfo info, ChannelInfo tunerChannel, List<ChannelInfo> epgChannels){- return GetEpgChannelFromTunerChannel(info.ChannelMappings.ToList(), tunerChannel, epgChannels);+ return GetEpgChannelFromTunerChannel(info.ChannelMappings, tunerChannel, epgChannels);}- public ChannelInfo GetEpgChannelFromTunerChannel(List<NameValuePair> mappings, ChannelInfo tunerChannel, List<ChannelInfo> epgChannels)+ public ChannelInfo GetEpgChannelFromTunerChannel(NameValuePair[] mappings, ChannelInfo tunerChannel, List<ChannelInfo> epgChannels){if (!string.IsNullOrWhiteSpace(tunerChannel.Id)){@@ -2591,7 +2591,7 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV{list.Add(new VirtualFolderInfo{- Locations = new List<string> { defaultFolder },+ Locations = new string[] { defaultFolder },Name = defaultName});}@@ -2601,7 +2601,7 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV{list.Add(new VirtualFolderInfo{- Locations = new List<string> { customPath },+ Locations = new string[] { customPath },Name = "Recorded Movies",CollectionType = CollectionType.Movies});@@ -2612,7 +2612,7 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV{list.Add(new VirtualFolderInfo{- Locations = new List<string> { customPath },+ Locations = new string[] { customPath },Name = "Recorded Shows",CollectionType = CollectionType.TvShows});diff --git a/Emby.Server.Implementations/LiveTv/LiveTvDtoService.cs b/Emby.Server.Implementations/LiveTv/LiveTvDtoService.csindex 619d2378df..eff2909fdb 100644--- a/Emby.Server.Implementations/LiveTv/LiveTvDtoService.cs+++ b/Emby.Server.Implementations/LiveTv/LiveTvDtoService.cs@@ -15,6 +15,8 @@ using System.Threading;using System.Threading.Tasks;using MediaBrowser.Controller.Entities.TV;using MediaBrowser.Model.Dto;+using MediaBrowser.Model.Extensions;+using MediaBrowser.Model.Querying;namespace Emby.Server.Implementations.LiveTv{@@ -110,7 +112,7 @@ namespace Emby.Server.Implementations.LiveTvPostPaddingSeconds = info.PostPaddingSeconds,IsPostPaddingRequired = info.IsPostPaddingRequired,IsPrePaddingRequired = info.IsPrePaddingRequired,- Days = info.Days,+ Days = info.Days.ToArray(),Priority = info.Priority,RecordAnyChannel = info.RecordAnyChannel,RecordAnyTime = info.RecordAnyTime,@@ -135,7 +137,7 @@ namespace Emby.Server.Implementations.LiveTvdto.ProgramId = GetInternalProgramId(service.Name, info.ProgramId).ToString("N");}- dto.DayPattern = info.Days == null ? null : GetDayPattern(info.Days);+ dto.DayPattern = info.Days == null ? null : GetDayPattern(info.Days.ToArray(info.Days.Count));FillImages(dto, info.Name, info.SeriesId);@@ -150,10 +152,7 @@ namespace Emby.Server.Implementations.LiveTvName = seriesName,Limit = 1,ImageTypes = new ImageType[] { ImageType.Thumb },- DtoOptions = new DtoOptions- {- Fields = new List<MediaBrowser.Model.Querying.ItemFields>()- }+ DtoOptions = new DtoOptions(false)}).FirstOrDefault();@@ -196,10 +195,7 @@ namespace Emby.Server.Implementations.LiveTvExternalSeriesId = programSeriesId,Limit = 1,ImageTypes = new ImageType[] { ImageType.Primary },- DtoOptions = new DtoOptions- {- Fields = new List<MediaBrowser.Model.Querying.ItemFields>()- }+ DtoOptions = new DtoOptions(false)}).FirstOrDefault();@@ -248,10 +244,7 @@ namespace Emby.Server.Implementations.LiveTvName = seriesName,Limit = 1,ImageTypes = new ImageType[] { ImageType.Thumb },- DtoOptions = new DtoOptions- {- Fields = new List<MediaBrowser.Model.Querying.ItemFields>()- }+ DtoOptions = new DtoOptions(false)}).FirstOrDefault();@@ -274,7 +267,7 @@ namespace Emby.Server.Implementations.LiveTv{try{- dto.ParentBackdropImageTags = new List<string>+ dto.ParentBackdropImageTags = new string[]{_imageProcessor.GetImageCacheTag(librarySeries, image)};@@ -294,10 +287,7 @@ namespace Emby.Server.Implementations.LiveTvName = seriesName,Limit = 1,ImageTypes = new ImageType[] { ImageType.Primary },- DtoOptions = new DtoOptions- {- Fields = new List<MediaBrowser.Model.Querying.ItemFields>()- }+ DtoOptions = new DtoOptions(false)}).FirstOrDefault() ?? _libraryManager.GetItemList(new InternalItemsQuery{@@ -305,10 +295,7 @@ namespace Emby.Server.Implementations.LiveTvExternalSeriesId = programSeriesId,Limit = 1,ImageTypes = new ImageType[] { ImageType.Primary },- DtoOptions = new DtoOptions- {- Fields = new List<MediaBrowser.Model.Querying.ItemFields>()- }+ DtoOptions = new DtoOptions(false)}).FirstOrDefault();@@ -327,14 +314,14 @@ namespace Emby.Server.Implementations.LiveTv}}- if (dto.ParentBackdropImageTags == null || dto.ParentBackdropImageTags.Count == 0)+ if (dto.ParentBackdropImageTags == null || dto.ParentBackdropImageTags.Length == 0){image = program.GetImageInfo(ImageType.Backdrop, 0);if (image != null){try{- dto.ParentBackdropImageTags = new List<string>+ dto.ParentBackdropImageTags = new string[]{_imageProcessor.GetImageCacheTag(program, image)};@@ -349,24 +336,24 @@ namespace Emby.Server.Implementations.LiveTv}}- public DayPattern? GetDayPattern(List<DayOfWeek> days)+ public DayPattern? GetDayPattern(DayOfWeek[] days){DayPattern? pattern = null;- if (days.Count > 0)+ if (days.Length > 0){- if (days.Count == 7)+ if (days.Length == 7){pattern = DayPattern.Daily;}- else if (days.Count == 2)+ else if (days.Length == 2){if (days.Contains(DayOfWeek.Saturday) && days.Contains(DayOfWeek.Sunday)){pattern = DayPattern.Weekends;}}- else if (days.Count == 5)+ else if (days.Length == 5){if (days.Contains(DayOfWeek.Monday) && days.Contains(DayOfWeek.Tuesday) && days.Contains(DayOfWeek.Wednesday) && days.Contains(DayOfWeek.Thursday) && days.Contains(DayOfWeek.Friday)){@@ -384,7 +371,7 @@ namespace Emby.Server.Implementations.LiveTv{Name = info.Name,Id = info.Id,- Clients = info.Clients,+ Clients = info.Clients.ToArray(),ProgramName = info.ProgramName,SourceType = info.SourceType,Status = info.Status,@@ -543,7 +530,7 @@ namespace Emby.Server.Implementations.LiveTvPostPaddingSeconds = dto.PostPaddingSeconds,IsPostPaddingRequired = dto.IsPostPaddingRequired,IsPrePaddingRequired = dto.IsPrePaddingRequired,- Days = dto.Days,+ Days = dto.Days.ToList(),Priority = dto.Priority,RecordAnyChannel = dto.RecordAnyChannel,RecordAnyTime = dto.RecordAnyTime,diff --git a/Emby.Server.Implementations/LiveTv/LiveTvManager.cs b/Emby.Server.Implementations/LiveTv/LiveTvManager.csindex 3fbbc8390e..2882af007f 100644--- a/Emby.Server.Implementations/LiveTv/LiveTvManager.cs+++ b/Emby.Server.Implementations/LiveTv/LiveTvManager.cs@@ -985,9 +985,8 @@ namespace Emby.Server.Implementations.LiveTvvar queryResult = _libraryManager.QueryItems(internalQuery);- var returnList = (await _dtoService.GetBaseItemDtos(queryResult.Items, options, user)+ var returnArray = (await _dtoService.GetBaseItemDtos(queryResult.Items, options, user).ConfigureAwait(false));- var returnArray = returnList.ToArray(returnList.Count);var result = new QueryResult<BaseItemDto>{@@ -998,7 +997,7 @@ namespace Emby.Server.Implementations.LiveTvreturn result;}- public async Task<QueryResult<LiveTvProgram>> GetRecommendedProgramsInternal(RecommendedProgramQuery query, DtoOptions options, CancellationToken cancellationToken)+ public async Task<QueryResult<BaseItem>> GetRecommendedProgramsInternal(RecommendedProgramQuery query, DtoOptions options, CancellationToken cancellationToken){var user = _userManager.GetUserById(query.UserId);@@ -1036,10 +1035,10 @@ namespace Emby.Server.Implementations.LiveTv}}- var programList = _libraryManager.QueryItems(internalQuery).Items.Cast<LiveTvProgram>().ToList();- var totalCount = programList.Count;+ var programList = _libraryManager.QueryItems(internalQuery).Items;+ var totalCount = programList.Length;- IOrderedEnumerable<LiveTvProgram> orderedPrograms = programList.OrderBy(i => i.StartDate.Date);+ IOrderedEnumerable<LiveTvProgram> orderedPrograms = programList.Cast<LiveTvProgram>().OrderBy(i => i.StartDate.Date);if (query.IsAiring ?? false){@@ -1047,14 +1046,14 @@ namespace Emby.Server.Implementations.LiveTv.ThenByDescending(i => GetRecommendationScore(i, user.Id, true));}- IEnumerable<LiveTvProgram> programs = orderedPrograms;+ IEnumerable<BaseItem> programs = orderedPrograms;if (query.Limit.HasValue){programs = programs.Take(query.Limit.Value);}- var result = new QueryResult<LiveTvProgram>+ var result = new QueryResult<BaseItem>{Items = programs.ToArray(),TotalRecordCount = totalCount@@ -1071,9 +1070,8 @@ namespace Emby.Server.Implementations.LiveTvvar user = _userManager.GetUserById(query.UserId);- var returnList = (await _dtoService.GetBaseItemDtos(internalResult.Items, options, user)+ var returnArray = (await _dtoService.GetBaseItemDtos(internalResult.Items, options, user).ConfigureAwait(false));- var returnArray = returnList.ToArray(returnList.Count);var result = new QueryResult<BaseItemDto>{@@ -1262,8 +1260,8 @@ namespace Emby.Server.Implementations.LiveTvprogress.Report(100 * percent);}- await CleanDatabaseInternal(newChannelIdList, new[] { typeof(LiveTvChannel).Name }, progress, cancellationToken).ConfigureAwait(false);- await CleanDatabaseInternal(newProgramIdList, new[] { typeof(LiveTvProgram).Name }, progress, cancellationToken).ConfigureAwait(false);+ await CleanDatabaseInternal(newChannelIdList.ToArray(), new[] { typeof(LiveTvChannel).Name }, progress, cancellationToken).ConfigureAwait(false);+ await CleanDatabaseInternal(newProgramIdList.ToArray(), new[] { typeof(LiveTvProgram).Name }, progress, cancellationToken).ConfigureAwait(false);var coreService = _services.OfType<EmbyTV.EmbyTV>().FirstOrDefault();@@ -1275,8 +1273,11 @@ namespace Emby.Server.Implementations.LiveTv// Load these now which will prefetch metadatavar dtoOptions = new DtoOptions();- dtoOptions.Fields.Remove(ItemFields.SyncInfo);- dtoOptions.Fields.Remove(ItemFields.BasicSyncInfo);+ var fields = dtoOptions.Fields.ToList();+ fields.Remove(ItemFields.SyncInfo);+ fields.Remove(ItemFields.BasicSyncInfo);+ dtoOptions.Fields = fields.ToArray(fields.Count);+await GetRecordings(new RecordingQuery(), dtoOptions, cancellationToken).ConfigureAwait(false);progress.Report(100);@@ -1446,14 +1447,14 @@ namespace Emby.Server.Implementations.LiveTvreturn new Tuple<List<Guid>, List<Guid>>(channels, programs);}- private async Task CleanDatabaseInternal(List<Guid> currentIdList, string[] validTypes, IProgress<double> progress, CancellationToken cancellationToken)+ private async Task CleanDatabaseInternal(Guid[] currentIdList, string[] validTypes, IProgress<double> progress, CancellationToken cancellationToken){var list = _itemRepo.GetItemIdsList(new InternalItemsQuery{IncludeItemTypes = validTypes,DtoOptions = new DtoOptions(false)- }).ToList();+ });var numComplete = 0;@@ -1543,7 +1544,7 @@ namespace Emby.Server.Implementations.LiveTvvar idList = await Task.WhenAll(recordingTasks).ConfigureAwait(false);- await CleanDatabaseInternal(idList.ToList(), new[] { typeof(LiveTvVideoRecording).Name, typeof(LiveTvAudioRecording).Name }, new SimpleProgress<double>(), cancellationToken).ConfigureAwait(false);+ await CleanDatabaseInternal(idList, new[] { typeof(LiveTvVideoRecording).Name, typeof(LiveTvAudioRecording).Name }, new SimpleProgress<double>(), cancellationToken).ConfigureAwait(false);_lastRecordingRefreshTime = DateTime.UtcNow;}@@ -1701,11 +1702,9 @@ namespace Emby.Server.Implementations.LiveTvDtoOptions = options});- var returnList = (await _dtoService.GetBaseItemDtos(internalResult.Items, options, user)+ var returnArray = (await _dtoService.GetBaseItemDtos(internalResult.Items, options, user).ConfigureAwait(false));- var returnArray = returnList.ToArray(returnList.Count);-return new QueryResult<BaseItemDto>{Items = returnArray,@@ -1841,7 +1840,7 @@ namespace Emby.Server.Implementations.LiveTv};}- public async Task AddInfoToProgramDto(List<Tuple<BaseItem, BaseItemDto>> tuples, List<ItemFields> fields, User user = null)+ public async Task AddInfoToProgramDto(List<Tuple<BaseItem, BaseItemDto>> tuples, ItemFields[] fields, User user = null){var programTuples = new List<Tuple<BaseItemDto, string, string, string>>();var hasChannelImage = fields.Contains(ItemFields.ChannelImage);@@ -1961,7 +1960,7 @@ namespace Emby.Server.Implementations.LiveTvif (dto.MediaStreams == null){- dto.MediaStreams = dto.MediaSources.SelectMany(i => i.MediaStreams).ToList();+ dto.MediaStreams = dto.MediaSources.SelectMany(i => i.MediaStreams).ToArray();}if (info.Status == RecordingStatus.InProgress && info.EndDate.HasValue)@@ -1995,9 +1994,8 @@ namespace Emby.Server.Implementations.LiveTvvar internalResult = await GetInternalRecordings(query, options, cancellationToken).ConfigureAwait(false);- var returnList = (await _dtoService.GetBaseItemDtos(internalResult.Items, options, user)+ var returnArray = (await _dtoService.GetBaseItemDtos(internalResult.Items, options, user).ConfigureAwait(false));- var returnArray = returnList.ToArray(returnList.Count);return new QueryResult<BaseItemDto>{@@ -2479,7 +2477,7 @@ namespace Emby.Server.Implementations.LiveTvvar defaults = await GetNewTimerDefaultsInternal(cancellationToken, program).ConfigureAwait(false);var info = _tvDtoService.GetSeriesTimerInfoDto(defaults.Item1, defaults.Item2, null);- info.Days = defaults.Item1.Days;+ info.Days = defaults.Item1.Days.ToArray();info.DayPattern = _tvDtoService.GetDayPattern(info.Days);@@ -2656,8 +2654,7 @@ namespace Emby.Server.Implementations.LiveTvvar series = recordings.Where(i => i.IsSeries)- .ToLookup(i => i.Name, StringComparer.OrdinalIgnoreCase)- .ToList();+ .ToLookup(i => i.Name, StringComparer.OrdinalIgnoreCase);groups.AddRange(series.OrderByString(i => i.Key).Select(i => new BaseItemDto{@@ -2762,7 +2759,7 @@ namespace Emby.Server.Implementations.LiveTv}}- private async Task<IEnumerable<LiveTvServiceInfo>> GetServiceInfos(CancellationToken cancellationToken)+ private async Task<LiveTvServiceInfo[]> GetServiceInfos(CancellationToken cancellationToken){var tasks = Services.Select(i => GetServiceInfo(i, cancellationToken));@@ -2806,7 +2803,7 @@ namespace Emby.Server.Implementations.LiveTvreturn dto;- }).ToList();+ }).ToArray();}catch (Exception ex){@@ -2822,25 +2819,24 @@ namespace Emby.Server.Implementations.LiveTvpublic async Task<LiveTvInfo> GetLiveTvInfo(CancellationToken cancellationToken){var services = await GetServiceInfos(CancellationToken.None).ConfigureAwait(false);- var servicesList = services.ToList();var info = new LiveTvInfo{- Services = servicesList.ToList(),- IsEnabled = servicesList.Count > 0+ Services = services,+ IsEnabled = services.Length > 0};info.EnabledUsers = _userManager.Users.Where(IsLiveTvEnabled).Select(i => i.Id.ToString("N"))- .ToList();+ .ToArray();return info;}private bool IsLiveTvEnabled(User user){- return user.Policy.EnableLiveTvAccess && (Services.Count > 1 || GetConfiguration().TunerHosts.Count > 0);+ return user.Policy.EnableLiveTvAccess && (Services.Count > 1 || GetConfiguration().TunerHosts.Length > 0);}public IEnumerable<User> GetEnabledUsers()@@ -2880,10 +2876,13 @@ namespace Emby.Server.Implementations.LiveTvprivate void RemoveFields(DtoOptions options){- options.Fields.Remove(ItemFields.CanDelete);- options.Fields.Remove(ItemFields.CanDownload);- options.Fields.Remove(ItemFields.DisplayPreferencesId);- options.Fields.Remove(ItemFields.Etag);+ var fields = options.Fields.ToList();++ fields.Remove(ItemFields.CanDelete);+ fields.Remove(ItemFields.CanDownload);+ fields.Remove(ItemFields.DisplayPreferencesId);+ fields.Remove(ItemFields.Etag);+ options.Fields = fields.ToArray(fields.Count);}public async Task<Folder> GetInternalLiveTvFolder(CancellationToken cancellationToken)@@ -2911,12 +2910,14 @@ namespace Emby.Server.Implementations.LiveTvvar config = GetConfiguration();- var index = config.TunerHosts.FindIndex(i => string.Equals(i.Id, info.Id, StringComparison.OrdinalIgnoreCase));+ var list = config.TunerHosts.ToList();+ var index = list.FindIndex(i => string.Equals(i.Id, info.Id, StringComparison.OrdinalIgnoreCase));if (index == -1 || string.IsNullOrWhiteSpace(info.Id)){info.Id = Guid.NewGuid().ToString("N");- config.TunerHosts.Add(info);+ list.Add(info);+ config.TunerHosts = list.ToArray(list.Count);}else{@@ -2948,12 +2949,14 @@ namespace Emby.Server.Implementations.LiveTvvar config = GetConfiguration();- var index = config.ListingProviders.FindIndex(i => string.Equals(i.Id, info.Id, StringComparison.OrdinalIgnoreCase));+ var list = config.ListingProviders.ToList();+ var index = list.FindIndex(i => string.Equals(i.Id, info.Id, StringComparison.OrdinalIgnoreCase));if (index == -1 || string.IsNullOrWhiteSpace(info.Id)){info.Id = Guid.NewGuid().ToString("N");- config.ListingProviders.Add(info);+ list.Add(info);+ config.ListingProviders = list.ToArray(list.Count);info.EnableNewProgramIds = true;}else@@ -2972,7 +2975,7 @@ namespace Emby.Server.Implementations.LiveTv{var config = GetConfiguration();- config.ListingProviders = config.ListingProviders.Where(i => !string.Equals(id, i.Id, StringComparison.OrdinalIgnoreCase)).ToList();+ config.ListingProviders = config.ListingProviders.Where(i => !string.Equals(id, i.Id, StringComparison.OrdinalIgnoreCase)).ToArray();_config.SaveConfiguration("livetv", config);_taskManager.CancelIfRunningAndQueue<RefreshChannelsScheduledTask>();@@ -3004,7 +3007,7 @@ namespace Emby.Server.Implementations.LiveTvvar providerChannels = await GetChannelsFromListingsProviderData(providerId, CancellationToken.None).ConfigureAwait(false);- var mappings = listingsProviderInfo.ChannelMappings.ToList();+ var mappings = listingsProviderInfo.ChannelMappings;var tunerChannelMappings =tunerChannels.Select(i => GetTunerChannelMapping(i, mappings, providerChannels)).ToList();@@ -3014,7 +3017,7 @@ namespace Emby.Server.Implementations.LiveTvreturn tunerChannelMappings.First(i => string.Equals(i.Id, tunerChannelId, StringComparison.OrdinalIgnoreCase));}- public TunerChannelMapping GetTunerChannelMapping(ChannelInfo tunerChannel, List<NameValuePair> mappings, List<ChannelInfo> epgChannels)+ public TunerChannelMapping GetTunerChannelMapping(ChannelInfo tunerChannel, NameValuePair[] mappings, List<ChannelInfo> epgChannels){var result = new TunerChannelMapping{@@ -3078,7 +3081,7 @@ namespace Emby.Server.Implementations.LiveTvif (string.Equals(feature, "dvr-l", StringComparison.OrdinalIgnoreCase)){var config = GetConfiguration();- if (config.TunerHosts.Count > 0 &&+ if (config.TunerHosts.Length > 0 &&config.ListingProviders.Count(i => (i.EnableAllTuners || i.EnabledTuners.Length > 0) && string.Equals(i.Type, SchedulesDirect.TypeName, StringComparison.OrdinalIgnoreCase)) > 0){return Task.FromResult(new MBRegistrationRecorddiff --git a/Emby.Server.Implementations/LiveTv/RefreshChannelsScheduledTask.cs b/Emby.Server.Implementations/LiveTv/RefreshChannelsScheduledTask.csindex 5582d8f35e..cad28c809c 100644--- a/Emby.Server.Implementations/LiveTv/RefreshChannelsScheduledTask.cs+++ b/Emby.Server.Implementations/LiveTv/RefreshChannelsScheduledTask.cs@@ -62,7 +62,7 @@ namespace Emby.Server.Implementations.LiveTvpublic bool IsHidden{- get { return _liveTvManager.Services.Count == 1 && GetConfiguration().TunerHosts.Count == 0; }+ get { return _liveTvManager.Services.Count == 1 && GetConfiguration().TunerHosts.Length == 0; }}public bool IsEnableddiff --git a/Emby.Server.Implementations/LiveTv/TunerHosts/MulticastStream.cs b/Emby.Server.Implementations/LiveTv/TunerHosts/MulticastStream.csindex cf50e60921..567f4ce204 100644--- a/Emby.Server.Implementations/LiveTv/TunerHosts/MulticastStream.cs+++ b/Emby.Server.Implementations/LiveTv/TunerHosts/MulticastStream.cs@@ -24,8 +24,6 @@ namespace Emby.Server.Implementations.LiveTv.TunerHostspublic async Task CopyUntilCancelled(Stream source, Action onStarted, CancellationToken cancellationToken){- byte[] buffer = new byte[BufferSize];-if (source == null){throw new ArgumentNullException("source");@@ -35,6 +33,8 @@ namespace Emby.Server.Implementations.LiveTv.TunerHosts{cancellationToken.ThrowIfCancellationRequested();+ byte[] buffer = new byte[BufferSize];+var bytesRead = source.Read(buffer, 0, buffer.Length);if (bytesRead > 0)@@ -47,12 +47,12 @@ namespace Emby.Server.Implementations.LiveTv.TunerHosts//}//else{- byte[] copy = new byte[bytesRead];- Buffer.BlockCopy(buffer, 0, copy, 0, bytesRead);+ //byte[] copy = new byte[bytesRead];+ //Buffer.BlockCopy(buffer, 0, copy, 0, bytesRead);foreach (var stream in allStreams){- stream.Value.Queue(copy, 0, copy.Length);+ stream.Value.Queue(buffer, 0, bytesRead);}}diff --git a/Emby.Server.Implementations/LiveTv/TunerHosts/QueueStream.cs b/Emby.Server.Implementations/LiveTv/TunerHosts/QueueStream.csindex 61bc390b40..f1ec8d5af3 100644--- a/Emby.Server.Implementations/LiveTv/TunerHosts/QueueStream.cs+++ b/Emby.Server.Implementations/LiveTv/TunerHosts/QueueStream.cs@@ -13,7 +13,7 @@ namespace Emby.Server.Implementations.LiveTv.TunerHostspublic class QueueStream{private readonly Stream _outputStream;- private readonly ConcurrentQueue<Tuple<byte[], int, int>> _queue = new ConcurrentQueue<Tuple<byte[], int, int>>();+ private readonly BlockingCollection<Tuple<byte[], int, int>> _queue = new BlockingCollection<Tuple<byte[], int, int>>();public TaskCompletionSource<bool> TaskCompletion { get; private set; }public Action<QueueStream> OnFinished { get; set; }@@ -29,7 +29,7 @@ namespace Emby.Server.Implementations.LiveTv.TunerHostspublic void Queue(byte[] bytes, int offset, int count){- _queue.Enqueue(new Tuple<byte[], int, int>(bytes, offset, count));+ _queue.Add(new Tuple<byte[], int, int>(bytes, offset, count));}public void Start(CancellationToken cancellationToken)@@ -37,17 +37,6 @@ namespace Emby.Server.Implementations.LiveTv.TunerHostsTask.Run(() => StartInternal(cancellationToken));}- private Tuple<byte[], int, int> Dequeue()- {- Tuple<byte[], int, int> result;- if (_queue.TryDequeue(out result))- {- return result;- }-- return null;- }-private void OnClosed(){GC.Collect();@@ -79,7 +68,7 @@ namespace Emby.Server.Implementations.LiveTv.TunerHosts}}- private async Task StartInternal(CancellationToken cancellationToken)+ private void StartInternal(CancellationToken cancellationToken){try{@@ -87,15 +76,10 @@ namespace Emby.Server.Implementations.LiveTv.TunerHosts{cancellationToken.ThrowIfCancellationRequested();- var result = Dequeue();- if (result != null)+ foreach (var result in _queue.GetConsumingEnumerable()){_outputStream.Write(result.Item1, result.Item2, result.Item3);}- else- {- await Task.Delay(50, cancellationToken).ConfigureAwait(false);- }}}catch (OperationCanceledException)diff --git a/Emby.Server.Implementations/Localization/LocalizationManager.cs b/Emby.Server.Implementations/Localization/LocalizationManager.csindex 8d3051a898..a8cd1dc04d 100644--- a/Emby.Server.Implementations/Localization/LocalizationManager.cs+++ b/Emby.Server.Implementations/Localization/LocalizationManager.cs@@ -132,7 +132,7 @@ namespace Emby.Server.Implementations.Localization/// Gets the cultures./// </summary>/// <returns>IEnumerable{CultureDto}.</returns>- public List<CultureDto> GetCultures()+ public CultureDto[] GetCultures(){var type = GetType();var path = type.Namespace + ".iso6392.txt";@@ -169,21 +169,21 @@ namespace Emby.Server.Implementations.Localizationreturn list.Where(i => !string.IsNullOrWhiteSpace(i.Name) &&!string.IsNullOrWhiteSpace(i.DisplayName) &&!string.IsNullOrWhiteSpace(i.ThreeLetterISOLanguageName) &&- !string.IsNullOrWhiteSpace(i.TwoLetterISOLanguageName)).ToList();+ !string.IsNullOrWhiteSpace(i.TwoLetterISOLanguageName)).ToArray();}/// <summary>/// Gets the countries./// </summary>/// <returns>IEnumerable{CountryInfo}.</returns>- public List<CountryInfo> GetCountries()+ public CountryInfo[] GetCountries(){var type = GetType();var path = type.Namespace + ".countries.json";using (var stream = _assemblyInfo.GetManifestResourceStream(type, path)){- return _jsonSerializer.DeserializeFromStream<List<CountryInfo>>(stream);+ return _jsonSerializer.DeserializeFromStream<CountryInfo[]>(stream);}}@@ -191,9 +191,9 @@ namespace Emby.Server.Implementations.Localization/// Gets the parental ratings./// </summary>/// <returns>IEnumerable{ParentalRating}.</returns>- public IEnumerable<ParentalRating> GetParentalRatings()+ public ParentalRating[] GetParentalRatings(){- return GetParentalRatingsDictionary().Values.ToList();+ return GetParentalRatingsDictionary().Values.ToArray();}/// <summary>@@ -382,9 +382,9 @@ namespace Emby.Server.Implementations.Localizationreturn culture + ".json";}- public IEnumerable<LocalizatonOption> GetLocalizationOptions()+ public LocalizatonOption[] GetLocalizationOptions(){- return new List<LocalizatonOption>+ return new LocalizatonOption[]{new LocalizatonOption{ Name="Arabic", Value="ar"},new LocalizatonOption{ Name="Bulgarian (Bulgaria)", Value="bg-BG"},@@ -421,7 +421,7 @@ namespace Emby.Server.Implementations.Localizationnew LocalizatonOption{ Name="Ukrainian", Value="uk"},new LocalizatonOption{ Name="Vietnamese", Value="vi"}- }.OrderBy(i => i.Name);+ };}}diff --git a/Emby.Server.Implementations/MediaEncoder/EncodingManager.cs b/Emby.Server.Implementations/MediaEncoder/EncodingManager.csindex 7ee6e9e38b..770b881d5c 100644--- a/Emby.Server.Implementations/MediaEncoder/EncodingManager.cs+++ b/Emby.Server.Implementations/MediaEncoder/EncodingManager.cs@@ -129,7 +129,7 @@ namespace Emby.Server.Implementations.MediaEncodervar protocol = MediaProtocol.File;- var inputPath = MediaEncoderHelpers.GetInputArgument(_fileSystem, video.Path, protocol, null, new List<string>());+ var inputPath = MediaEncoderHelpers.GetInputArgument(_fileSystem, video.Path, protocol, null, new string[] { });_fileSystem.CreateDirectory(_fileSystem.GetDirectoryName(path));diff --git a/Emby.Server.Implementations/Notifications/CoreNotificationTypes.cs b/Emby.Server.Implementations/Notifications/CoreNotificationTypes.csindex f9fb98f85e..849e02d812 100644--- a/Emby.Server.Implementations/Notifications/CoreNotificationTypes.cs+++ b/Emby.Server.Implementations/Notifications/CoreNotificationTypes.cs@@ -28,21 +28,21 @@ namespace Emby.Server.Implementations.NotificationsType = NotificationType.ApplicationUpdateInstalled.ToString(),DefaultDescription = "{ReleaseNotes}",DefaultTitle = "A new version of Emby Server has been installed.",- Variables = new List<string>{"Version"}+ Variables = new string[]{"Version"}},new NotificationTypeInfo{Type = NotificationType.InstallationFailed.ToString(),DefaultTitle = "{Name} installation failed.",- Variables = new List<string>{"Name", "Version"}+ Variables = new string[]{"Name", "Version"}},new NotificationTypeInfo{Type = NotificationType.PluginInstalled.ToString(),DefaultTitle = "{Name} was installed.",- Variables = new List<string>{"Name", "Version"}+ Variables = new string[]{"Name", "Version"}},new NotificationTypeInfo@@ -50,14 +50,14 @@ namespace Emby.Server.Implementations.NotificationsType = NotificationType.PluginError.ToString(),DefaultTitle = "{Name} has encountered an error.",DefaultDescription = "{ErrorMessage}",- Variables = new List<string>{"Name", "ErrorMessage"}+ Variables = new string[]{"Name", "ErrorMessage"}},new NotificationTypeInfo{Type = NotificationType.PluginUninstalled.ToString(),DefaultTitle = "{Name} was uninstalled.",- Variables = new List<string>{"Name", "Version"}+ Variables = new string[]{"Name", "Version"}},new NotificationTypeInfo@@ -65,7 +65,7 @@ namespace Emby.Server.Implementations.NotificationsType = NotificationType.PluginUpdateInstalled.ToString(),DefaultTitle = "{Name} was updated.",DefaultDescription = "{ReleaseNotes}",- Variables = new List<string>{"Name", "ReleaseNotes", "Version"}+ Variables = new string[]{"Name", "ReleaseNotes", "Version"}},new NotificationTypeInfo@@ -79,70 +79,70 @@ namespace Emby.Server.Implementations.NotificationsType = NotificationType.TaskFailed.ToString(),DefaultTitle = "{Name} failed.",DefaultDescription = "{ErrorMessage}",- Variables = new List<string>{"Name", "ErrorMessage"}+ Variables = new string[]{"Name", "ErrorMessage"}},new NotificationTypeInfo{Type = NotificationType.NewLibraryContent.ToString(),DefaultTitle = "{Name} has been added to your media library.",- Variables = new List<string>{"Name"}+ Variables = new string[]{"Name"}},new NotificationTypeInfo{Type = NotificationType.AudioPlayback.ToString(),DefaultTitle = "{UserName} is playing {ItemName} on {DeviceName}.",- Variables = new List<string>{"UserName", "ItemName", "DeviceName", "AppName"}+ Variables = new string[]{"UserName", "ItemName", "DeviceName", "AppName"}},new NotificationTypeInfo{Type = NotificationType.GamePlayback.ToString(),DefaultTitle = "{UserName} is playing {ItemName} on {DeviceName}.",- Variables = new List<string>{"UserName", "ItemName", "DeviceName", "AppName"}+ Variables = new string[]{"UserName", "ItemName", "DeviceName", "AppName"}},new NotificationTypeInfo{Type = NotificationType.VideoPlayback.ToString(),DefaultTitle = "{UserName} is playing {ItemName} on {DeviceName}.",- Variables = new List<string>{"UserName", "ItemName", "DeviceName", "AppName"}+ Variables = new string[]{"UserName", "ItemName", "DeviceName", "AppName"}},new NotificationTypeInfo{Type = NotificationType.AudioPlaybackStopped.ToString(),DefaultTitle = "{UserName} has finished playing {ItemName} on {DeviceName}.",- Variables = new List<string>{"UserName", "ItemName", "DeviceName", "AppName"}+ Variables = new string[]{"UserName", "ItemName", "DeviceName", "AppName"}},new NotificationTypeInfo{Type = NotificationType.GamePlaybackStopped.ToString(),DefaultTitle = "{UserName} has finished playing {ItemName} on {DeviceName}.",- Variables = new List<string>{"UserName", "ItemName", "DeviceName", "AppName"}+ Variables = new string[]{"UserName", "ItemName", "DeviceName", "AppName"}},new NotificationTypeInfo{Type = NotificationType.VideoPlaybackStopped.ToString(),DefaultTitle = "{UserName} has finished playing {ItemName} on {DeviceName}.",- Variables = new List<string>{"UserName", "ItemName", "DeviceName", "AppName"}+ Variables = new string[]{"UserName", "ItemName", "DeviceName", "AppName"}},new NotificationTypeInfo{Type = NotificationType.CameraImageUploaded.ToString(),DefaultTitle = "A new camera image has been uploaded from {DeviceName}.",- Variables = new List<string>{"DeviceName"}+ Variables = new string[]{"DeviceName"}},new NotificationTypeInfo{Type = NotificationType.UserLockedOut.ToString(),DefaultTitle = "{UserName} has been locked out.",- Variables = new List<string>{"UserName"}+ Variables = new string[]{"UserName"}}};diff --git a/Emby.Server.Implementations/Notifications/NotificationManager.cs b/Emby.Server.Implementations/Notifications/NotificationManager.csindex db79804978..f49d5a1d10 100644--- a/Emby.Server.Implementations/Notifications/NotificationManager.cs+++ b/Emby.Server.Implementations/Notifications/NotificationManager.cs@@ -251,7 +251,7 @@ namespace Emby.Server.Implementations.Notifications_typeFactories = notificationTypeFactories.ToArray();}- public IEnumerable<NotificationTypeInfo> GetNotificationTypes()+ public List<NotificationTypeInfo> GetNotificationTypes(){var list = _typeFactories.Select(i =>{diff --git a/Emby.Server.Implementations/Playlists/PlaylistManager.cs b/Emby.Server.Implementations/Playlists/PlaylistManager.csindex 578a2321cc..9b9596934a 100644--- a/Emby.Server.Implementations/Playlists/PlaylistManager.cs+++ b/Emby.Server.Implementations/Playlists/PlaylistManager.cs@@ -133,7 +133,7 @@ namespace Emby.Server.Implementations.Playlistsawait playlist.RefreshMetadata(new MetadataRefreshOptions(_fileSystem) { ForceSave = true }, CancellationToken.None).ConfigureAwait(false);- if (options.ItemIdList.Count > 0)+ if (options.ItemIdList.Length > 0){await AddToPlaylistInternal(playlist.Id.ToString("N"), options.ItemIdList, user, new DtoOptions(false){diff --git a/Emby.Server.Implementations/Services/ServiceController.cs b/Emby.Server.Implementations/Services/ServiceController.csindex 4ad56411ad..c3970b22f6 100644--- a/Emby.Server.Implementations/Services/ServiceController.cs+++ b/Emby.Server.Implementations/Services/ServiceController.cs@@ -29,13 +29,6 @@ namespace Emby.Server.Implementations.Services}}- private Type[] GetGenericArguments(Type type)- {- return type.GetTypeInfo().IsGenericTypeDefinition- ? type.GetTypeInfo().GenericTypeParameters- : type.GetTypeInfo().GenericTypeArguments;- }-public void RegisterService(HttpListenerHost appHost, Type serviceType){var processedReqs = new HashSet<Type>();@@ -50,38 +43,19 @@ namespace Emby.Server.Implementations.ServicesServiceExecGeneral.CreateServiceRunnersFor(requestType, actions);- var returnMarker = GetTypeWithGenericTypeDefinitionOf(requestType, typeof(IReturn<>));- var responseType = returnMarker != null ?- GetGenericArguments(returnMarker)[0]- : mi.ReturnType != typeof(object) && mi.ReturnType != typeof(void) ?- mi.ReturnType- : Type.GetType(requestType.FullName + "Response");+ //var returnMarker = GetTypeWithGenericTypeDefinitionOf(requestType, typeof(IReturn<>));+ //var responseType = returnMarker != null ?+ // GetGenericArguments(returnMarker)[0]+ // : mi.ReturnType != typeof(object) && mi.ReturnType != typeof(void) ?+ // mi.ReturnType+ // : Type.GetType(requestType.FullName + "Response");RegisterRestPaths(appHost, requestType);- appHost.AddServiceInfo(serviceType, requestType, responseType);+ appHost.AddServiceInfo(serviceType, requestType);}}- private static Type GetTypeWithGenericTypeDefinitionOf(Type type, Type genericTypeDefinition)- {- foreach (var t in type.GetTypeInfo().ImplementedInterfaces)- {- if (t.GetTypeInfo().IsGenericType && t.GetGenericTypeDefinition() == genericTypeDefinition)- {- return t;- }- }-- var genericType = FirstGenericType(type);- if (genericType != null && genericType.GetGenericTypeDefinition() == genericTypeDefinition)- {- return genericType;- }-- return null;- }-public static Type FirstGenericType(Type type){while (type != null)diff --git a/Emby.Server.Implementations/Session/SessionManager.cs b/Emby.Server.Implementations/Session/SessionManager.csindex dc7e839929..ee373139f4 100644--- a/Emby.Server.Implementations/Session/SessionManager.cs+++ b/Emby.Server.Implementations/Session/SessionManager.cs@@ -468,7 +468,7 @@ namespace Emby.Server.Implementations.Sessionif (!userId.HasValue){- sessionInfo.AdditionalUsers.Clear();+ sessionInfo.AdditionalUsers = new SessionUserInfo[] { };}if (sessionInfo.SessionController == null)@@ -1074,7 +1074,7 @@ namespace Emby.Server.Implementations.SessionDtoOptions = new DtoOptions(false){EnableImages = false,- Fields = new List<ItemFields>+ Fields = new ItemFields[]{ItemFields.SortName}@@ -1097,7 +1097,7 @@ namespace Emby.Server.Implementations.SessionDtoOptions = new DtoOptions(false){EnableImages = false,- Fields = new List<ItemFields>+ Fields = new ItemFields[]{ItemFields.SortName}@@ -1340,11 +1340,15 @@ namespace Emby.Server.Implementations.Session{var user = _userManager.GetUserById(userId);- session.AdditionalUsers.Add(new SessionUserInfo+ var list = session.AdditionalUsers.ToList();++ list.Add(new SessionUserInfo{UserId = userId,UserName = user.Name});++ session.AdditionalUsers = list.ToArray(list.Count);}}@@ -1368,7 +1372,10 @@ namespace Emby.Server.Implementations.Sessionif (user != null){- session.AdditionalUsers.Remove(user);+ var list = session.AdditionalUsers.ToList();+ list.Remove(user);++ session.AdditionalUsers = list.ToArray(list.Count);}}@@ -1661,35 +1668,39 @@ namespace Emby.Server.Implementations.SessionAddProgramRecordingInfo = false};- dtoOptions.Fields.Remove(ItemFields.BasicSyncInfo);- dtoOptions.Fields.Remove(ItemFields.SyncInfo);- dtoOptions.Fields.Remove(ItemFields.CanDelete);- dtoOptions.Fields.Remove(ItemFields.CanDownload);- dtoOptions.Fields.Remove(ItemFields.ChildCount);- dtoOptions.Fields.Remove(ItemFields.CustomRating);- dtoOptions.Fields.Remove(ItemFields.DateLastMediaAdded);- dtoOptions.Fields.Remove(ItemFields.DateLastRefreshed);- dtoOptions.Fields.Remove(ItemFields.DateLastSaved);- dtoOptions.Fields.Remove(ItemFields.DisplayPreferencesId);- dtoOptions.Fields.Remove(ItemFields.Etag);- dtoOptions.Fields.Remove(ItemFields.ExternalEtag);- dtoOptions.Fields.Remove(ItemFields.InheritedParentalRatingValue);- dtoOptions.Fields.Remove(ItemFields.ItemCounts);- dtoOptions.Fields.Remove(ItemFields.MediaSourceCount);- dtoOptions.Fields.Remove(ItemFields.MediaStreams);- dtoOptions.Fields.Remove(ItemFields.MediaSources);- dtoOptions.Fields.Remove(ItemFields.People);- dtoOptions.Fields.Remove(ItemFields.PlayAccess);- dtoOptions.Fields.Remove(ItemFields.People);- dtoOptions.Fields.Remove(ItemFields.ProductionLocations);- dtoOptions.Fields.Remove(ItemFields.RecursiveItemCount);- dtoOptions.Fields.Remove(ItemFields.RemoteTrailers);- dtoOptions.Fields.Remove(ItemFields.SeasonUserData);- dtoOptions.Fields.Remove(ItemFields.Settings);- dtoOptions.Fields.Remove(ItemFields.SortName);- dtoOptions.Fields.Remove(ItemFields.Tags);- dtoOptions.Fields.Remove(ItemFields.ThemeSongIds);- dtoOptions.Fields.Remove(ItemFields.ThemeVideoIds);+ var fields = dtoOptions.Fields.ToList();++ fields.Remove(ItemFields.BasicSyncInfo);+ fields.Remove(ItemFields.SyncInfo);+ fields.Remove(ItemFields.CanDelete);+ fields.Remove(ItemFields.CanDownload);+ fields.Remove(ItemFields.ChildCount);+ fields.Remove(ItemFields.CustomRating);+ fields.Remove(ItemFields.DateLastMediaAdded);+ fields.Remove(ItemFields.DateLastRefreshed);+ fields.Remove(ItemFields.DateLastSaved);+ fields.Remove(ItemFields.DisplayPreferencesId);+ fields.Remove(ItemFields.Etag);+ fields.Remove(ItemFields.ExternalEtag);+ fields.Remove(ItemFields.InheritedParentalRatingValue);+ fields.Remove(ItemFields.ItemCounts);+ fields.Remove(ItemFields.MediaSourceCount);+ fields.Remove(ItemFields.MediaStreams);+ fields.Remove(ItemFields.MediaSources);+ fields.Remove(ItemFields.People);+ fields.Remove(ItemFields.PlayAccess);+ fields.Remove(ItemFields.People);+ fields.Remove(ItemFields.ProductionLocations);+ fields.Remove(ItemFields.RecursiveItemCount);+ fields.Remove(ItemFields.RemoteTrailers);+ fields.Remove(ItemFields.SeasonUserData);+ fields.Remove(ItemFields.Settings);+ fields.Remove(ItemFields.SortName);+ fields.Remove(ItemFields.Tags);+ fields.Remove(ItemFields.ThemeSongIds);+ fields.Remove(ItemFields.ThemeVideoIds);++ dtoOptions.Fields = fields.ToArray(fields.Count);_itemInfoDtoOptions = dtoOptions;}@@ -1698,7 +1709,7 @@ namespace Emby.Server.Implementations.Sessionif (mediaSource != null){- info.MediaStreams = mediaSource.MediaStreams;+ info.MediaStreams = mediaSource.MediaStreams.ToArray();}return info;diff --git a/Emby.Server.Implementations/TV/TVSeriesManager.cs b/Emby.Server.Implementations/TV/TVSeriesManager.csindex 03283031eb..018e452bee 100644--- a/Emby.Server.Implementations/TV/TVSeriesManager.cs+++ b/Emby.Server.Implementations/TV/TVSeriesManager.cs@@ -72,7 +72,7 @@ namespace Emby.Server.Implementations.TVRecursive = true,DtoOptions = new MediaBrowser.Controller.Dto.DtoOptions{- Fields = new List<ItemFields>+ Fields = new ItemFields[]{ItemFields.SeriesPresentationUniqueKey}@@ -128,7 +128,7 @@ namespace Emby.Server.Implementations.TVLimit = limit,DtoOptions = new MediaBrowser.Controller.Dto.DtoOptions{- Fields = new List<ItemFields>+ Fields = new ItemFields[]{ItemFields.SeriesPresentationUniqueKey},@@ -207,7 +207,7 @@ namespace Emby.Server.Implementations.TVParentIndexNumberNotEquals = 0,DtoOptions = new MediaBrowser.Controller.Dto.DtoOptions{- Fields = new List<ItemFields>+ Fields = new ItemFields[]{ItemFields.SortName},diff --git a/Emby.Server.Implementations/Updates/InstallationManager.cs b/Emby.Server.Implementations/Updates/InstallationManager.csindex 6e37c1dc12..6f9c856711 100644--- a/Emby.Server.Implementations/Updates/InstallationManager.cs+++ b/Emby.Server.Implementations/Updates/InstallationManager.cs@@ -157,7 +157,7 @@ namespace Emby.Server.Implementations.Updates/// Gets all available packages./// </summary>/// <returns>Task{List{PackageInfo}}.</returns>- public async Task<IEnumerable<PackageInfo>> GetAvailablePackages(CancellationToken cancellationToken,+ public async Task<PackageInfo[]> GetAvailablePackages(CancellationToken cancellationToken,bool withRegistration = true,string packageType = null,Version applicationVersion = null)@@ -175,7 +175,7 @@ namespace Emby.Server.Implementations.Updates{cancellationToken.ThrowIfCancellationRequested();- var packages = _jsonSerializer.DeserializeFromStream<List<PackageInfo>>(json).ToList();+ var packages = _jsonSerializer.DeserializeFromStream<PackageInfo[]>(json);return FilterPackages(packages, packageType, applicationVersion);}@@ -184,7 +184,7 @@ namespace Emby.Server.Implementations.Updates{var packages = await GetAvailablePackagesWithoutRegistrationInfo(cancellationToken).ConfigureAwait(false);- return FilterPackages(packages.ToList(), packageType, applicationVersion);+ return FilterPackages(packages, packageType, applicationVersion);}}@@ -195,14 +195,14 @@ namespace Emby.Server.Implementations.Updates/// </summary>/// <param name="cancellationToken">The cancellation token.</param>/// <returns>Task{List{PackageInfo}}.</returns>- public async Task<IEnumerable<PackageInfo>> GetAvailablePackagesWithoutRegistrationInfo(CancellationToken cancellationToken)+ public async Task<PackageInfo[]> GetAvailablePackagesWithoutRegistrationInfo(CancellationToken cancellationToken){_logger.Info("Opening {0}", PackageCachePath);try{using (var stream = _fileSystem.OpenRead(PackageCachePath)){- var packages = _jsonSerializer.DeserializeFromStream<List<PackageInfo>>(stream).ToList();+ var packages = _jsonSerializer.DeserializeFromStream<PackageInfo[]>(stream);if (DateTime.UtcNow - _lastPackageUpdateTime > GetCacheLength()){@@ -221,7 +221,7 @@ namespace Emby.Server.Implementations.Updatesawait UpdateCachedPackages(cancellationToken, true).ConfigureAwait(false);using (var stream = _fileSystem.OpenRead(PackageCachePath)){- return _jsonSerializer.DeserializeFromStream<List<PackageInfo>>(stream).ToList();+ return _jsonSerializer.DeserializeFromStream<PackageInfo[]>(stream);}}@@ -288,31 +288,29 @@ namespace Emby.Server.Implementations.Updates}}- protected IEnumerable<PackageInfo> FilterPackages(List<PackageInfo> packages)+ protected PackageInfo[] FilterPackages(List<PackageInfo> packages){foreach (var package in packages){package.versions = package.versions.Where(v => !string.IsNullOrWhiteSpace(v.sourceUrl))- .OrderByDescending(GetPackageVersion).ToList();+ .OrderByDescending(GetPackageVersion).ToArray();}// Remove packages with no versions- packages = packages.Where(p => p.versions.Any()).ToList();-- return packages;+ return packages.Where(p => p.versions.Any()).ToArray();}- protected IEnumerable<PackageInfo> FilterPackages(List<PackageInfo> packages, string packageType, Version applicationVersion)+ protected PackageInfo[] FilterPackages(PackageInfo[] packages, string packageType, Version applicationVersion){foreach (var package in packages){package.versions = package.versions.Where(v => !string.IsNullOrWhiteSpace(v.sourceUrl))- .OrderByDescending(GetPackageVersion).ToList();+ .OrderByDescending(GetPackageVersion).ToArray();}if (!string.IsNullOrWhiteSpace(packageType)){- packages = packages.Where(p => string.Equals(p.type, packageType, StringComparison.OrdinalIgnoreCase)).ToList();+ packages = packages.Where(p => string.Equals(p.type, packageType, StringComparison.OrdinalIgnoreCase)).ToArray();}// If an app version was supplied, filter the versions for each package to only include supported versions@@ -320,14 +318,12 @@ namespace Emby.Server.Implementations.Updates{foreach (var package in packages){- package.versions = package.versions.Where(v => IsPackageVersionUpToDate(v, applicationVersion)).ToList();+ package.versions = package.versions.Where(v => IsPackageVersionUpToDate(v, applicationVersion)).ToArray();}}// Remove packages with no versions- packages = packages.Where(p => p.versions.Any()).ToList();-- return packages;+ return packages.Where(p => p.versions.Any()).ToArray();}/// <summary>@@ -418,30 +414,24 @@ namespace Emby.Server.Implementations.Updates/// <returns>Task{IEnumerable{PackageVersionInfo}}.</returns>public async Task<IEnumerable<PackageVersionInfo>> GetAvailablePluginUpdates(Version applicationVersion, bool withAutoUpdateEnabled, CancellationToken cancellationToken){- var catalog = await GetAvailablePackagesWithoutRegistrationInfo(cancellationToken).ConfigureAwait(false);-- var plugins = _applicationHost.Plugins.ToList();-- if (withAutoUpdateEnabled)+ if (!_config.CommonConfiguration.EnableAutoUpdate){- plugins = plugins- .Where(p => _config.CommonConfiguration.EnableAutoUpdate)- .ToList();+ return new PackageVersionInfo[] { };}+ var catalog = await GetAvailablePackagesWithoutRegistrationInfo(cancellationToken).ConfigureAwait(false);+var systemUpdateLevel = GetSystemUpdateLevel();// Figure out what needs to be installed- var packages = plugins.Select(p =>+ return _applicationHost.Plugins.Select(p =>{var latestPluginInfo = GetLatestCompatibleVersion(catalog, p.Name, p.Id.ToString(), applicationVersion, systemUpdateLevel);return latestPluginInfo != null && GetPackageVersion(latestPluginInfo) > p.Version ? latestPluginInfo : null;- }).Where(i => i != null).ToList();-- return packages- .Where(p => !string.IsNullOrWhiteSpace(p.sourceUrl) && !CompletedInstallations.Any(i => string.Equals(i.AssemblyGuid, p.guid, StringComparison.OrdinalIgnoreCase)));+ }).Where(i => i != null)+ .Where(p => !string.IsNullOrWhiteSpace(p.sourceUrl) && !CompletedInstallations.Any(i => string.Equals(i.AssemblyGuid, p.guid, StringComparison.OrdinalIgnoreCase)));}/// <summary>diff --git a/MediaBrowser.Api/BaseApiService.cs b/MediaBrowser.Api/BaseApiService.csindex d3cc18d4be..1629d49b49 100644--- a/MediaBrowser.Api/BaseApiService.cs+++ b/MediaBrowser.Api/BaseApiService.cs@@ -11,6 +11,7 @@ using System.Collections.Generic;using System.Linq;using System.Threading.Tasks;using MediaBrowser.Model.Services;+using MediaBrowser.Model.Extensions;namespace MediaBrowser.Api{@@ -54,6 +55,17 @@ namespace MediaBrowser.Apireturn Request.Headers[name];}+ private static readonly string[] EmptyStringArray = new string[] { };+ public static string[] SplitValue(string value, char delim)+ {+ if (string.IsNullOrWhiteSpace(value))+ {+ return EmptyStringArray;+ }++ return value.Split(new[] { delim }, StringSplitOptions.RemoveEmptyEntries);+ }+/// <summary>/// To the optimized result./// </summary>@@ -128,7 +140,7 @@ namespace MediaBrowser.Apivar hasFields = request as IHasItemFields;if (hasFields != null){- options.Fields = hasFields.GetItemFields().ToList();+ options.Fields = hasFields.GetItemFields();}var client = authInfo.Client ?? string.Empty;@@ -137,7 +149,9 @@ namespace MediaBrowser.Apiclient.IndexOf("media center", StringComparison.OrdinalIgnoreCase) != -1 ||client.IndexOf("classic", StringComparison.OrdinalIgnoreCase) != -1){- options.Fields.Add(Model.Querying.ItemFields.RecursiveItemCount);+ var list = options.Fields.ToList();+ list.Add(Model.Querying.ItemFields.RecursiveItemCount);+ options.Fields = list.ToArray(list.Count);}if (client.IndexOf("kodi", StringComparison.OrdinalIgnoreCase) != -1 ||@@ -148,7 +162,9 @@ namespace MediaBrowser.Apiclient.IndexOf("samsung", StringComparison.OrdinalIgnoreCase) != -1 ||client.IndexOf("androidtv", StringComparison.OrdinalIgnoreCase) != -1){- options.Fields.Add(Model.Querying.ItemFields.ChildCount);+ var list = options.Fields.ToList();+ list.Add(Model.Querying.ItemFields.ChildCount);+ options.Fields = list.ToArray(list.Count);}var hasDtoOptions = request as IHasDtoOptions;@@ -167,7 +183,7 @@ namespace MediaBrowser.Apiif (!string.IsNullOrWhiteSpace(hasDtoOptions.EnableImageTypes)){- options.ImageTypes = (hasDtoOptions.EnableImageTypes ?? string.Empty).Split(',').Where(i => !string.IsNullOrWhiteSpace(i)).Select(v => (ImageType)Enum.Parse(typeof(ImageType), v, true)).ToList();+ options.ImageTypes = (hasDtoOptions.EnableImageTypes ?? string.Empty).Split(',').Where(i => !string.IsNullOrWhiteSpace(i)).Select(v => (ImageType)Enum.Parse(typeof(ImageType), v, true)).ToArray();}}diff --git a/MediaBrowser.Api/ChannelService.cs b/MediaBrowser.Api/ChannelService.csindex bce1e66829..c7ceb41bcb 100644--- a/MediaBrowser.Api/ChannelService.cs+++ b/MediaBrowser.Api/ChannelService.cs@@ -55,7 +55,7 @@ namespace MediaBrowser.Api}[Route("/Channels/Features", "GET", Summary = "Gets features for a channel")]- public class GetAllChannelFeatures : IReturn<List<ChannelFeatures>>+ public class GetAllChannelFeatures : IReturn<ChannelFeatures[]>{}@@ -187,7 +187,7 @@ namespace MediaBrowser.Apipublic object Get(GetAllChannelFeatures request){- var result = _channelManager.GetAllChannelFeatures().ToList();+ var result = _channelManager.GetAllChannelFeatures();return ToOptimizedResult(result);}@@ -247,7 +247,7 @@ namespace MediaBrowser.ApiChannelIds = (request.ChannelIds ?? string.Empty).Split(',').Where(i => !string.IsNullOrWhiteSpace(i)).ToArray(),UserId = request.UserId,Filters = request.GetFilters().ToArray(),- Fields = request.GetItemFields().ToList()+ Fields = request.GetItemFields()}, CancellationToken.None).ConfigureAwait(false);diff --git a/MediaBrowser.Api/ConfigurationService.cs b/MediaBrowser.Api/ConfigurationService.csindex 8d5f46962c..92128634e3 100644--- a/MediaBrowser.Api/ConfigurationService.cs+++ b/MediaBrowser.Api/ConfigurationService.cs@@ -62,7 +62,7 @@ namespace MediaBrowser.Api[Route("/System/Configuration/MetadataPlugins", "GET", Summary = "Gets all available metadata plugins")][Authenticated(Roles = "Admin")]- public class GetMetadataPlugins : IReturn<List<MetadataPluginSummary>>+ public class GetMetadataPlugins : IReturn<MetadataPluginSummary[]>{}@@ -170,7 +170,7 @@ namespace MediaBrowser.Apipublic object Get(GetMetadataPlugins request){- return ToOptimizedSerializedResultUsingCache(_providerManager.GetAllMetadataPlugins().ToList());+ return ToOptimizedSerializedResultUsingCache(_providerManager.GetAllMetadataPlugins());}}}diff --git a/MediaBrowser.Api/Dlna/DlnaService.cs b/MediaBrowser.Api/Dlna/DlnaService.csindex ecb54bf5cb..fa3287ebdd 100644--- a/MediaBrowser.Api/Dlna/DlnaService.cs+++ b/MediaBrowser.Api/Dlna/DlnaService.cs@@ -1,14 +1,13 @@using MediaBrowser.Controller.Dlna;using MediaBrowser.Controller.Net;using MediaBrowser.Model.Dlna;-using System.Collections.Generic;using System.Linq;using MediaBrowser.Model.Services;namespace MediaBrowser.Api.Dlna{[Route("/Dlna/ProfileInfos", "GET", Summary = "Gets a list of profiles")]- public class GetProfileInfos : IReturn<List<DeviceProfileInfo>>+ public class GetProfileInfos : IReturn<DeviceProfileInfo[]>{}@@ -53,7 +52,7 @@ namespace MediaBrowser.Api.Dlnapublic object Get(GetProfileInfos request){- var result = _dlnaManager.GetProfileInfos().ToList();+ var result = _dlnaManager.GetProfileInfos().ToArray();return ToOptimizedResult(result);}diff --git a/MediaBrowser.Api/EnvironmentService.cs b/MediaBrowser.Api/EnvironmentService.csindex 9764a71dbc..bc6101d6cd 100644--- a/MediaBrowser.Api/EnvironmentService.cs+++ b/MediaBrowser.Api/EnvironmentService.cs@@ -226,7 +226,7 @@ namespace MediaBrowser.Apireturn ToOptimizedSerializedResultUsingCache(GetNetworkShares(path).OrderBy(i => i.Path).ToList());}- return ToOptimizedSerializedResultUsingCache(GetFileSystemEntries(request).OrderBy(i => i.Path).ToList());+ return ToOptimizedSerializedResultUsingCache(GetFileSystemEntries(request).ToList());}public object Get(GetNetworkShares request)@@ -271,9 +271,7 @@ namespace MediaBrowser.Api/// <returns>System.Object.</returns>public object Get(GetNetworkDevices request){- var result = _networkManager.GetNetworkDevices()- .OrderBy(i => i.Path)- .ToList();+ var result = _networkManager.GetNetworkDevices().ToList();return ToOptimizedSerializedResultUsingCache(result);}@@ -300,7 +298,6 @@ namespace MediaBrowser.Api/// <returns>IEnumerable{FileSystemEntryInfo}.</returns>private IEnumerable<FileSystemEntryInfo> GetFileSystemEntries(GetDirectoryContents request){- // using EnumerateFileSystemInfos doesn't handle reparse points (symlinks)var entries = _fileSystem.GetFileSystemEntries(request.Path).Where(i =>{if (!request.IncludeHidden && i.IsHidden)@@ -329,7 +326,7 @@ namespace MediaBrowser.ApiPath = f.FullName,Type = f.IsDirectory ? FileSystemEntryType.Directory : FileSystemEntryType.File- }).ToList();+ });}public object Get(GetParentPath request)diff --git a/MediaBrowser.Api/FilterService.cs b/MediaBrowser.Api/FilterService.csindex 41b17e535d..52b274653b 100644--- a/MediaBrowser.Api/FilterService.cs+++ b/MediaBrowser.Api/FilterService.cs@@ -108,7 +108,7 @@ namespace MediaBrowser.ApiEnableTotalRecordCount = false,DtoOptions = new Controller.Dto.DtoOptions{- Fields = new List<ItemFields> { ItemFields.Genres, ItemFields.Tags },+ Fields = new ItemFields[] { ItemFields.Genres, ItemFields.Tags },EnableImages = false,EnableUserData = false}diff --git a/MediaBrowser.Api/GamesService.cs b/MediaBrowser.Api/GamesService.csindex 0ce57a16a8..8a16cbfa16 100644--- a/MediaBrowser.Api/GamesService.cs+++ b/MediaBrowser.Api/GamesService.cs@@ -28,21 +28,7 @@ namespace MediaBrowser.Api/// Class GetGameSystemSummaries/// </summary>[Route("/Games/SystemSummaries", "GET", Summary = "Finds games similar to a given game.")]- public class GetGameSystemSummaries : IReturn<List<GameSystemSummary>>- {- /// <summary>- /// Gets or sets the user id.- /// </summary>- /// <value>The user id.</value>- [ApiMember(Name = "UserId", Description = "Optional. Filter by user id", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "GET")]- public string UserId { get; set; }- }-- /// <summary>- /// Class GetGameSystemSummaries- /// </summary>- [Route("/Games/PlayerIndex", "GET", Summary = "Gets an index of players (1-x) and the number of games listed under each")]- public class GetPlayerIndex : IReturn<List<ItemIndex>>+ public class GetGameSystemSummaries : IReturn<GameSystemSummary[]>{/// <summary>/// Gets or sets the user id.@@ -117,47 +103,17 @@ namespace MediaBrowser.ApiEnableImages = false}};- var gameSystems = _libraryManager.GetItemList(query)- .Cast<GameSystem>()- .ToList();- var result = gameSystems+ var result = _libraryManager.GetItemList(query)+ .Cast<GameSystem>().Select(i => GetSummary(i, user))- .ToList();+ .ToArray();return ToOptimizedSerializedResultUsingCache(result);}private static readonly CultureInfo UsCulture = new CultureInfo("en-US");- public object Get(GetPlayerIndex request)- {- var user = request.UserId == null ? null : _userManager.GetUserById(request.UserId);- var query = new InternalItemsQuery(user)- {- IncludeItemTypes = new[] { typeof(Game).Name },- DtoOptions = new DtoOptions(false)- {- EnableImages = false- }- };- var games = _libraryManager.GetItemList(query)- .Cast<Game>()- .ToList();-- var lookup = games- .ToLookup(i => i.PlayersSupported ?? -1)- .OrderBy(i => i.Key)- .Select(i => new ItemIndex- {- ItemCount = i.Count(),- Name = i.Key == -1 ? string.Empty : i.Key.ToString(UsCulture)- })- .ToList();-- return ToOptimizedSerializedResultUsingCache(lookup);- }-/// <summary>/// Gets the summary./// </summary>@@ -183,15 +139,15 @@ namespace MediaBrowser.Api}});- var games = items.Cast<Game>().ToList();+ var games = items.Cast<Game>().ToArray();summary.ClientInstalledGameCount = games.Count(i => i.IsPlaceHolder);- summary.GameCount = games.Count;+ summary.GameCount = games.Length;summary.GameFileExtensions = games.Where(i => !i.IsPlaceHolder).Select(i => Path.GetExtension(i.Path)).Distinct(StringComparer.OrdinalIgnoreCase)- .ToList();+ .ToArray();return summary;}@@ -234,7 +190,7 @@ namespace MediaBrowser.Apivar result = new QueryResult<BaseItemDto>{- Items = returnList.ToArray(returnList.Count),+ Items = returnList,TotalRecordCount = itemsResult.Count};diff --git a/MediaBrowser.Api/IHasItemFields.cs b/MediaBrowser.Api/IHasItemFields.csindex 36303c889d..0b39199854 100644--- a/MediaBrowser.Api/IHasItemFields.cs+++ b/MediaBrowser.Api/IHasItemFields.cs@@ -27,7 +27,7 @@ namespace MediaBrowser.Api/// </summary>/// <param name="request">The request.</param>/// <returns>IEnumerable{ItemFields}.</returns>- public static IEnumerable<ItemFields> GetItemFields(this IHasItemFields request)+ public static ItemFields[] GetItemFields(this IHasItemFields request){var val = request.Fields;@@ -46,7 +46,7 @@ namespace MediaBrowser.Api}return null;- }).Where(i => i.HasValue).Select(i => i.Value);+ }).Where(i => i.HasValue).Select(i => i.Value).ToArray();}}}diff --git a/MediaBrowser.Api/Images/RemoteImageService.cs b/MediaBrowser.Api/Images/RemoteImageService.csindex e4f3fd3d76..3512a526ba 100644--- a/MediaBrowser.Api/Images/RemoteImageService.cs+++ b/MediaBrowser.Api/Images/RemoteImageService.cs@@ -150,7 +150,7 @@ namespace MediaBrowser.Api.Images}, CancellationToken.None).ConfigureAwait(false);- var imagesList = images.ToList();+ var imagesList = images.ToArray();var allProviders = _providerManager.GetRemoteImageProviderInfo(item);@@ -161,22 +161,22 @@ namespace MediaBrowser.Api.Imagesvar result = new RemoteImageResult{- TotalRecordCount = imagesList.Count,+ TotalRecordCount = imagesList.Length,Providers = allProviders.Select(i => i.Name).Distinct(StringComparer.OrdinalIgnoreCase)- .ToList()+ .ToArray()};if (request.StartIndex.HasValue){imagesList = imagesList.Skip(request.StartIndex.Value)- .ToList();+ .ToArray();}if (request.Limit.HasValue){imagesList = imagesList.Take(request.Limit.Value)- .ToList();+ .ToArray();}result.Images = imagesList;diff --git a/MediaBrowser.Api/ItemUpdateService.cs b/MediaBrowser.Api/ItemUpdateService.csindex 313f7aab50..56caf884bb 100644--- a/MediaBrowser.Api/ItemUpdateService.cs+++ b/MediaBrowser.Api/ItemUpdateService.cs@@ -64,8 +64,8 @@ namespace MediaBrowser.Apivar info = new MetadataEditorInfo{- ParentalRatingOptions = _localizationManager.GetParentalRatings().ToList(),- ExternalIdInfos = _providerManager.GetExternalIdInfos(item).ToList(),+ ParentalRatingOptions = _localizationManager.GetParentalRatings(),+ ExternalIdInfos = _providerManager.GetExternalIdInfos(item).ToArray(),Countries = _localizationManager.GetCountries(),Cultures = _localizationManager.GetCultures()};@@ -78,14 +78,14 @@ namespace MediaBrowser.Apiif (string.IsNullOrWhiteSpace(inheritedContentType) || !string.IsNullOrWhiteSpace(configuredContentType)){- info.ContentTypeOptions = GetContentTypeOptions(true);+ info.ContentTypeOptions = GetContentTypeOptions(true).ToArray();info.ContentType = configuredContentType;if (string.IsNullOrWhiteSpace(inheritedContentType) || string.Equals(inheritedContentType, CollectionType.TvShows, StringComparison.OrdinalIgnoreCase)){info.ContentTypeOptions = info.ContentTypeOptions.Where(i => string.IsNullOrWhiteSpace(i.Value) || string.Equals(i.Value, CollectionType.TvShows, StringComparison.OrdinalIgnoreCase))- .ToList();+ .ToArray();}}}diff --git a/MediaBrowser.Api/Library/LibraryService.cs b/MediaBrowser.Api/Library/LibraryService.csindex 7dd1afaf45..6c9f5d32bb 100644--- a/MediaBrowser.Api/Library/LibraryService.cs+++ b/MediaBrowser.Api/Library/LibraryService.cs@@ -227,7 +227,7 @@ namespace MediaBrowser.Api.Library[Route("/Library/MediaFolders", "GET", Summary = "Gets all user media folders.")][Authenticated]- public class GetMediaFolders : IReturn<ItemsResult>+ public class GetMediaFolders : IReturn<QueryResult<BaseItemDto>>{[ApiMember(Name = "IsHidden", Description = "Optional. Filter by folders that are marked hidden, or not.", IsRequired = false, DataType = "boolean", ParameterType = "query", Verb = "GET")]public bool? IsHidden { get; set; }@@ -400,7 +400,7 @@ namespace MediaBrowser.Api.Library});}- return new ItemsResult();+ return new QueryResult<BaseItemDto>();}public object Get(GetMediaFolders request)@@ -416,7 +416,7 @@ namespace MediaBrowser.Api.Libraryvar dtoOptions = GetDtoOptions(_authContext, request);- var result = new ItemsResult+ var result = new QueryResult<BaseItemDto>{TotalRecordCount = items.Count,@@ -615,7 +615,7 @@ namespace MediaBrowser.Api.Libraryparent = parent.GetParent();}- return baseItemDtos.ToList();+ return baseItemDtos;}private BaseItem TranslateParentItem(BaseItem item, User user)diff --git a/MediaBrowser.Api/LiveTv/LiveTvService.cs b/MediaBrowser.Api/LiveTv/LiveTvService.csindex e2961f630e..e866be9c67 100644--- a/MediaBrowser.Api/LiveTv/LiveTvService.cs+++ b/MediaBrowser.Api/LiveTv/LiveTvService.cs@@ -648,7 +648,7 @@ namespace MediaBrowser.Api.LiveTv{public List<TunerChannelMapping> TunerChannels { get; set; }public List<NameIdPair> ProviderChannels { get; set; }- public List<NameValuePair> Mappings { get; set; }+ public NameValuePair[] Mappings { get; set; }public string ProviderName { get; set; }}@@ -789,7 +789,7 @@ namespace MediaBrowser.Api.LiveTvvar providerChannels = await _liveTvManager.GetChannelsFromListingsProviderData(request.ProviderId, CancellationToken.None).ConfigureAwait(false);- var mappings = listingsProviderInfo.ChannelMappings.ToList();+ var mappings = listingsProviderInfo.ChannelMappings;var result = new ChannelMappingOptions{@@ -862,7 +862,7 @@ namespace MediaBrowser.Api.LiveTv{var config = GetConfiguration();- config.TunerHosts = config.TunerHosts.Where(i => !string.Equals(request.Id, i.Id, StringComparison.OrdinalIgnoreCase)).ToList();+ config.TunerHosts = config.TunerHosts.Where(i => !string.Equals(request.Id, i.Id, StringComparison.OrdinalIgnoreCase)).ToArray();_config.SaveConfiguration("livetv", config);}@@ -922,9 +922,8 @@ namespace MediaBrowser.Api.LiveTvoptions.AddCurrentProgram = request.AddCurrentProgram;- var returnList = (await _dtoService.GetBaseItemDtos(channelResult.Items, options, user)+ var returnArray = (await _dtoService.GetBaseItemDtos(channelResult.Items, options, user).ConfigureAwait(false));- var returnArray = returnList.ToArray(returnList.Count);var result = new QueryResult<BaseItemDto>{@@ -937,10 +936,13 @@ namespace MediaBrowser.Api.LiveTvprivate void RemoveFields(DtoOptions options){- options.Fields.Remove(ItemFields.CanDelete);- options.Fields.Remove(ItemFields.CanDownload);- options.Fields.Remove(ItemFields.DisplayPreferencesId);- options.Fields.Remove(ItemFields.Etag);+ var fields = options.Fields.ToList();++ fields.Remove(ItemFields.CanDelete);+ fields.Remove(ItemFields.CanDownload);+ fields.Remove(ItemFields.DisplayPreferencesId);+ fields.Remove(ItemFields.Etag);+ options.Fields = fields.ToArray(fields.Count);}public object Get(GetChannel request)diff --git a/MediaBrowser.Api/LocalizationService.cs b/MediaBrowser.Api/LocalizationService.csindex eee340a874..2c92505b17 100644--- a/MediaBrowser.Api/LocalizationService.cs+++ b/MediaBrowser.Api/LocalizationService.cs@@ -11,7 +11,7 @@ namespace MediaBrowser.Api/// Class GetCultures/// </summary>[Route("/Localization/Cultures", "GET", Summary = "Gets known cultures")]- public class GetCultures : IReturn<List<CultureDto>>+ public class GetCultures : IReturn<CultureDto[]>{}@@ -19,7 +19,7 @@ namespace MediaBrowser.Api/// Class GetCountries/// </summary>[Route("/Localization/Countries", "GET", Summary = "Gets known countries")]- public class GetCountries : IReturn<List<CountryInfo>>+ public class GetCountries : IReturn<CountryInfo[]>{}@@ -27,7 +27,7 @@ namespace MediaBrowser.Api/// Class ParentalRatings/// </summary>[Route("/Localization/ParentalRatings", "GET", Summary = "Gets known parental ratings")]- public class GetParentalRatings : IReturn<List<ParentalRating>>+ public class GetParentalRatings : IReturn<ParentalRating[]>{}@@ -35,7 +35,7 @@ namespace MediaBrowser.Api/// Class ParentalRatings/// </summary>[Route("/Localization/Options", "GET", Summary = "Gets localization options")]- public class GetLocalizationOptions : IReturn<List<LocalizatonOption>>+ public class GetLocalizationOptions : IReturn<LocalizatonOption[]>{}@@ -66,14 +66,14 @@ namespace MediaBrowser.Api/// <returns>System.Object.</returns>public object Get(GetParentalRatings request){- var result = _localization.GetParentalRatings().ToList();+ var result = _localization.GetParentalRatings();return ToOptimizedResult(result);}public object Get(GetLocalizationOptions request){- var result = _localization.GetLocalizationOptions().ToList();+ var result = _localization.GetLocalizationOptions();return ToOptimizedResult(result);}diff --git a/MediaBrowser.Api/MediaBrowser.Api.csproj b/MediaBrowser.Api/MediaBrowser.Api.csprojindex 810b0f6b27..602a697bf2 100644--- a/MediaBrowser.Api/MediaBrowser.Api.csproj+++ b/MediaBrowser.Api/MediaBrowser.Api.csproj@@ -97,7 +97,6 @@<Compile Include="Movies\MoviesService.cs" /><Compile Include="NewsService.cs" /><Compile Include="NotificationsService.cs" />- <Compile Include="PackageReviewService.cs" /><Compile Include="PackageService.cs" /><Compile Include="PluginService.cs" /><Compile Include="Images\RemoteImageService.cs" />diff --git a/MediaBrowser.Api/Movies/CollectionService.cs b/MediaBrowser.Api/Movies/CollectionService.csindex 917a3bc0bc..6511d31279 100644--- a/MediaBrowser.Api/Movies/CollectionService.cs+++ b/MediaBrowser.Api/Movies/CollectionService.cs@@ -71,8 +71,8 @@ namespace MediaBrowser.Api.MoviesIsLocked = request.IsLocked,Name = request.Name,ParentId = parentId,- ItemIdList = (request.Ids ?? string.Empty).Split(',').Where(i => !string.IsNullOrWhiteSpace(i)).Select(i => new Guid(i)).ToList(),- UserIds = new List<Guid> { new Guid(userId) }+ ItemIdList = SplitValue(request.Ids, ','),+ UserIds = new string[] { userId }}).ConfigureAwait(false);@@ -88,14 +88,14 @@ namespace MediaBrowser.Api.Moviespublic void Post(AddToCollection request){- var task = _collectionManager.AddToCollection(new Guid(request.Id), request.Ids.Split(',').Select(i => new Guid(i)));+ var task = _collectionManager.AddToCollection(new Guid(request.Id), SplitValue(request.Ids, ','));Task.WaitAll(task);}public void Delete(RemoveFromCollection request){- var task = _collectionManager.RemoveFromCollection(new Guid(request.Id), request.Ids.Split(',').Select(i => new Guid(i)));+ var task = _collectionManager.RemoveFromCollection(new Guid(request.Id), SplitValue(request.Ids, ','));Task.WaitAll(task);}diff --git a/MediaBrowser.Api/Movies/MoviesService.cs b/MediaBrowser.Api/Movies/MoviesService.csindex c668d2c756..7873c1cd38 100644--- a/MediaBrowser.Api/Movies/MoviesService.cs+++ b/MediaBrowser.Api/Movies/MoviesService.cs@@ -170,7 +170,7 @@ namespace MediaBrowser.Api.Moviesvar result = new QueryResult<BaseItemDto>{- Items = returnList.ToArray(returnList.Count),+ Items = returnList,TotalRecordCount = itemsResult.Count};@@ -320,7 +320,7 @@ namespace MediaBrowser.Api.MoviesBaselineItemName = name,CategoryId = name.GetMD5().ToString("N"),RecommendationType = type,- Items = returnItems.ToArray(returnItems.Count)+ Items = returnItems};}}@@ -360,7 +360,7 @@ namespace MediaBrowser.Api.MoviesBaselineItemName = name,CategoryId = name.GetMD5().ToString("N"),RecommendationType = type,- Items = returnItems.ToArray(returnItems.Count)+ Items = returnItems};}}@@ -397,7 +397,7 @@ namespace MediaBrowser.Api.MoviesBaselineItemName = item.Name,CategoryId = item.Id.ToString("N"),RecommendationType = type,- Items = returnItems.ToArray(returnItems.Count)+ Items = returnItems};}}diff --git a/MediaBrowser.Api/Movies/TrailersService.cs b/MediaBrowser.Api/Movies/TrailersService.csindex eb5365ab8f..45b07712f8 100644--- a/MediaBrowser.Api/Movies/TrailersService.cs+++ b/MediaBrowser.Api/Movies/TrailersService.cs@@ -4,6 +4,7 @@ using MediaBrowser.Controller.Library;using MediaBrowser.Controller.Net;using MediaBrowser.Model.Querying;using MediaBrowser.Controller.Collections;+using MediaBrowser.Model.Dto;using MediaBrowser.Model.Globalization;using MediaBrowser.Model.Serialization;using MediaBrowser.Model.Services;@@ -11,7 +12,7 @@ using MediaBrowser.Model.Services;namespace MediaBrowser.Api.Movies{[Route("/Trailers", "GET", Summary = "Finds movies and trailers similar to a given trailer.")]- public class Getrailers : BaseItemsRequest, IReturn<ItemsResult>+ public class Getrailers : BaseItemsRequest, IReturn<QueryResult<BaseItemDto>>{}diff --git a/MediaBrowser.Api/Music/InstantMixService.cs b/MediaBrowser.Api/Music/InstantMixService.csindex b0f086ec5b..bf6b75a3ef 100644--- a/MediaBrowser.Api/Music/InstantMixService.cs+++ b/MediaBrowser.Api/Music/InstantMixService.cs@@ -8,6 +8,7 @@ using MediaBrowser.Model.Querying;using System.Collections.Generic;using System.Linq;using System.Threading.Tasks;+using MediaBrowser.Model.Dto;using MediaBrowser.Model.Services;using MediaBrowser.Model.Extensions;@@ -185,15 +186,20 @@ namespace MediaBrowser.Api.Music{var list = items;- var result = new ItemsResult+ var result = new QueryResult<BaseItemDto>{TotalRecordCount = list.Count};- var returnList = (await _dtoService.GetBaseItemDtos(list.Take(request.Limit ?? list.Count), dtoOptions, user)+ if (request.Limit.HasValue)+ {+ list = list.Take(request.Limit.Value).ToList();+ }++ var returnList = (await _dtoService.GetBaseItemDtos(list, dtoOptions, user).ConfigureAwait(false));- result.Items = returnList.ToArray(returnList.Count);+ result.Items = returnList;return ToOptimizedResult(result);}diff --git a/MediaBrowser.Api/NotificationsService.cs b/MediaBrowser.Api/NotificationsService.csindex 58e413cef2..4876351fc0 100644--- a/MediaBrowser.Api/NotificationsService.cs+++ b/MediaBrowser.Api/NotificationsService.cs@@ -99,7 +99,7 @@ namespace MediaBrowser.Apipublic object Get(GetNotificationTypes request){- var result = _notificationManager.GetNotificationTypes().ToList();+ var result = _notificationManager.GetNotificationTypes();return ToOptimizedResult(result);}diff --git a/MediaBrowser.Api/PackageReviewService.cs b/MediaBrowser.Api/PackageReviewService.csdeleted file mode 100644index baf1adc192..0000000000--- a/MediaBrowser.Api/PackageReviewService.cs+++ /dev/null@@ -1,162 +0,0 @@-using MediaBrowser.Common.Net;-using MediaBrowser.Controller;-using MediaBrowser.Controller.Net;-using MediaBrowser.Model.Entities;-using MediaBrowser.Model.Serialization;-using System.Collections.Generic;-using System.Globalization;-using System.Net;-using System.Threading;-using System.Threading.Tasks;-using MediaBrowser.Model.Services;--namespace MediaBrowser.Api-{- /// <summary>- /// Class InstallPackage- /// </summary>- [Route("/Packages/Reviews/{Id}", "POST", Summary = "Creates or updates a package review")]- public class CreateReviewRequest : IReturnVoid- {- /// <summary>- /// Gets or sets the Id.- /// </summary>- /// <value>The Id.</value>- [ApiMember(Name = "Id", Description = "Package Id", IsRequired = true, DataType = "int", ParameterType = "path", Verb = "POST")]- public int Id { get; set; }-- /// <summary>- /// Gets or sets the rating.- /// </summary>- /// <value>The review.</value>- [ApiMember(Name = "Rating", Description = "The rating value (1-5)", IsRequired = true, DataType = "int", ParameterType = "query", Verb = "POST")]- public int Rating { get; set; }-- /// <summary>- /// Gets or sets the recommend value.- /// </summary>- /// <value>Whether or not this review recommends this item.</value>- [ApiMember(Name = "Recommend", Description = "Whether or not this review recommends this item", IsRequired = true, DataType = "bool", ParameterType = "query", Verb = "POST")]- public bool Recommend { get; set; }-- /// <summary>- /// Gets or sets the title.- /// </summary>- /// <value>The title.</value>- [ApiMember(Name = "Title", Description = "Optional short description of review.", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "POST")]- public string Title { get; set; }-- /// <summary>- /// Gets or sets the full review.- /// </summary>- /// <value>The full review.</value>- [ApiMember(Name = "Review", Description = "Optional full review.", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "POST")]- public string Review { get; set; }- }-- /// <summary>- /// Class InstallPackage- /// </summary>- [Route("/Packages/{Id}/Reviews", "GET", Summary = "Gets reviews for a package")]- public class ReviewRequest : IReturn<List<PackageReviewInfo>>- {- /// <summary>- /// Gets or sets the Id.- /// </summary>- /// <value>The Id.</value>- [ApiMember(Name = "Id", Description = "Package Id", IsRequired = true, DataType = "int", ParameterType = "path", Verb = "GET")]- public int Id { get; set; }-- /// <summary>- /// Gets or sets the max rating.- /// </summary>- /// <value>The max rating.</value>- [ApiMember(Name = "MaxRating", Description = "Retrieve only reviews less than or equal to this", IsRequired = false, DataType = "int", ParameterType = "query", Verb = "GET")]- public int MaxRating { get; set; }-- /// <summary>- /// Gets or sets the min rating.- /// </summary>- /// <value>The max rating.</value>- [ApiMember(Name = "MinRating", Description = "Retrieve only reviews greator than or equal to this", IsRequired = false, DataType = "int", ParameterType = "query", Verb = "GET")]- public int MinRating { get; set; }-- /// <summary>- /// Only retrieve reviews with at least a short review.- /// </summary>- /// <value>True if should only get reviews with a title.</value>- [ApiMember(Name = "ForceTitle", Description = "Whether or not to restrict results to those with a title", IsRequired = false, DataType = "bool", ParameterType = "query", Verb = "GET")]- public bool ForceTitle { get; set; }-- /// <summary>- /// Gets or sets the limit for the query.- /// </summary>- /// <value>The max rating.</value>- [ApiMember(Name = "Limit", Description = "Limit the result to this many reviews (ordered by latest)", IsRequired = false, DataType = "int", ParameterType = "query", Verb = "GET")]- public int Limit { get; set; }-- }-- [Authenticated]- public class PackageReviewService : BaseApiService- {- private readonly IHttpClient _httpClient;- private readonly IJsonSerializer _serializer;- private const string MbAdminUrl = "https://www.mb3admin.com/admin/";- private readonly IServerApplicationHost _appHost;-- public PackageReviewService(IHttpClient httpClient, IJsonSerializer serializer, IServerApplicationHost appHost)- {- _httpClient = httpClient;- _serializer = serializer;- _appHost = appHost;- }-- public async Task<object> Get(ReviewRequest request)- {- var parms = "?id=" + request.Id;-- if (request.MaxRating > 0)- {- parms += "&max=" + request.MaxRating;- }- if (request.MinRating > 0)- {- parms += "&min=" + request.MinRating;- }- if (request.MinRating > 0)- {- parms += "&limit=" + request.Limit;- }- if (request.ForceTitle)- {- parms += "&title=true";- }-- using (var result = await _httpClient.Get(MbAdminUrl + "/service/packageReview/retrieve" + parms, CancellationToken.None)- .ConfigureAwait(false))- {- var reviews = _serializer.DeserializeFromStream<List<PackageReviewInfo>>(result);-- return ToOptimizedResult(reviews);- }- }-- public void Post(CreateReviewRequest request)- {- var reviewText = WebUtility.HtmlEncode(request.Review ?? string.Empty);- var title = WebUtility.HtmlEncode(request.Title ?? string.Empty);-- var review = new Dictionary<string, string>- { { "id", request.Id.ToString(CultureInfo.InvariantCulture) },- { "mac", _appHost.SystemId },- { "rating", request.Rating.ToString(CultureInfo.InvariantCulture) },- { "recommend", request.Recommend.ToString() },- { "title", title },- { "review", reviewText },- };-- Task.WaitAll(_httpClient.Post(MbAdminUrl + "/service/packageReview/update", review, CancellationToken.None));- }- }-}diff --git a/MediaBrowser.Api/PackageService.cs b/MediaBrowser.Api/PackageService.csindex 64424795fc..79dda87028 100644--- a/MediaBrowser.Api/PackageService.cs+++ b/MediaBrowser.Api/PackageService.cs@@ -40,7 +40,7 @@ namespace MediaBrowser.Api/// </summary>[Route("/Packages", "GET", Summary = "Gets available packages")][Authenticated]- public class GetPackages : IReturn<List<PackageInfo>>+ public class GetPackages : IReturn<PackageInfo[]>{/// <summary>/// Gets or sets the name.@@ -66,7 +66,7 @@ namespace MediaBrowser.Api/// </summary>[Route("/Packages/Updates", "GET", Summary = "Gets available package updates for currently installed packages")][Authenticated(Roles = "Admin")]- public class GetPackageVersionUpdates : IReturn<List<PackageVersionInfo>>+ public class GetPackageVersionUpdates : IReturn<PackageVersionInfo[]>{/// <summary>/// Gets or sets the name.@@ -148,24 +148,26 @@ namespace MediaBrowser.Api/// <returns>System.Object.</returns>public object Get(GetPackageVersionUpdates request){- var result = new List<PackageVersionInfo>();+ PackageVersionInfo[] result = null;if (string.Equals(request.PackageType, "UserInstalled", StringComparison.OrdinalIgnoreCase) || string.Equals(request.PackageType, "All", StringComparison.OrdinalIgnoreCase)){- result.AddRange(_installationManager.GetAvailablePluginUpdates(_appHost.ApplicationVersion, false, CancellationToken.None).Result.ToList());+ result = _installationManager.GetAvailablePluginUpdates(_appHost.ApplicationVersion, false, CancellationToken.None).Result.ToArray();}- else if (string.Equals(request.PackageType, "System", StringComparison.OrdinalIgnoreCase) || string.Equals(request.PackageType, "All", StringComparison.OrdinalIgnoreCase))+ else if (string.Equals(request.PackageType, "System", StringComparison.OrdinalIgnoreCase) ||+ string.Equals(request.PackageType, "All", StringComparison.OrdinalIgnoreCase)){- var updateCheckResult = _appHost.CheckForApplicationUpdate(CancellationToken.None, new SimpleProgress<double>()).Result;+ var updateCheckResult = _appHost+ .CheckForApplicationUpdate(CancellationToken.None, new SimpleProgress<double>()).Result;if (updateCheckResult.IsUpdateAvailable){- result.Add(updateCheckResult.Package);+ result = new PackageVersionInfo[] {updateCheckResult.Package};}}- return ToOptimizedResult(result);+ return ToOptimizedResult(result ?? new PackageVersionInfo[] { });}/// <summary>@@ -176,10 +178,9 @@ namespace MediaBrowser.Apipublic object Get(GetPackage request){var packages = _installationManager.GetAvailablePackages(CancellationToken.None, applicationVersion: _appHost.ApplicationVersion).Result;- var list = packages.ToList();- var result = list.FirstOrDefault(p => string.Equals(p.guid, request.AssemblyGuid ?? "none", StringComparison.OrdinalIgnoreCase))- ?? list.FirstOrDefault(p => p.name.Equals(request.Name, StringComparison.OrdinalIgnoreCase));+ var result = packages.FirstOrDefault(p => string.Equals(p.guid, request.AssemblyGuid ?? "none", StringComparison.OrdinalIgnoreCase))+ ?? packages.FirstOrDefault(p => p.name.Equals(request.Name, StringComparison.OrdinalIgnoreCase));return ToOptimizedResult(result);}@@ -191,7 +192,7 @@ namespace MediaBrowser.Api/// <returns>System.Object.</returns>public async Task<object> Get(GetPackages request){- var packages = await _installationManager.GetAvailablePackages(CancellationToken.None, false, request.PackageType, _appHost.ApplicationVersion).ConfigureAwait(false);+ IEnumerable<PackageInfo> packages = await _installationManager.GetAvailablePackages(CancellationToken.None, false, request.PackageType, _appHost.ApplicationVersion).ConfigureAwait(false);if (!string.IsNullOrEmpty(request.TargetSystems)){@@ -215,7 +216,7 @@ namespace MediaBrowser.Apipackages = packages.Where(p => p.enableInAppStore == request.IsAppStoreEnabled.Value);}- return ToOptimizedResult(packages.ToList());+ return ToOptimizedResult(packages.ToArray());}/// <summary>diff --git a/MediaBrowser.Api/PlaylistService.cs b/MediaBrowser.Api/PlaylistService.csindex aef16e4428..07a976f396 100644--- a/MediaBrowser.Api/PlaylistService.cs+++ b/MediaBrowser.Api/PlaylistService.cs@@ -149,7 +149,7 @@ namespace MediaBrowser.Apivar result = await _playlistManager.CreatePlaylist(new PlaylistCreationRequest{Name = request.Name,- ItemIdList = (request.Ids ?? string.Empty).Split(',').Where(i => !string.IsNullOrWhiteSpace(i)).ToList(),+ ItemIdList = SplitValue(request.Ids, ','),UserId = request.UserId,MediaType = request.MediaType@@ -193,10 +193,8 @@ namespace MediaBrowser.Apivar dtoOptions = GetDtoOptions(_authContext, request);- var returnList = (await _dtoService.GetBaseItemDtos(items.Select(i => i.Item2), dtoOptions, user)+ var dtos = (await _dtoService.GetBaseItemDtos(items.Select(i => i.Item2).ToList(), dtoOptions, user).ConfigureAwait(false));- var dtos = returnList- .ToArray(returnList.Count);var index = 0;foreach (var item in dtos)@@ -205,7 +203,7 @@ namespace MediaBrowser.Apiindex++;}- var result = new ItemsResult+ var result = new QueryResult<BaseItemDto>{Items = dtos,TotalRecordCount = countdiff --git a/MediaBrowser.Api/PluginService.cs b/MediaBrowser.Api/PluginService.csindex eb95224b79..f6efe15e6d 100644--- a/MediaBrowser.Api/PluginService.cs+++ b/MediaBrowser.Api/PluginService.cs@@ -23,7 +23,7 @@ namespace MediaBrowser.Api/// </summary>[Route("/Plugins", "GET", Summary = "Gets a list of currently installed plugins")][Authenticated]- public class GetPlugins : IReturn<List<PluginInfo>>+ public class GetPlugins : IReturn<PluginInfo[]>{public bool? IsAppStoreEnabled { get; set; }}@@ -195,14 +195,13 @@ namespace MediaBrowser.Api/// <returns>System.Object.</returns>public async Task<object> Get(GetPlugins request){- var result = _appHost.Plugins.OrderBy(p => p.Name).Select(p => p.GetPluginInfo()).ToList();+ var result = _appHost.Plugins.OrderBy(p => p.Name).Select(p => p.GetPluginInfo()).ToArray();var requireAppStoreEnabled = request.IsAppStoreEnabled.HasValue && request.IsAppStoreEnabled.Value;// Don't fail just on account of image url'stry{- var packages = (await _installationManager.GetAvailablePackagesWithoutRegistrationInfo(CancellationToken.None))- .ToList();+ var packages = (await _installationManager.GetAvailablePackagesWithoutRegistrationInfo(CancellationToken.None));foreach (var plugin in result){@@ -223,7 +222,7 @@ namespace MediaBrowser.Apireturn pkg != null && pkg.enableInAppStore;})- .ToList();+ .ToArray();}}catch@@ -232,7 +231,7 @@ namespace MediaBrowser.Api// Play it safe hereif (requireAppStoreEnabled){- result = new List<PluginInfo>();+ result = new PluginInfo[] { };}}diff --git a/MediaBrowser.Api/ScheduledTasks/ScheduledTaskService.cs b/MediaBrowser.Api/ScheduledTasks/ScheduledTaskService.csindex e8ad9ea954..abe3e5407c 100644--- a/MediaBrowser.Api/ScheduledTasks/ScheduledTaskService.cs+++ b/MediaBrowser.Api/ScheduledTasks/ScheduledTaskService.cs@@ -27,7 +27,7 @@ namespace MediaBrowser.Api.ScheduledTasks/// Class GetScheduledTasks/// </summary>[Route("/ScheduledTasks", "GET", Summary = "Gets scheduled tasks")]- public class GetScheduledTasks : IReturn<List<TaskInfo>>+ public class GetScheduledTasks : IReturn<TaskInfo[]>{[ApiMember(Name = "IsHidden", Description = "Optional filter tasks that are hidden, or not.", IsRequired = false, DataType = "bool", ParameterType = "query", Verb = "GET")]public bool? IsHidden { get; set; }@@ -158,7 +158,7 @@ namespace MediaBrowser.Api.ScheduledTasksvar infos = result.Select(ScheduledTaskHelpers.GetTaskInfo)- .ToList();+ .ToArray();return ToOptimizedResult(infos);}diff --git a/MediaBrowser.Api/Session/SessionsService.cs b/MediaBrowser.Api/Session/SessionsService.csindex fe40ceeebf..18d2611952 100644--- a/MediaBrowser.Api/Session/SessionsService.cs+++ b/MediaBrowser.Api/Session/SessionsService.cs@@ -18,7 +18,7 @@ namespace MediaBrowser.Api.Session/// </summary>[Route("/Sessions", "GET", Summary = "Gets a list of sessions")][Authenticated]- public class GetSessions : IReturn<List<SessionInfoDto>>+ public class GetSessions : IReturn<SessionInfoDto[]>{[ApiMember(Name = "ControllableByUserId", Description = "Optional. Filter by sessions that a given user is allowed to remote control.", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "GET")]public string ControllableByUserId { get; set; }@@ -396,7 +396,7 @@ namespace MediaBrowser.Api.Session});}- return ToOptimizedResult(result.Select(_sessionManager.GetSessionInfoDto).ToList());+ return ToOptimizedResult(result.Select(_sessionManager.GetSessionInfoDto).ToArray());}public void Post(SendPlaystateCommand request)@@ -532,9 +532,9 @@ namespace MediaBrowser.Api.Session}_sessionManager.ReportCapabilities(request.Id, new ClientCapabilities{- PlayableMediaTypes = (request.PlayableMediaTypes ?? string.Empty).Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries).ToList(),+ PlayableMediaTypes = SplitValue(request.PlayableMediaTypes, ','),- SupportedCommands = (request.SupportedCommands ?? string.Empty).Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries).ToList(),+ SupportedCommands = SplitValue(request.SupportedCommands, ','),SupportsMediaControl = request.SupportsMediaControl,diff --git a/MediaBrowser.Api/SimilarItemsHelper.cs b/MediaBrowser.Api/SimilarItemsHelper.csindex a4b14d2d49..48765e698a 100644--- a/MediaBrowser.Api/SimilarItemsHelper.cs+++ b/MediaBrowser.Api/SimilarItemsHelper.cs@@ -30,7 +30,7 @@ namespace MediaBrowser.Apipublic string ExcludeArtistIds { get; set; }}- public class BaseGetSimilarItems : IReturn<ItemsResult>, IHasDtoOptions+ public class BaseGetSimilarItems : IReturn<QueryResult<BaseItemDto>>, IHasDtoOptions{[ApiMember(Name = "EnableImages", Description = "Optional, include image information in output", IsRequired = false, DataType = "boolean", ParameterType = "query", Verb = "GET")]public bool? EnableImages { get; set; }@@ -97,18 +97,18 @@ namespace MediaBrowser.Apivar items = GetSimilaritems(item, libraryManager, inputItems, getSimilarityScore).ToList();- IEnumerable<BaseItem> returnItems = items;+ List<BaseItem> returnItems = items;if (request.Limit.HasValue){- returnItems = returnItems.Take(request.Limit.Value);+ returnItems = returnItems.Take(request.Limit.Value).ToList();}var dtos = await dtoService.GetBaseItemDtos(returnItems, dtoOptions, user).ConfigureAwait(false);return new QueryResult<BaseItemDto>{- Items = dtos.ToArray(dtos.Count),+ Items = dtos,TotalRecordCount = items.Count};diff --git a/MediaBrowser.Api/Subtitles/SubtitleService.cs b/MediaBrowser.Api/Subtitles/SubtitleService.csindex 645aacdec6..4d4b4cb273 100644--- a/MediaBrowser.Api/Subtitles/SubtitleService.cs+++ b/MediaBrowser.Api/Subtitles/SubtitleService.cs@@ -14,8 +14,6 @@ using System.Linq;using System.Text;using System.Threading;using System.Threading.Tasks;--using MediaBrowser.Controller.IO;using MediaBrowser.Model.IO;using MediaBrowser.Model.Services;using MimeTypes = MediaBrowser.Model.Net.MimeTypes;@@ -39,7 +37,7 @@ namespace MediaBrowser.Api.Subtitles[Route("/Items/{Id}/RemoteSearch/Subtitles/{Language}", "GET")][Authenticated]- public class SearchRemoteSubtitles : IReturn<List<RemoteSubtitleInfo>>+ public class SearchRemoteSubtitles : IReturn<RemoteSubtitleInfo[]>{[ApiMember(Name = "Id", Description = "Item Id", IsRequired = true, DataType = "string", ParameterType = "path", Verb = "GET")]public string Id { get; set; }@@ -52,7 +50,7 @@ namespace MediaBrowser.Api.Subtitles[Route("/Items/{Id}/RemoteSearch/Subtitles/Providers", "GET")][Authenticated]- public class GetSubtitleProviders : IReturn<List<SubtitleProviderInfo>>+ public class GetSubtitleProviders : IReturn<SubtitleProviderInfo[]>{[ApiMember(Name = "Id", Description = "Item Id", IsRequired = true, DataType = "string", ParameterType = "path", Verb = "GET")]public string Id { get; set; }diff --git a/MediaBrowser.Api/SuggestionsService.cs b/MediaBrowser.Api/SuggestionsService.csindex 2456dd6c0c..22432bf518 100644--- a/MediaBrowser.Api/SuggestionsService.cs+++ b/MediaBrowser.Api/SuggestionsService.cs@@ -72,7 +72,7 @@ namespace MediaBrowser.Apireturn new QueryResult<BaseItemDto>{TotalRecordCount = result.TotalRecordCount,- Items = dtoList.ToArray(dtoList.Count)+ Items = dtoList};}diff --git a/MediaBrowser.Api/System/SystemService.cs b/MediaBrowser.Api/System/SystemService.csindex cbff7cc2ec..edb9f063dd 100644--- a/MediaBrowser.Api/System/SystemService.cs+++ b/MediaBrowser.Api/System/SystemService.cs@@ -60,7 +60,7 @@ namespace MediaBrowser.Api.System[Route("/System/Logs", "GET", Summary = "Gets a list of available server log files")][Authenticated(Roles = "Admin")]- public class GetServerLogs : IReturn<List<LogFile>>+ public class GetServerLogs : IReturn<LogFile[]>{}@@ -126,7 +126,7 @@ namespace MediaBrowser.Api.System}catch (IOException){- files = new List<FileSystemMetadata>();+ files = new FileSystemMetadata[]{};}var result = files.Select(i => new LogFile@@ -139,7 +139,7 @@ namespace MediaBrowser.Api.System}).OrderByDescending(i => i.DateModified).ThenByDescending(i => i.DateCreated).ThenBy(i => i.Name)- .ToList();+ .ToArray();return ToOptimizedResult(result);}diff --git a/MediaBrowser.Api/TvShowsService.cs b/MediaBrowser.Api/TvShowsService.csindex 148e65b492..cd0c5d9e51 100644--- a/MediaBrowser.Api/TvShowsService.cs+++ b/MediaBrowser.Api/TvShowsService.cs@@ -22,7 +22,7 @@ namespace MediaBrowser.Api/// Class GetNextUpEpisodes/// </summary>[Route("/Shows/NextUp", "GET", Summary = "Gets a list of next up episodes")]- public class GetNextUpEpisodes : IReturn<ItemsResult>, IHasDtoOptions+ public class GetNextUpEpisodes : IReturn<QueryResult<BaseItemDto>>, IHasDtoOptions{/// <summary>/// Gets or sets the user id.@@ -82,7 +82,7 @@ namespace MediaBrowser.Api}[Route("/Shows/Upcoming", "GET", Summary = "Gets a list of upcoming episodes")]- public class GetUpcomingEpisodes : IReturn<ItemsResult>, IHasDtoOptions+ public class GetUpcomingEpisodes : IReturn<QueryResult<BaseItemDto>>, IHasDtoOptions{/// <summary>/// Gets or sets the user id.@@ -138,7 +138,7 @@ namespace MediaBrowser.Api}[Route("/Shows/{Id}/Episodes", "GET", Summary = "Gets episodes for a tv season")]- public class GetEpisodes : IReturn<ItemsResult>, IHasItemFields, IHasDtoOptions+ public class GetEpisodes : IReturn<QueryResult<BaseItemDto>>, IHasItemFields, IHasDtoOptions{/// <summary>/// Gets or sets the user id.@@ -206,7 +206,7 @@ namespace MediaBrowser.Api}[Route("/Shows/{Id}/Seasons", "GET", Summary = "Gets seasons for a tv series")]- public class GetSeasons : IReturn<ItemsResult>, IHasItemFields, IHasDtoOptions+ public class GetSeasons : IReturn<QueryResult<BaseItemDto>>, IHasItemFields, IHasDtoOptions{/// <summary>/// Gets or sets the user id.@@ -327,7 +327,7 @@ namespace MediaBrowser.Apivar result = new QueryResult<BaseItemDto>{- Items = returnList.ToArray(returnList.Count),+ Items = returnList,TotalRecordCount = itemsResult.Count};@@ -359,10 +359,9 @@ namespace MediaBrowser.Api});- var returnList = (await _dtoService.GetBaseItemDtos(itemsResult, options, user).ConfigureAwait(false));- var returnItems = returnList.ToArray(returnList.Count);+ var returnItems = (await _dtoService.GetBaseItemDtos(itemsResult, options, user).ConfigureAwait(false));- var result = new ItemsResult+ var result = new QueryResult<BaseItemDto>{TotalRecordCount = itemsResult.Count,Items = returnItems@@ -392,10 +391,9 @@ namespace MediaBrowser.Apivar user = _userManager.GetUserById(request.UserId);- var returnList = (await _dtoService.GetBaseItemDtos(result.Items, options, user).ConfigureAwait(false));- var returnItems = returnList.ToArray(returnList.Count);+ var returnItems = (await _dtoService.GetBaseItemDtos(result.Items, options, user).ConfigureAwait(false));- return ToOptimizedSerializedResultUsingCache(new ItemsResult+ return ToOptimizedSerializedResultUsingCache(new QueryResult<BaseItemDto>{TotalRecordCount = result.TotalRecordCount,Items = returnItems@@ -443,14 +441,13 @@ namespace MediaBrowser.ApiIsSpecialSeason = request.IsSpecialSeason,AdjacentTo = request.AdjacentTo- })).OfType<Season>();+ }));var dtoOptions = GetDtoOptions(_authContext, request);- var returnList = (await _dtoService.GetBaseItemDtos(seasons, dtoOptions, user).ConfigureAwait(false));- var returnItems = returnList.ToArray(returnList.Count);+ var returnItems = (await _dtoService.GetBaseItemDtos(seasons, dtoOptions, user).ConfigureAwait(false));- return new ItemsResult+ return new QueryResult<BaseItemDto>{TotalRecordCount = returnItems.Length,Items = returnItems@@ -471,7 +468,7 @@ namespace MediaBrowser.Api{var user = _userManager.GetUserById(request.UserId);- IEnumerable<Episode> episodes;+ List<BaseItem> episodes;var dtoOptions = GetDtoOptions(_authContext, request);@@ -499,11 +496,11 @@ namespace MediaBrowser.Apiif (season == null){- episodes = new List<Episode>();+ episodes = new List<BaseItem>();}else{- episodes = season.GetEpisodes(user, dtoOptions);+ episodes = ((Season)season).GetEpisodes(user, dtoOptions);}}else@@ -515,44 +512,44 @@ namespace MediaBrowser.Apithrow new ResourceNotFoundException("Series not found");}- episodes = series.GetEpisodes(user, dtoOptions);+ episodes = series.GetEpisodes(user, dtoOptions).ToList();}// Filter after the fact in case the ui doesn't want themif (request.IsMissing.HasValue){var val = request.IsMissing.Value;- episodes = episodes.Where(i => i.IsMissingEpisode == val);+ episodes = episodes.Where(i => ((Episode)i).IsMissingEpisode == val).ToList();}if (!string.IsNullOrWhiteSpace(request.StartItemId)){- episodes = episodes.SkipWhile(i => !string.Equals(i.Id.ToString("N"), request.StartItemId, StringComparison.OrdinalIgnoreCase));+ episodes = episodes.SkipWhile(i => !string.Equals(i.Id.ToString("N"), request.StartItemId, StringComparison.OrdinalIgnoreCase)).ToList();}- IEnumerable<BaseItem> returnItems = episodes;-// This must be the last filterif (!string.IsNullOrEmpty(request.AdjacentTo)){- returnItems = UserViewBuilder.FilterForAdjacency(returnItems, request.AdjacentTo);+ episodes = UserViewBuilder.FilterForAdjacency(episodes, request.AdjacentTo).ToList();}if (string.Equals(request.SortBy, ItemSortBy.Random, StringComparison.OrdinalIgnoreCase)){- returnItems = returnItems.OrderBy(i => Guid.NewGuid());+ episodes = episodes.OrderBy(i => Guid.NewGuid()).ToList();}- var returnList = returnItems.ToList();+ var returnItems = episodes;- var pagedItems = ApplyPaging(returnList, request.StartIndex, request.Limit);+ if (request.StartIndex.HasValue || request.Limit.HasValue)+ {+ returnItems = ApplyPaging(episodes, request.StartIndex, request.Limit).ToList();+ }- var returnDtos = (await _dtoService.GetBaseItemDtos(pagedItems, dtoOptions, user).ConfigureAwait(false));- var dtos = returnDtos.ToArray(returnDtos.Count);+ var dtos = (await _dtoService.GetBaseItemDtos(returnItems, dtoOptions, user).ConfigureAwait(false));- return new ItemsResult+ return new QueryResult<BaseItemDto>{- TotalRecordCount = returnList.Count,+ TotalRecordCount = episodes.Count,Items = dtos};}diff --git a/MediaBrowser.Api/UserLibrary/BaseItemsByNameService.cs b/MediaBrowser.Api/UserLibrary/BaseItemsByNameService.csindex 30e64d89d1..1d0065c7cf 100644--- a/MediaBrowser.Api/UserLibrary/BaseItemsByNameService.cs+++ b/MediaBrowser.Api/UserLibrary/BaseItemsByNameService.cs@@ -88,7 +88,7 @@ namespace MediaBrowser.Api.UserLibraryreturn null;}- protected ItemsResult GetResultSlim(GetItemsByName request)+ protected QueryResult<BaseItemDto> GetResultSlim(GetItemsByName request){var dtoOptions = GetDtoOptions(AuthorizationContext, request);@@ -209,7 +209,7 @@ namespace MediaBrowser.Api.UserLibraryreturn dto;});- return new ItemsResult+ return new QueryResult<BaseItemDto>{Items = dtos.ToArray(result.Items.Length),TotalRecordCount = result.TotalRecordCount@@ -240,7 +240,7 @@ namespace MediaBrowser.Api.UserLibrary/// </summary>/// <param name="request">The request.</param>/// <returns>Task{ItemsResult}.</returns>- protected ItemsResult GetResult(GetItemsByName request)+ protected QueryResult<BaseItemDto> GetResult(GetItemsByName request){var dtoOptions = GetDtoOptions(AuthorizationContext, request);@@ -305,7 +305,7 @@ namespace MediaBrowser.Api.UserLibraryIEnumerable<BaseItem> ibnItems = ibnItemsArray;- var result = new ItemsResult+ var result = new QueryResult<BaseItemDto>{TotalRecordCount = ibnItemsArray.Count};@@ -357,13 +357,13 @@ namespace MediaBrowser.Api.UserLibraryitems = items.Where(i => string.Compare(request.NameLessThan, i.SortName, StringComparison.CurrentCultureIgnoreCase) == 1);}- var imageTypes = request.GetImageTypes().ToList();- if (imageTypes.Count > 0)+ var imageTypes = request.GetImageTypes();+ if (imageTypes.Length > 0){items = items.Where(item => imageTypes.Any(item.HasImage));}- var filters = request.GetFilters().ToList();+ var filters = request.GetFilters();if (filters.Contains(ItemFilter.Dislikes)){@@ -506,7 +506,7 @@ namespace MediaBrowser.Api.UserLibrary/// <summary>/// Class GetItemsByName/// </summary>- public class GetItemsByName : BaseItemsRequest, IReturn<ItemsResult>+ public class GetItemsByName : BaseItemsRequest, IReturn<QueryResult<BaseItemDto>>{public GetItemsByName(){diff --git a/MediaBrowser.Api/UserLibrary/BaseItemsRequest.cs b/MediaBrowser.Api/UserLibrary/BaseItemsRequest.csindex a9c5ae700d..66aa35de9c 100644--- a/MediaBrowser.Api/UserLibrary/BaseItemsRequest.cs+++ b/MediaBrowser.Api/UserLibrary/BaseItemsRequest.cs@@ -435,7 +435,7 @@ namespace MediaBrowser.Api.UserLibrary/// Gets the filters./// </summary>/// <returns>IEnumerable{ItemFilter}.</returns>- public IEnumerable<ItemFilter> GetFilters()+ public ItemFilter[] GetFilters(){var val = Filters;@@ -444,7 +444,7 @@ namespace MediaBrowser.Api.UserLibraryreturn new ItemFilter[] { };}- return val.Split(',').Select(v => (ItemFilter)Enum.Parse(typeof(ItemFilter), v, true));+ return val.Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries).Select(v => (ItemFilter)Enum.Parse(typeof(ItemFilter), v, true)).ToArray();}/// <summary>diff --git a/MediaBrowser.Api/UserLibrary/ItemsService.cs b/MediaBrowser.Api/UserLibrary/ItemsService.csindex f3d7772fca..9dd5aa5651 100644--- a/MediaBrowser.Api/UserLibrary/ItemsService.cs+++ b/MediaBrowser.Api/UserLibrary/ItemsService.cs@@ -10,6 +10,7 @@ using System.Globalization;using System.Linq;using System.Threading.Tasks;using MediaBrowser.Controller.Entities.Audio;+using MediaBrowser.Model.Dto;using MediaBrowser.Model.Globalization;using MediaBrowser.Model.Services;using MediaBrowser.Model.Extensions;@@ -21,7 +22,7 @@ namespace MediaBrowser.Api.UserLibrary/// </summary>[Route("/Items", "GET", Summary = "Gets items based on a query.")][Route("/Users/{UserId}/Items", "GET", Summary = "Gets items based on a query.")]- public class GetItems : BaseItemsRequest, IReturn<ItemsResult>+ public class GetItems : BaseItemsRequest, IReturn<QueryResult<BaseItemDto>>{}@@ -100,7 +101,7 @@ namespace MediaBrowser.Api.UserLibrary/// </summary>/// <param name="request">The request.</param>/// <returns>Task{ItemsResult}.</returns>- private async Task<ItemsResult> GetItems(GetItems request)+ private async Task<QueryResult<BaseItemDto>> GetItems(GetItems request){var user = !string.IsNullOrWhiteSpace(request.UserId) ? _userManager.GetUserById(request.UserId) : null;@@ -125,10 +126,10 @@ namespace MediaBrowser.Api.UserLibrarythrow new InvalidOperationException("GetBaseItemDtos returned null");}- return new ItemsResult+ return new QueryResult<BaseItemDto>{TotalRecordCount = result.TotalRecordCount,- Items = dtoList.ToArray(dtoList.Count)+ Items = dtoList};}@@ -180,9 +181,7 @@ namespace MediaBrowser.Api.UserLibraryreturn folder.GetItems(GetItemsQuery(request, dtoOptions, user));}- IEnumerable<BaseItem> items = folder.GetChildren(user, true);-- var itemsArray = items.ToArray();+ var itemsArray = folder.GetChildren(user, true).ToArray();return new QueryResult<BaseItem>{@@ -332,13 +331,11 @@ namespace MediaBrowser.Api.UserLibraryif (!string.IsNullOrEmpty(request.LocationTypes)){var requestedLocationTypes =- request.LocationTypes.Split(',')- .Select(d => (LocationType)Enum.Parse(typeof(LocationType), d, true))- .ToList();+ request.LocationTypes.Split(',');- if (requestedLocationTypes.Count > 0 && requestedLocationTypes.Count < 4)+ if (requestedLocationTypes.Length > 0 && requestedLocationTypes.Length < 4){- query.IsVirtualItem = requestedLocationTypes.Contains(LocationType.Virtual);+ query.IsVirtualItem = requestedLocationTypes.Contains(LocationType.Virtual.ToString());}}diff --git a/MediaBrowser.Api/UserLibrary/UserLibraryService.cs b/MediaBrowser.Api/UserLibrary/UserLibraryService.csindex ee11626870..87a06e4d59 100644--- a/MediaBrowser.Api/UserLibrary/UserLibraryService.cs+++ b/MediaBrowser.Api/UserLibrary/UserLibraryService.cs@@ -59,7 +59,7 @@ namespace MediaBrowser.Api.UserLibrary/// Class GetIntros/// </summary>[Route("/Users/{UserId}/Items/{Id}/Intros", "GET", Summary = "Gets intros to play before the main media item plays")]- public class GetIntros : IReturn<ItemsResult>+ public class GetIntros : IReturn<QueryResult<BaseItemDto>>{/// <summary>/// Gets or sets the user id.@@ -171,7 +171,7 @@ namespace MediaBrowser.Api.UserLibrary/// Class GetLocalTrailers/// </summary>[Route("/Users/{UserId}/Items/{Id}/LocalTrailers", "GET", Summary = "Gets local trailers for an item")]- public class GetLocalTrailers : IReturn<List<BaseItemDto>>+ public class GetLocalTrailers : IReturn<BaseItemDto[]>{/// <summary>/// Gets or sets the user id.@@ -192,7 +192,7 @@ namespace MediaBrowser.Api.UserLibrary/// Class GetSpecialFeatures/// </summary>[Route("/Users/{UserId}/Items/{Id}/SpecialFeatures", "GET", Summary = "Gets special features for an item")]- public class GetSpecialFeatures : IReturn<List<BaseItemDto>>+ public class GetSpecialFeatures : IReturn<BaseItemDto[]>{/// <summary>/// Gets or sets the user id.@@ -210,7 +210,7 @@ namespace MediaBrowser.Api.UserLibrary}[Route("/Users/{UserId}/Items/Latest", "GET", Summary = "Gets latest media")]- public class GetLatestMedia : IReturn<List<BaseItemDto>>, IHasDtoOptions+ public class GetLatestMedia : IReturn<BaseItemDto[]>, IHasDtoOptions{/// <summary>/// Gets or sets the user id.@@ -338,10 +338,10 @@ namespace MediaBrowser.Api.UserLibraryreturn dto;});- return ToOptimizedResult(dtos.ToList());+ return ToOptimizedResult(dtos.ToArray());}- private List<BaseItemDto> GetAsync(GetSpecialFeatures request)+ private BaseItemDto[] GetAsync(GetSpecialFeatures request){var user = _userManager.GetUserById(request.UserId);@@ -364,7 +364,7 @@ namespace MediaBrowser.Api.UserLibrary.Where(i => i.ParentIndexNumber.HasValue && i.ParentIndexNumber.Value == 0).Select(i => _dtoService.GetBaseItemDto(i, dtoOptions, currentUser));- return dtos.ToList();+ return dtos.ToArray();}var movie = item as IHasSpecialFeatures;@@ -379,10 +379,10 @@ namespace MediaBrowser.Api.UserLibrary.OrderBy(i => i.SortName).Select(i => _dtoService.GetBaseItemDto(i, dtoOptions, user, item));- return dtos.ToList();+ return dtos.ToArray();}- return new List<BaseItemDto>();+ return new BaseItemDto[] { };}/// <summary>@@ -396,19 +396,24 @@ namespace MediaBrowser.Api.UserLibraryvar item = string.IsNullOrEmpty(request.Id) ? user.RootFolder : _libraryManager.GetItemById(request.Id);- var trailerIds = new List<Guid>();+ List<Guid> trailerIds = null;var hasTrailers = item as IHasTrailers;if (hasTrailers != null){trailerIds = hasTrailers.GetTrailerIds();}+ else+ {+ trailerIds = new List<Guid>();+ }var dtoOptions = GetDtoOptions(_authContext, request);var dtos = trailerIds.Select(_libraryManager.GetItemById)- .Select(i => _dtoService.GetBaseItemDto(i, dtoOptions, user, item));+ .Select(i => _dtoService.GetBaseItemDto(i, dtoOptions, user, item))+ .ToArray();return ToOptimizedSerializedResultUsingCache(dtos);}@@ -489,7 +494,7 @@ namespace MediaBrowser.Api.UserLibraryvar dtos = items.Select(i => _dtoService.GetBaseItemDto(i, dtoOptions, user)).ToArray();- var result = new ItemsResult+ var result = new QueryResult<BaseItemDto>{Items = dtos,TotalRecordCount = dtos.Lengthdiff --git a/MediaBrowser.Api/UserLibrary/UserViewsService.cs b/MediaBrowser.Api/UserLibrary/UserViewsService.csindex 3ed5166a4b..096157e47f 100644--- a/MediaBrowser.Api/UserLibrary/UserViewsService.cs+++ b/MediaBrowser.Api/UserLibrary/UserViewsService.cs@@ -12,6 +12,7 @@ using System.Threading;using System.Threading.Tasks;using MediaBrowser.Controller.Net;using MediaBrowser.Model.Services;+using MediaBrowser.Model.Extensions;namespace MediaBrowser.Api.UserLibrary{@@ -32,7 +33,7 @@ namespace MediaBrowser.Api.UserLibrary}[Route("/Users/{UserId}/GroupingOptions", "GET")]- public class GetGroupingOptions : IReturn<List<SpecialViewOption>>+ public class GetGroupingOptions : IReturn<SpecialViewOption[]>{/// <summary>/// Gets or sets the user id.@@ -84,10 +85,13 @@ namespace MediaBrowser.Api.UserLibraryvar folders = await _userViewManager.GetUserViews(query, CancellationToken.None).ConfigureAwait(false);var dtoOptions = GetDtoOptions(_authContext, request);- dtoOptions.Fields.Add(ItemFields.PrimaryImageAspectRatio);- dtoOptions.Fields.Add(ItemFields.DisplayPreferencesId);- dtoOptions.Fields.Remove(ItemFields.SyncInfo);- dtoOptions.Fields.Remove(ItemFields.BasicSyncInfo);+ var fields = dtoOptions.Fields.ToList();++ fields.Add(ItemFields.PrimaryImageAspectRatio);+ fields.Add(ItemFields.DisplayPreferencesId);+ fields.Remove(ItemFields.SyncInfo);+ fields.Remove(ItemFields.BasicSyncInfo);+ dtoOptions.Fields = fields.ToArray(fields.Count);var user = _userManager.GetUserById(request.UserId);@@ -107,13 +111,10 @@ namespace MediaBrowser.Api.UserLibrary{var user = _userManager.GetUserById(request.UserId);- var views = user.RootFolder+ var list = user.RootFolder.GetChildren(user, true).OfType<Folder>().Where(UserView.IsEligibleForGrouping)- .ToList();-- var list = views.Select(i => new SpecialViewOption{Name = i.Name,@@ -121,7 +122,7 @@ namespace MediaBrowser.Api.UserLibrary}).OrderBy(i => i.Name)- .ToList();+ .ToArray();return ToOptimizedResult(list);}diff --git a/MediaBrowser.Api/UserService.cs b/MediaBrowser.Api/UserService.csindex 49b7f6c15e..acdbf96f42 100644--- a/MediaBrowser.Api/UserService.cs+++ b/MediaBrowser.Api/UserService.cs@@ -22,7 +22,7 @@ namespace MediaBrowser.Api/// </summary>[Route("/Users", "GET", Summary = "Gets a list of users")][Authenticated]- public class GetUsers : IReturn<List<UserDto>>+ public class GetUsers : IReturn<UserDto[]>{[ApiMember(Name = "IsHidden", Description = "Optional filter by IsHidden=true or false", IsRequired = false, DataType = "bool", ParameterType = "query", Verb = "GET")]public bool? IsHidden { get; set; }@@ -35,7 +35,7 @@ namespace MediaBrowser.Api}[Route("/Users/Public", "GET", Summary = "Gets a list of publicly visible users for display on a login screen.")]- public class GetPublicUsers : IReturn<List<UserDto>>+ public class GetPublicUsers : IReturn<UserDto[]>{}@@ -329,7 +329,7 @@ namespace MediaBrowser.Apivar result = users.OrderBy(u => u.Name).Select(i => _userManager.GetUserDto(i, Request.RemoteIp))- .ToList();+ .ToArray();return ToOptimizedResult(result);}diff --git a/MediaBrowser.Api/VideosService.cs b/MediaBrowser.Api/VideosService.csindex 57d3d7e394..dc7d098634 100644--- a/MediaBrowser.Api/VideosService.cs+++ b/MediaBrowser.Api/VideosService.cs@@ -19,7 +19,7 @@ namespace MediaBrowser.Api{[Route("/Videos/{Id}/AdditionalParts", "GET", Summary = "Gets additional parts for a video.")][Authenticated]- public class GetAdditionalParts : IReturn<ItemsResult>+ public class GetAdditionalParts : IReturn<QueryResult<BaseItemDto>>{[ApiMember(Name = "UserId", Description = "Optional. Filter by user id, and attach user data", IsRequired = false, DataType = "string", ParameterType = "query", Verb = "GET")]public string UserId { get; set; }@@ -99,7 +99,7 @@ namespace MediaBrowser.Apiitems = new BaseItemDto[] { };}- var result = new ItemsResult+ var result = new QueryResult<BaseItemDto>{Items = items,TotalRecordCount = items.Lengthdiff --git a/MediaBrowser.Common/Updates/IInstallationManager.cs b/MediaBrowser.Common/Updates/IInstallationManager.csindex 636526567e..ecc2726055 100644--- a/MediaBrowser.Common/Updates/IInstallationManager.cs+++ b/MediaBrowser.Common/Updates/IInstallationManager.cs@@ -48,7 +48,7 @@ namespace MediaBrowser.Common.Updates/// <param name="packageType">Type of the package.</param>/// <param name="applicationVersion">The application version.</param>/// <returns>Task{List{PackageInfo}}.</returns>- Task<IEnumerable<PackageInfo>> GetAvailablePackages(CancellationToken cancellationToken,+ Task<PackageInfo[]> GetAvailablePackages(CancellationToken cancellationToken,bool withRegistration = true,string packageType = null,Version applicationVersion = null);@@ -58,7 +58,7 @@ namespace MediaBrowser.Common.Updates/// </summary>/// <param name="cancellationToken">The cancellation token.</param>/// <returns>Task{List{PackageInfo}}.</returns>- Task<IEnumerable<PackageInfo>> GetAvailablePackagesWithoutRegistrationInfo(CancellationToken cancellationToken);+ Task<PackageInfo[]> GetAvailablePackagesWithoutRegistrationInfo(CancellationToken cancellationToken);/// <summary>/// Gets the package.diff --git a/MediaBrowser.Controller/Channels/IChannelManager.cs b/MediaBrowser.Controller/Channels/IChannelManager.csindex 824bdf8ffb..46e55a21ce 100644--- a/MediaBrowser.Controller/Channels/IChannelManager.cs+++ b/MediaBrowser.Controller/Channels/IChannelManager.cs@@ -30,7 +30,7 @@ namespace MediaBrowser.Controller.Channels/// Gets all channel features./// </summary>/// <returns>IEnumerable{ChannelFeatures}.</returns>- IEnumerable<ChannelFeatures> GetAllChannelFeatures();+ ChannelFeatures[] GetAllChannelFeatures();/// <summary>/// Gets the channel.diff --git a/MediaBrowser.Controller/Channels/InternalChannelFeatures.cs b/MediaBrowser.Controller/Channels/InternalChannelFeatures.csindex 7d80d7e12a..976808aad9 100644--- a/MediaBrowser.Controller/Channels/InternalChannelFeatures.cs+++ b/MediaBrowser.Controller/Channels/InternalChannelFeatures.cs@@ -58,13 +58,4 @@ namespace MediaBrowser.Controller.ChannelsDefaultSortFields = new List<ChannelItemSortField>();}}-- public class ChannelDownloadException : Exception- {- public ChannelDownloadException(string message)- : base(message)- {-- }- }}diff --git a/MediaBrowser.Controller/Collections/CollectionCreationOptions.cs b/MediaBrowser.Controller/Collections/CollectionCreationOptions.csindex 4a2d390662..7a387e319a 100644--- a/MediaBrowser.Controller/Collections/CollectionCreationOptions.cs+++ b/MediaBrowser.Controller/Collections/CollectionCreationOptions.cs@@ -14,14 +14,14 @@ namespace MediaBrowser.Controller.Collectionspublic Dictionary<string, string> ProviderIds { get; set; }- public List<Guid> ItemIdList { get; set; }- public List<Guid> UserIds { get; set; }+ public string[] ItemIdList { get; set; }+ public string[] UserIds { get; set; }public CollectionCreationOptions(){ProviderIds = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase);- ItemIdList = new List<Guid>();- UserIds = new List<Guid>();+ ItemIdList = new string[] { };+ UserIds = new string[] { };}}}diff --git a/MediaBrowser.Controller/Collections/ICollectionManager.cs b/MediaBrowser.Controller/Collections/ICollectionManager.csindex 89e505579d..0ca7b2e3e5 100644--- a/MediaBrowser.Controller/Collections/ICollectionManager.cs+++ b/MediaBrowser.Controller/Collections/ICollectionManager.cs@@ -36,7 +36,7 @@ namespace MediaBrowser.Controller.Collections/// <param name="collectionId">The collection identifier.</param>/// <param name="itemIds">The item ids.</param>/// <returns>Task.</returns>- Task AddToCollection(Guid collectionId, IEnumerable<Guid> itemIds);+ Task AddToCollection(Guid collectionId, string[] itemIds);/// <summary>/// Removes from collection.@@ -44,7 +44,7 @@ namespace MediaBrowser.Controller.Collections/// <param name="collectionId">The collection identifier.</param>/// <param name="itemIds">The item ids.</param>/// <returns>Task.</returns>- Task RemoveFromCollection(Guid collectionId, IEnumerable<Guid> itemIds);+ Task RemoveFromCollection(Guid collectionId, string[] itemIds);/// <summary>/// Collapses the items within box sets.diff --git a/MediaBrowser.Controller/Dto/DtoOptions.cs b/MediaBrowser.Controller/Dto/DtoOptions.csindex 098ba558f8..f05ae4e713 100644--- a/MediaBrowser.Controller/Dto/DtoOptions.cs+++ b/MediaBrowser.Controller/Dto/DtoOptions.cs@@ -14,8 +14,8 @@ namespace MediaBrowser.Controller.DtoItemFields.RefreshState};- public List<ItemFields> Fields { get; set; }- public List<ImageType> ImageTypes { get; set; }+ public ItemFields[] Fields { get; set; }+ public ImageType[] ImageTypes { get; set; }public int ImageTypeLimit { get; set; }public bool EnableImages { get; set; }public bool AddProgramRecordingInfo { get; set; }@@ -28,6 +28,15 @@ namespace MediaBrowser.Controller.Dto{}+ private static readonly ImageType[] AllImageTypes = Enum.GetNames(typeof(ImageType))+ .Select(i => (ImageType)Enum.Parse(typeof(ImageType), i, true))+ .ToArray();++ private static readonly ItemFields[] AllItemFields = Enum.GetNames(typeof(ItemFields))+ .Select(i => (ItemFields)Enum.Parse(typeof(ItemFields), i, true))+ .Except(DefaultExcludedFields)+ .ToArray();+public DtoOptions(bool allFields){ImageTypeLimit = int.MaxValue;@@ -37,19 +46,14 @@ namespace MediaBrowser.Controller.Dtoif (allFields){- Fields = Enum.GetNames(typeof(ItemFields))- .Select(i => (ItemFields)Enum.Parse(typeof(ItemFields), i, true))- .Except(DefaultExcludedFields)- .ToList();+ Fields = AllItemFields;}else{- Fields = new List<ItemFields>();+ Fields = new ItemFields[] { };}- ImageTypes = Enum.GetNames(typeof(ImageType))- .Select(i => (ImageType)Enum.Parse(typeof(ImageType), i, true))- .ToList();+ ImageTypes = AllImageTypes;}public int GetImageLimit(ImageType type)diff --git a/MediaBrowser.Controller/Dto/IDtoService.cs b/MediaBrowser.Controller/Dto/IDtoService.csindex 963092f522..76ecd81803 100644--- a/MediaBrowser.Controller/Dto/IDtoService.cs+++ b/MediaBrowser.Controller/Dto/IDtoService.cs@@ -41,7 +41,7 @@ namespace MediaBrowser.Controller.Dto/// <param name="user">The user.</param>/// <param name="owner">The owner.</param>/// <returns>Task{BaseItemDto}.</returns>- BaseItemDto GetBaseItemDto(BaseItem item, List<ItemFields> fields, User user = null, BaseItem owner = null);+ BaseItemDto GetBaseItemDto(BaseItem item, ItemFields[] fields, User user = null, BaseItem owner = null);/// <summary>/// Gets the base item dto.@@ -61,9 +61,10 @@ namespace MediaBrowser.Controller.Dto/// <param name="user">The user.</param>/// <param name="owner">The owner.</param>/// <returns>IEnumerable<BaseItemDto>.</returns>- Task<List<BaseItemDto>> GetBaseItemDtos(IEnumerable<BaseItem> items, DtoOptions options, User user = null,- BaseItem owner = null);-+ Task<BaseItemDto[]> GetBaseItemDtos(BaseItem[] items, DtoOptions options, User user = null, BaseItem owner = null);++ Task<BaseItemDto[]> GetBaseItemDtos(List<BaseItem> items, DtoOptions options, User user = null, BaseItem owner = null);+/// <summary>/// Gets the chapter information dto./// </summary>diff --git a/MediaBrowser.Controller/Entities/BaseItem.cs b/MediaBrowser.Controller/Entities/BaseItem.csindex a6418418e1..c158378a67 100644--- a/MediaBrowser.Controller/Entities/BaseItem.cs+++ b/MediaBrowser.Controller/Entities/BaseItem.cs@@ -2265,7 +2265,7 @@ namespace MediaBrowser.Controller.Entitiesreturn path;}- public virtual void FillUserDataDtoValues(UserItemDataDto dto, UserItemData userData, BaseItemDto itemDto, User user, List<ItemFields> fields)+ public virtual void FillUserDataDtoValues(UserItemDataDto dto, UserItemData userData, BaseItemDto itemDto, User user, ItemFields[] fields){if (RunTimeTicks.HasValue){diff --git a/MediaBrowser.Controller/Entities/Folder.cs b/MediaBrowser.Controller/Entities/Folder.csindex 46ae9230b7..b088347842 100644--- a/MediaBrowser.Controller/Entities/Folder.cs+++ b/MediaBrowser.Controller/Entities/Folder.cs@@ -711,7 +711,7 @@ namespace MediaBrowser.Controller.Entities{if (!(this is ICollectionFolder)){- return GetChildren(user, true).Count();+ return GetChildren(user, true).Count;}}@@ -792,16 +792,16 @@ namespace MediaBrowser.Controller.Entitiesquery.StartIndex = null;query.Limit = null;- IEnumerable<BaseItem> itemsList = LibraryManager.GetItemList(query);+ var itemsList = LibraryManager.GetItemList(query);var user = query.User;if (user != null){// needed for boxsets- itemsList = itemsList.Where(i => i.IsVisibleStandalone(query.User));+ itemsList = itemsList.Where(i => i.IsVisibleStandalone(query.User)).ToList();}- IEnumerable<BaseItem> returnItems;+ BaseItem[] returnItems;int totalCount = 0;if (query.EnableTotalRecordCount)@@ -812,16 +812,16 @@ namespace MediaBrowser.Controller.Entities}else{- returnItems = itemsList;+ returnItems = itemsList.ToArray();}if (limit.HasValue){- returnItems = returnItems.Skip(startIndex ?? 0).Take(limit.Value);+ returnItems = returnItems.Skip(startIndex ?? 0).Take(limit.Value).ToArray();}else if (startIndex.HasValue){- returnItems = returnItems.Skip(startIndex.Value);+ returnItems = returnItems.Skip(startIndex.Value).ToArray();}return new QueryResult<BaseItem>@@ -1044,7 +1044,7 @@ namespace MediaBrowser.Controller.Entitiesreturn UserViewBuilder.PostFilterAndSort(items, this, null, query, LibraryManager, ConfigurationManager, collapseBoxSetItems, enableSorting);}- public virtual IEnumerable<BaseItem> GetChildren(User user, bool includeLinkedChildren)+ public virtual List<BaseItem> GetChildren(User user, bool includeLinkedChildren){if (user == null){@@ -1058,7 +1058,7 @@ namespace MediaBrowser.Controller.EntitiesAddChildren(user, includeLinkedChildren, result, false, null);- return result.Values;+ return result.Values.ToList();}protected virtual IEnumerable<BaseItem> GetEligibleChildrenForRecursiveChildren(User user)@@ -1477,7 +1477,7 @@ namespace MediaBrowser.Controller.Entities}}- public override void FillUserDataDtoValues(UserItemDataDto dto, UserItemData userData, BaseItemDto itemDto, User user, List<ItemFields> fields)+ public override void FillUserDataDtoValues(UserItemDataDto dto, UserItemData userData, BaseItemDto itemDto, User user, ItemFields[] fields){if (!SupportsUserDataFromChildren){diff --git a/MediaBrowser.Controller/Entities/IHasUserData.cs b/MediaBrowser.Controller/Entities/IHasUserData.csindex ce4a482baf..ab4f624e21 100644--- a/MediaBrowser.Controller/Entities/IHasUserData.cs+++ b/MediaBrowser.Controller/Entities/IHasUserData.cs@@ -16,7 +16,7 @@ namespace MediaBrowser.Controller.Entities/// <summary>/// Fills the user data dto values./// </summary>- void FillUserDataDtoValues(UserItemDataDto dto, UserItemData userData, BaseItemDto itemDto, User user, List<ItemFields> fields);+ void FillUserDataDtoValues(UserItemDataDto dto, UserItemData userData, BaseItemDto itemDto, User user, ItemFields[] fields);bool EnableRememberingTrackSelections { get; }diff --git a/MediaBrowser.Controller/Entities/Movies/BoxSet.cs b/MediaBrowser.Controller/Entities/Movies/BoxSet.csindex 6ba9577d17..376f65d60d 100644--- a/MediaBrowser.Controller/Entities/Movies/BoxSet.cs+++ b/MediaBrowser.Controller/Entities/Movies/BoxSet.cs@@ -170,24 +170,24 @@ namespace MediaBrowser.Controller.Entities.MoviesStringComparison.OrdinalIgnoreCase);}- public override IEnumerable<BaseItem> GetChildren(User user, bool includeLinkedChildren)+ public override List<BaseItem> GetChildren(User user, bool includeLinkedChildren){var children = base.GetChildren(user, includeLinkedChildren);if (string.Equals(DisplayOrder, ItemSortBy.SortName, StringComparison.OrdinalIgnoreCase)){// Sort by name- return LibraryManager.Sort(children, user, new[] { ItemSortBy.SortName }, SortOrder.Ascending);+ return LibraryManager.Sort(children, user, new[] { ItemSortBy.SortName }, SortOrder.Ascending).ToList();}if (string.Equals(DisplayOrder, ItemSortBy.PremiereDate, StringComparison.OrdinalIgnoreCase)){// Sort by release date- return LibraryManager.Sort(children, user, new[] { ItemSortBy.ProductionYear, ItemSortBy.PremiereDate, ItemSortBy.SortName }, SortOrder.Ascending);+ return LibraryManager.Sort(children, user, new[] { ItemSortBy.ProductionYear, ItemSortBy.PremiereDate, ItemSortBy.SortName }, SortOrder.Ascending).ToList();}// Default sorting- return LibraryManager.Sort(children, user, new[] { ItemSortBy.ProductionYear, ItemSortBy.PremiereDate, ItemSortBy.SortName }, SortOrder.Ascending);+ return LibraryManager.Sort(children, user, new[] { ItemSortBy.ProductionYear, ItemSortBy.PremiereDate, ItemSortBy.SortName }, SortOrder.Ascending).ToList();}public BoxSetInfo GetLookupInfo()diff --git a/MediaBrowser.Controller/Entities/TV/Season.cs b/MediaBrowser.Controller/Entities/TV/Season.csindex b681fdcb10..8b934bc475 100644--- a/MediaBrowser.Controller/Entities/TV/Season.cs+++ b/MediaBrowser.Controller/Entities/TV/Season.cs@@ -160,27 +160,27 @@ namespace MediaBrowser.Controller.Entities.TV/// <summary>/// Gets the episodes./// </summary>- public IEnumerable<Episode> GetEpisodes(User user, DtoOptions options)+ public List<BaseItem> GetEpisodes(User user, DtoOptions options){return GetEpisodes(Series, user, options);}- public IEnumerable<Episode> GetEpisodes(Series series, User user, DtoOptions options)+ public List<BaseItem> GetEpisodes(Series series, User user, DtoOptions options){return GetEpisodes(series, user, null, options);}- public IEnumerable<Episode> GetEpisodes(Series series, User user, IEnumerable<Episode> allSeriesEpisodes, DtoOptions options)+ public List<BaseItem> GetEpisodes(Series series, User user, IEnumerable<Episode> allSeriesEpisodes, DtoOptions options){return series.GetSeasonEpisodes(this, user, allSeriesEpisodes, options);}- public IEnumerable<Episode> GetEpisodes()+ public List<BaseItem> GetEpisodes(){return Series.GetSeasonEpisodes(this, null, null, new DtoOptions(true));}- public override IEnumerable<BaseItem> GetChildren(User user, bool includeLinkedChildren)+ public override List<BaseItem> GetChildren(User user, bool includeLinkedChildren){return GetEpisodes(user, new DtoOptions(true));}diff --git a/MediaBrowser.Controller/Entities/TV/Series.cs b/MediaBrowser.Controller/Entities/TV/Series.csindex 3350a65799..545e8518ae 100644--- a/MediaBrowser.Controller/Entities/TV/Series.cs+++ b/MediaBrowser.Controller/Entities/TV/Series.cs@@ -152,12 +152,8 @@ namespace MediaBrowser.Controller.Entities.TVIncludeItemTypes = new[] { typeof(Season).Name },IsVirtualItem = false,Limit = 0,- DtoOptions = new Dto.DtoOptions+ DtoOptions = new Dto.DtoOptions(false){- Fields = new List<ItemFields>- {-- },EnableImages = false}});@@ -173,12 +169,8 @@ namespace MediaBrowser.Controller.Entities.TV{AncestorWithPresentationUniqueKey = null,SeriesPresentationUniqueKey = seriesKey,- DtoOptions = new Dto.DtoOptions+ DtoOptions = new Dto.DtoOptions(false){- Fields = new List<ItemFields>- {-- },EnableImages = false}};@@ -226,12 +218,12 @@ namespace MediaBrowser.Controller.Entities.TV}}- public override IEnumerable<BaseItem> GetChildren(User user, bool includeLinkedChildren)+ public override List<BaseItem> GetChildren(User user, bool includeLinkedChildren){return GetSeasons(user, new DtoOptions(true));}- public IEnumerable<Season> GetSeasons(User user, DtoOptions options)+ public List<BaseItem> GetSeasons(User user, DtoOptions options){var query = new InternalItemsQuery(user){@@ -240,7 +232,7 @@ namespace MediaBrowser.Controller.Entities.TVSetSeasonQueryOptions(query, user);- return LibraryManager.GetItemList(query).Cast<Season>();+ return LibraryManager.GetItemList(query);}private void SetSeasonQueryOptions(InternalItemsQuery query, User user)@@ -292,7 +284,7 @@ namespace MediaBrowser.Controller.Entities.TVreturn LibraryManager.GetItemsResult(query);}- public IEnumerable<Episode> GetEpisodes(User user, DtoOptions options)+ public IEnumerable<BaseItem> GetEpisodes(User user, DtoOptions options){var seriesKey = GetUniqueSeriesKey(this);@@ -312,7 +304,7 @@ namespace MediaBrowser.Controller.Entities.TVvar allItems = LibraryManager.GetItemList(query);- var allSeriesEpisodes = allItems.OfType<Episode>();+ var allSeriesEpisodes = allItems.OfType<Episode>().ToList();var allEpisodes = allItems.OfType<Season>().SelectMany(i => i.GetEpisodes(this, user, allSeriesEpisodes, options))@@ -396,7 +388,7 @@ namespace MediaBrowser.Controller.Entities.TVawait ProviderManager.RefreshSingleItem(this, refreshOptions, cancellationToken).ConfigureAwait(false);}- public IEnumerable<Episode> GetSeasonEpisodes(Season parentSeason, User user, DtoOptions options)+ public List<BaseItem> GetSeasonEpisodes(Season parentSeason, User user, DtoOptions options){var queryFromSeries = ConfigurationManager.Configuration.DisplaySpecialsWithinSeasons;@@ -422,12 +414,12 @@ namespace MediaBrowser.Controller.Entities.TV}}- var allItems = LibraryManager.GetItemList(query).OfType<Episode>();+ var allItems = LibraryManager.GetItemList(query);return GetSeasonEpisodes(parentSeason, user, allItems, options);}- public IEnumerable<Episode> GetSeasonEpisodes(Season parentSeason, User user, IEnumerable<Episode> allSeriesEpisodes, DtoOptions options)+ public List<BaseItem> GetSeasonEpisodes(Season parentSeason, User user, IEnumerable<BaseItem> allSeriesEpisodes, DtoOptions options){if (allSeriesEpisodes == null){@@ -438,14 +430,13 @@ namespace MediaBrowser.Controller.Entities.TVvar sortBy = (parentSeason.IndexNumber ?? -1) == 0 ? ItemSortBy.SortName : ItemSortBy.AiredEpisodeOrder;- return LibraryManager.Sort(episodes, user, new[] { sortBy }, SortOrder.Ascending)- .Cast<Episode>();+ return LibraryManager.Sort(episodes, user, new[] { sortBy }, SortOrder.Ascending).ToList();}/// <summary>/// Filters the episodes by season./// </summary>- public static IEnumerable<Episode> FilterEpisodesBySeason(IEnumerable<Episode> episodes, Season parentSeason, bool includeSpecials)+ public static IEnumerable<BaseItem> FilterEpisodesBySeason(IEnumerable<BaseItem> episodes, Season parentSeason, bool includeSpecials){var seasonNumber = parentSeason.IndexNumber;var seasonPresentationKey = GetUniqueSeriesKey(parentSeason);@@ -454,7 +445,9 @@ namespace MediaBrowser.Controller.Entities.TVreturn episodes.Where(episode =>{- var currentSeasonNumber = supportSpecialsInSeason ? episode.AiredSeasonNumber : episode.ParentIndexNumber;+ var episodeItem = (Episode) episode;++ var currentSeasonNumber = supportSpecialsInSeason ? episodeItem.AiredSeasonNumber : episode.ParentIndexNumber;if (currentSeasonNumber.HasValue && seasonNumber.HasValue && currentSeasonNumber.Value == seasonNumber.Value){return true;@@ -465,7 +458,7 @@ namespace MediaBrowser.Controller.Entities.TVreturn true;}- var season = episode.Season;+ var season = episodeItem.Season;return season != null && string.Equals(GetUniqueSeriesKey(season), seasonPresentationKey, StringComparison.OrdinalIgnoreCase);});}diff --git a/MediaBrowser.Controller/Entities/UserRootFolder.cs b/MediaBrowser.Controller/Entities/UserRootFolder.csindex d351563450..dd70277a7e 100644--- a/MediaBrowser.Controller/Entities/UserRootFolder.cs+++ b/MediaBrowser.Controller/Entities/UserRootFolder.cs@@ -81,7 +81,7 @@ namespace MediaBrowser.Controller.Entitiespublic override int GetChildCount(User user){- return GetChildren(user, true).Count();+ return GetChildren(user, true).Count;}[IgnoreDataMember]diff --git a/MediaBrowser.Controller/Entities/UserView.cs b/MediaBrowser.Controller/Entities/UserView.csindex 4c44a613b1..7ab4e98fcf 100644--- a/MediaBrowser.Controller/Entities/UserView.cs+++ b/MediaBrowser.Controller/Entities/UserView.cs@@ -80,7 +80,7 @@ namespace MediaBrowser.Controller.Entities.GetUserItems(parent, this, ViewType, query).Result;}- public override IEnumerable<BaseItem> GetChildren(User user, bool includeLinkedChildren)+ public override List<BaseItem> GetChildren(User user, bool includeLinkedChildren){var result = GetItemList(new InternalItemsQuery{@@ -90,7 +90,7 @@ namespace MediaBrowser.Controller.Entities});- return result;+ return result.ToList();}public override bool CanDelete()diff --git a/MediaBrowser.Controller/Entities/UserViewBuilder.cs b/MediaBrowser.Controller/Entities/UserViewBuilder.csindex 9323404e38..acfa239d33 100644--- a/MediaBrowser.Controller/Entities/UserViewBuilder.cs+++ b/MediaBrowser.Controller/Entities/UserViewBuilder.cs@@ -533,7 +533,7 @@ namespace MediaBrowser.Controller.Entitiesreturn ConvertToResult(_libraryManager.GetItemList(query));}- private QueryResult<BaseItem> ConvertToResult(IEnumerable<BaseItem> items)+ private QueryResult<BaseItem> ConvertToResult(List<BaseItem> items){var arr = items.ToArray();return new QueryResult<BaseItem>@@ -789,7 +789,7 @@ namespace MediaBrowser.Controller.Entities// This must be the last filterif (!string.IsNullOrEmpty(query.AdjacentTo)){- items = FilterForAdjacency(items, query.AdjacentTo);+ items = FilterForAdjacency(items.ToList(), query.AdjacentTo);}return SortAndPage(items, totalRecordLimit, query, libraryManager, enableSorting);@@ -1763,10 +1763,8 @@ namespace MediaBrowser.Controller.Entitiesreturn _userViewManager.GetUserSubView(parent.Id.ToString("N"), type, sortName, CancellationToken.None);}- public static IEnumerable<BaseItem> FilterForAdjacency(IEnumerable<BaseItem> items, string adjacentToId)+ public static IEnumerable<BaseItem> FilterForAdjacency(List<BaseItem> list, string adjacentToId){- var list = items.ToList();-var adjacentToIdGuid = new Guid(adjacentToId);var adjacentToItem = list.FirstOrDefault(i => i.Id == adjacentToIdGuid);diff --git a/MediaBrowser.Controller/Entities/Video.cs b/MediaBrowser.Controller/Entities/Video.csindex 3b166db922..fa11787f51 100644--- a/MediaBrowser.Controller/Entities/Video.cs+++ b/MediaBrowser.Controller/Entities/Video.cs@@ -153,14 +153,14 @@ namespace MediaBrowser.Controller.Entities/// Gets the playable stream files./// </summary>/// <returns>List{System.String}.</returns>- public List<string> GetPlayableStreamFiles()+ public string[] GetPlayableStreamFiles(){return GetPlayableStreamFiles(Path);}- public List<string> GetPlayableStreamFileNames()+ public string[] GetPlayableStreamFileNames(){- return GetPlayableStreamFiles().Select(System.IO.Path.GetFileName).ToList(); ;+ return GetPlayableStreamFiles().Select(System.IO.Path.GetFileName).ToArray();}/// <summary>@@ -389,11 +389,11 @@ namespace MediaBrowser.Controller.Entities/// </summary>/// <param name="rootPath">The root path.</param>/// <returns>List{System.String}.</returns>- public List<string> GetPlayableStreamFiles(string rootPath)+ public string[] GetPlayableStreamFiles(string rootPath){if (VideoType == VideoType.VideoFile){- return new List<string>();+ return new string[] { };}var allFiles = FileSystem.GetFilePaths(rootPath, true).ToList();@@ -411,10 +411,10 @@ namespace MediaBrowser.Controller.Entitiesreturn QueryPlayableStreamFiles(rootPath, videoType).Select(name => allFiles.FirstOrDefault(f => string.Equals(System.IO.Path.GetFileName(f), name, StringComparison.OrdinalIgnoreCase))).Where(f => !string.IsNullOrEmpty(f))- .ToList();+ .ToArray();}- public static List<string> QueryPlayableStreamFiles(string rootPath, VideoType videoType)+ public static string[] QueryPlayableStreamFiles(string rootPath, VideoType videoType){if (videoType == VideoType.Dvd){@@ -423,7 +423,7 @@ namespace MediaBrowser.Controller.Entities.ThenBy(i => i.FullName).Take(1).Select(i => i.FullName)- .ToList();+ .ToArray();}if (videoType == VideoType.BluRay){@@ -432,9 +432,9 @@ namespace MediaBrowser.Controller.Entities.ThenBy(i => i.FullName).Take(1).Select(i => i.FullName)- .ToList();+ .ToArray();}- return new List<string>();+ return new string[] { };}/// <summary>diff --git a/MediaBrowser.Controller/Library/IUserDataManager.cs b/MediaBrowser.Controller/Library/IUserDataManager.csindex e9954545ed..b364ab9909 100644--- a/MediaBrowser.Controller/Library/IUserDataManager.cs+++ b/MediaBrowser.Controller/Library/IUserDataManager.cs@@ -40,7 +40,7 @@ namespace MediaBrowser.Controller.Library/// </summary>UserItemDataDto GetUserDataDto(IHasUserData item, User user);- UserItemDataDto GetUserDataDto(IHasUserData item, BaseItemDto itemDto, User user, List<ItemFields> fields);+ UserItemDataDto GetUserDataDto(IHasUserData item, BaseItemDto itemDto, User user, ItemFields[] fields);/// <summary>/// Get all user data for the given userdiff --git a/MediaBrowser.Controller/Library/IUserViewManager.cs b/MediaBrowser.Controller/Library/IUserViewManager.csindex b46ece49d4..76182c641b 100644--- a/MediaBrowser.Controller/Library/IUserViewManager.cs+++ b/MediaBrowser.Controller/Library/IUserViewManager.cs@@ -11,7 +11,7 @@ namespace MediaBrowser.Controller.Library{public interface IUserViewManager{- Task<IEnumerable<Folder>> GetUserViews(UserViewQuery query, CancellationToken cancellationToken);+ Task<Folder[]> GetUserViews(UserViewQuery query, CancellationToken cancellationToken);Task<UserView> GetUserSubView(string name, string parentId, string type, string sortName, CancellationToken cancellationToken);diff --git a/MediaBrowser.Controller/LiveTv/ILiveTvManager.cs b/MediaBrowser.Controller/LiveTv/ILiveTvManager.csindex d6855b7924..862894f613 100644--- a/MediaBrowser.Controller/LiveTv/ILiveTvManager.cs+++ b/MediaBrowser.Controller/LiveTv/ILiveTvManager.cs@@ -243,7 +243,7 @@ namespace MediaBrowser.Controller.LiveTv/// Gets the recommended programs internal./// </summary>/// <returns>Task<QueryResult<LiveTvProgram>>.</returns>- Task<QueryResult<LiveTvProgram>> GetRecommendedProgramsInternal(RecommendedProgramQuery query, DtoOptions options, CancellationToken cancellationToken);+ Task<QueryResult<BaseItem>> GetRecommendedProgramsInternal(RecommendedProgramQuery query, DtoOptions options, CancellationToken cancellationToken);/// <summary>/// Gets the live tv information.@@ -316,7 +316,7 @@ namespace MediaBrowser.Controller.LiveTv/// <param name="fields">The fields.</param>/// <param name="user">The user.</param>/// <returns>Task.</returns>- Task AddInfoToProgramDto(List<Tuple<BaseItem, BaseItemDto>> programs, List<ItemFields> fields, User user = null);+ Task AddInfoToProgramDto(List<Tuple<BaseItem, BaseItemDto>> programs, ItemFields[] fields, User user = null);/// <summary>/// Saves the tuner host.@@ -335,7 +335,7 @@ namespace MediaBrowser.Controller.LiveTvTask<TunerChannelMapping> SetChannelMapping(string providerId, string tunerChannelNumber, string providerChannelNumber);- TunerChannelMapping GetTunerChannelMapping(ChannelInfo channel, List<NameValuePair> mappings, List<ChannelInfo> providerChannels);+ TunerChannelMapping GetTunerChannelMapping(ChannelInfo channel, NameValuePair[] mappings, List<ChannelInfo> providerChannels);/// <summary>/// Gets the lineups.diff --git a/MediaBrowser.Controller/MediaEncoding/EncodingHelper.cs b/MediaBrowser.Controller/MediaEncoding/EncodingHelper.csindex 823c893ea8..8b4179adc9 100644--- a/MediaBrowser.Controller/MediaEncoding/EncodingHelper.cs+++ b/MediaBrowser.Controller/MediaEncoding/EncodingHelper.cs@@ -1521,7 +1521,7 @@ namespace MediaBrowser.Controller.MediaEncoding{var inputModifier = string.Empty;- var numInputFiles = state.PlayableStreamFileNames.Count > 0 ? state.PlayableStreamFileNames.Count : 1;+ var numInputFiles = state.PlayableStreamFileNames.Length > 0 ? state.PlayableStreamFileNames.Length : 1;var probeSizeArgument = GetProbeSizeArgument(numInputFiles);string analyzeDurationArgument;@@ -1676,12 +1676,12 @@ namespace MediaBrowser.Controller.MediaEncoding}else{- state.PlayableStreamFileNames = new List<string>();+ state.PlayableStreamFileNames = new string[]{};}}else{- state.PlayableStreamFileNames = new List<string>();+ state.PlayableStreamFileNames = new string[] { };}if (mediaSource.Timestamp.HasValue)diff --git a/MediaBrowser.Controller/MediaEncoding/EncodingJobInfo.cs b/MediaBrowser.Controller/MediaEncoding/EncodingJobInfo.csindex b552579a8c..c2ce969792 100644--- a/MediaBrowser.Controller/MediaEncoding/EncodingJobInfo.cs+++ b/MediaBrowser.Controller/MediaEncoding/EncodingJobInfo.cs@@ -27,7 +27,7 @@ namespace MediaBrowser.Controller.MediaEncodingpublic string MediaPath { get; set; }public bool IsInputVideo { get; set; }public IIsoMount IsoMount { get; set; }- public List<string> PlayableStreamFileNames { get; set; }+ public string[] PlayableStreamFileNames { get; set; }public string OutputAudioCodec { get; set; }public int? OutputVideoBitrate { get; set; }public MediaStream SubtitleStream { get; set; }@@ -42,8 +42,8 @@ namespace MediaBrowser.Controller.MediaEncodingpublic bool ReadInputAtNativeFramerate { get; set; }- private List<TranscodeReason> _transcodeReasons = null;- public List<TranscodeReason> TranscodeReasons+ private TranscodeReason[] _transcodeReasons = null;+ public TranscodeReason[] TranscodeReasons{get{@@ -53,7 +53,7 @@ namespace MediaBrowser.Controller.MediaEncoding.Split(',').Where(i => !string.IsNullOrWhiteSpace(i)).Select(v => (TranscodeReason)Enum.Parse(typeof(TranscodeReason), v, true))- .ToList();+ .ToArray();}return _transcodeReasons;@@ -164,7 +164,7 @@ namespace MediaBrowser.Controller.MediaEncoding_logger = logger;TranscodingType = jobType;RemoteHttpHeaders = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase);- PlayableStreamFileNames = new List<string>();+ PlayableStreamFileNames = new string[]{};SupportedAudioCodecs = new List<string>();SupportedVideoCodecs = new List<string>();SupportedSubtitleCodecs = new List<string>();diff --git a/MediaBrowser.Controller/MediaEncoding/MediaEncoderHelpers.cs b/MediaBrowser.Controller/MediaEncoding/MediaEncoderHelpers.csindex d5c85197fa..70e4db84f8 100644--- a/MediaBrowser.Controller/MediaEncoding/MediaEncoderHelpers.cs+++ b/MediaBrowser.Controller/MediaEncoding/MediaEncoderHelpers.cs@@ -1,12 +1,9 @@using MediaBrowser.Model.IO;using MediaBrowser.Model.MediaInfo;using System;-using System.Collections.Generic;using System.IO;using System.Linq;-using MediaBrowser.Controller.IO;-namespace MediaBrowser.Controller.MediaEncoding{/// <summary>@@ -23,34 +20,34 @@ namespace MediaBrowser.Controller.MediaEncoding/// <param name="isoMount">The iso mount.</param>/// <param name="playableStreamFileNames">The playable stream file names.</param>/// <returns>System.String[][].</returns>- public static string[] GetInputArgument(IFileSystem fileSystem, string videoPath, MediaProtocol protocol, IIsoMount isoMount, List<string> playableStreamFileNames)+ public static string[] GetInputArgument(IFileSystem fileSystem, string videoPath, MediaProtocol protocol, IIsoMount isoMount, string[] playableStreamFileNames){- if (playableStreamFileNames.Count > 0)+ if (playableStreamFileNames.Length > 0){if (isoMount == null){- return GetPlayableStreamFiles(fileSystem, videoPath, playableStreamFileNames).ToArray();+ return GetPlayableStreamFiles(fileSystem, videoPath, playableStreamFileNames);}- return GetPlayableStreamFiles(fileSystem, isoMount.MountedPath, playableStreamFileNames).ToArray();+ return GetPlayableStreamFiles(fileSystem, isoMount.MountedPath, playableStreamFileNames);}return new[] {videoPath};}- private static List<string> GetPlayableStreamFiles(IFileSystem fileSystem, string rootPath, List<string> filenames)+ private static string[] GetPlayableStreamFiles(IFileSystem fileSystem, string rootPath, string[] filenames){- if (filenames.Count == 0)+ if (filenames.Length == 0){- return new List<string>();+ return new string[]{};}var allFiles = fileSystem.GetFilePaths(rootPath, true)- .ToList();+ .ToArray();return filenames.Select(name => allFiles.FirstOrDefault(f => string.Equals(Path.GetFileName(f), name, StringComparison.OrdinalIgnoreCase))).Where(f => !string.IsNullOrEmpty(f))- .ToList();+ .ToArray();}}}diff --git a/MediaBrowser.Controller/MediaEncoding/MediaInfoRequest.cs b/MediaBrowser.Controller/MediaEncoding/MediaInfoRequest.csindex 0785ee29fc..929f4e649e 100644--- a/MediaBrowser.Controller/MediaEncoding/MediaInfoRequest.cs+++ b/MediaBrowser.Controller/MediaEncoding/MediaInfoRequest.cs@@ -14,12 +14,12 @@ namespace MediaBrowser.Controller.MediaEncodingpublic DlnaProfileType MediaType { get; set; }public IIsoMount MountedIso { get; set; }public VideoType VideoType { get; set; }- public List<string> PlayableStreamFileNames { get; set; }+ public string[] PlayableStreamFileNames { get; set; }public int AnalyzeDurationMs { get; set; }public MediaInfoRequest(){- PlayableStreamFileNames = new List<string>();+ PlayableStreamFileNames = new string[] { };}}}diff --git a/MediaBrowser.Controller/Notifications/INotificationManager.cs b/MediaBrowser.Controller/Notifications/INotificationManager.csindex cb1e3da902..f9d2643145 100644--- a/MediaBrowser.Controller/Notifications/INotificationManager.cs+++ b/MediaBrowser.Controller/Notifications/INotificationManager.cs@@ -26,7 +26,7 @@ namespace MediaBrowser.Controller.Notifications/// Gets the notification types./// </summary>/// <returns>IEnumerable{NotificationTypeInfo}.</returns>- IEnumerable<NotificationTypeInfo> GetNotificationTypes();+ List<NotificationTypeInfo> GetNotificationTypes();/// <summary>/// Gets the notification services.diff --git a/MediaBrowser.Controller/Playlists/Playlist.cs b/MediaBrowser.Controller/Playlists/Playlist.csindex aec0668d43..e36e6ad5db 100644--- a/MediaBrowser.Controller/Playlists/Playlist.cs+++ b/MediaBrowser.Controller/Playlists/Playlist.cs@@ -89,7 +89,7 @@ namespace MediaBrowser.Controller.Playlistsreturn new List<BaseItem>();}- public override IEnumerable<BaseItem> GetChildren(User user, bool includeLinkedChildren)+ public override List<BaseItem> GetChildren(User user, bool includeLinkedChildren){return GetPlayableItems(user, new DtoOptions(true));}diff --git a/MediaBrowser.Controller/Providers/IProviderManager.cs b/MediaBrowser.Controller/Providers/IProviderManager.csindex 703666d668..77e6a7e405 100644--- a/MediaBrowser.Controller/Providers/IProviderManager.cs+++ b/MediaBrowser.Controller/Providers/IProviderManager.cs@@ -97,7 +97,7 @@ namespace MediaBrowser.Controller.Providers/// Gets all metadata plugins./// </summary>/// <returns>IEnumerable{MetadataPlugin}.</returns>- IEnumerable<MetadataPluginSummary> GetAllMetadataPlugins();+ MetadataPluginSummary[] GetAllMetadataPlugins();/// <summary>/// Gets the external urls.diff --git a/MediaBrowser.Controller/Session/SessionInfo.cs b/MediaBrowser.Controller/Session/SessionInfo.csindex 11a9ceac42..265f4f544e 100644--- a/MediaBrowser.Controller/Session/SessionInfo.cs+++ b/MediaBrowser.Controller/Session/SessionInfo.cs@@ -22,13 +22,13 @@ namespace MediaBrowser.Controller.Session_sessionManager = sessionManager;_logger = logger;- AdditionalUsers = new List<SessionUserInfo>();+ AdditionalUsers = new SessionUserInfo[] { };PlayState = new PlayerStateInfo();}public PlayerStateInfo PlayState { get; set; }- public List<SessionUserInfo> AdditionalUsers { get; set; }+ public SessionUserInfo[] AdditionalUsers { get; set; }public ClientCapabilities Capabilities { get; set; }@@ -42,13 +42,13 @@ namespace MediaBrowser.Controller.Session/// Gets or sets the playable media types./// </summary>/// <value>The playable media types.</value>- public List<string> PlayableMediaTypes+ public string[] PlayableMediaTypes{get{if (Capabilities == null){- return new List<string>();+ return new string[] { };}return Capabilities.PlayableMediaTypes;}@@ -138,13 +138,13 @@ namespace MediaBrowser.Controller.Session/// Gets or sets the supported commands./// </summary>/// <value>The supported commands.</value>- public List<string> SupportedCommands+ public string[] SupportedCommands{get{if (Capabilities == null){- return new List<string>();+ return new string[] { };}return Capabilities.SupportedCommands;}diff --git a/MediaBrowser.Controller/Subtitles/ISubtitleManager.cs b/MediaBrowser.Controller/Subtitles/ISubtitleManager.csindex d1d5f27bef..2199c21e6a 100644--- a/MediaBrowser.Controller/Subtitles/ISubtitleManager.cs+++ b/MediaBrowser.Controller/Subtitles/ISubtitleManager.cs@@ -28,7 +28,7 @@ namespace MediaBrowser.Controller.Subtitles/// <summary>/// Searches the subtitles./// </summary>- Task<IEnumerable<RemoteSubtitleInfo>> SearchSubtitles(Video video,+ Task<RemoteSubtitleInfo[]> SearchSubtitles(Video video,string language,bool? isPerfectMatch,CancellationToken cancellationToken);@@ -39,7 +39,7 @@ namespace MediaBrowser.Controller.Subtitles/// <param name="request">The request.</param>/// <param name="cancellationToken">The cancellation token.</param>/// <returns>Task{IEnumerable{RemoteSubtitleInfo}}.</returns>- Task<IEnumerable<RemoteSubtitleInfo>> SearchSubtitles(SubtitleSearchRequest request,+ Task<RemoteSubtitleInfo[]> SearchSubtitles(SubtitleSearchRequest request,CancellationToken cancellationToken);/// <summary>@@ -74,6 +74,6 @@ namespace MediaBrowser.Controller.Subtitles/// </summary>/// <param name="itemId">The item identifier.</param>/// <returns>IEnumerable{SubtitleProviderInfo}.</returns>- IEnumerable<SubtitleProviderInfo> GetProviders(string itemId);+ SubtitleProviderInfo[] GetProviders(string itemId);}}diff --git a/MediaBrowser.Controller/Sync/ISyncManager.cs b/MediaBrowser.Controller/Sync/ISyncManager.csindex 66f64464f1..910d697ec0 100644--- a/MediaBrowser.Controller/Sync/ISyncManager.cs+++ b/MediaBrowser.Controller/Sync/ISyncManager.cs@@ -79,7 +79,7 @@ namespace MediaBrowser.Controller.Sync/// <param name="targetId">The target identifier.</param>/// <param name="itemIds">The item ids.</param>/// <returns>Task.</returns>- Task CancelItems(string targetId, IEnumerable<string> itemIds);+ Task CancelItems(string targetId, string[] itemIds);/// <summary>/// Adds the parts.@@ -89,9 +89,9 @@ namespace MediaBrowser.Controller.Sync/// <summary>/// Gets the synchronize targets./// </summary>- IEnumerable<SyncTarget> GetSyncTargets(string userId);+ List<SyncTarget> GetSyncTargets(string userId);- IEnumerable<SyncTarget> GetSyncTargets(string userId, bool? supportsRemoteSync);+ List<SyncTarget> GetSyncTargets(string userId, bool? supportsRemoteSync);/// <summary>/// Supportses the synchronize.@@ -160,28 +160,24 @@ namespace MediaBrowser.Controller.Sync/// Gets the quality options./// </summary>/// <param name="targetId">The target identifier.</param>- /// <returns>IEnumerable<SyncQualityOption>.</returns>- IEnumerable<SyncQualityOption> GetQualityOptions(string targetId);+ List<SyncQualityOption> GetQualityOptions(string targetId);/// <summary>/// Gets the quality options./// </summary>/// <param name="targetId">The target identifier.</param>/// <param name="user">The user.</param>- /// <returns>IEnumerable<SyncQualityOption>.</returns>- IEnumerable<SyncQualityOption> GetQualityOptions(string targetId, User user);+ List<SyncQualityOption> GetQualityOptions(string targetId, User user);/// <summary>/// Gets the profile options./// </summary>/// <param name="targetId">The target identifier.</param>- /// <returns>IEnumerable<SyncQualityOption>.</returns>- IEnumerable<SyncProfileOption> GetProfileOptions(string targetId);+ List<SyncProfileOption> GetProfileOptions(string targetId);/// <summary>/// Gets the profile options./// </summary>/// <param name="targetId">The target identifier.</param>/// <param name="user">The user.</param>- /// <returns>IEnumerable<SyncProfileOption>.</returns>- IEnumerable<SyncProfileOption> GetProfileOptions(string targetId, User user);+ List<SyncProfileOption> GetProfileOptions(string targetId, User user);}}diff --git a/MediaBrowser.Controller/Sync/ISyncProvider.cs b/MediaBrowser.Controller/Sync/ISyncProvider.csindex aa4b36427a..2f60e124ec 100644--- a/MediaBrowser.Controller/Sync/ISyncProvider.cs+++ b/MediaBrowser.Controller/Sync/ISyncProvider.cs@@ -18,13 +18,13 @@ namespace MediaBrowser.Controller.Sync/// </summary>/// <param name="userId">The user identifier.</param>/// <returns>IEnumerable<SyncTarget>.</returns>- IEnumerable<SyncTarget> GetSyncTargets(string userId);+ List<SyncTarget> GetSyncTargets(string userId);/// <summary>/// Gets all synchronize targets./// </summary>/// <returns>IEnumerable<SyncTarget>.</returns>- IEnumerable<SyncTarget> GetAllSyncTargets();+ List<SyncTarget> GetAllSyncTargets();}public interface IHasUniqueTargetIdsdiff --git a/MediaBrowser.LocalMetadata/Images/LocalImageProvider.cs b/MediaBrowser.LocalMetadata/Images/LocalImageProvider.csindex 1b61f079e6..ddfb703212 100644--- a/MediaBrowser.LocalMetadata/Images/LocalImageProvider.cs+++ b/MediaBrowser.LocalMetadata/Images/LocalImageProvider.cs@@ -163,36 +163,71 @@ namespace MediaBrowser.LocalMetadata.ImagesPopulateScreenshots(images, files, imagePrefix, isInMixedFolder);}+ private static readonly string[] CommonImageFileNames = new[]+ {+ "poster",+ "folder",+ "cover",+ "default"+ };++ private static readonly string[] MusicImageFileNames = new[]+ {+ "folder",+ "poster",+ "cover",+ "default"+ };++ private static readonly string[] PersonImageFileNames = new[]+ {+ "folder",+ "poster"+ };++ private static readonly string[] SeriesImageFileNames = new[]+ {+ "poster",+ "folder",+ "cover",+ "default",+ "show"+ };++ private static readonly string[] VideoImageFileNames = new[]+ {+ "poster",+ "folder",+ "cover",+ "default",+ "movie"+ };+private void PopulatePrimaryImages(IHasMetadata item, List<LocalImageInfo> images, List<FileSystemMetadata> files, string imagePrefix, bool isInMixedFolder){- var names = new List<string>- {- "cover",- "default"- };+ string[] imageFileNames;- if (item is MusicAlbum || item is MusicArtist || item is PhotoAlbum || item is Person)+ if (item is MusicAlbum || item is MusicArtist || item is PhotoAlbum){// these prefer folder- names.Insert(0, "poster");- names.Insert(0, "folder");+ imageFileNames = MusicImageFileNames;}- else+ else if (item is Person){- names.Insert(0, "folder");- names.Insert(0, "poster");+ // these prefer folder+ imageFileNames = PersonImageFileNames;}-- // Support plex/kodi convention- if (item is Series)+ else if (item is Series){- names.Add("show");+ imageFileNames = SeriesImageFileNames;}-- // Support plex/kodi convention- if (item is Video && !(item is Episode))+ else if (item is Video && !(item is Episode))+ {+ imageFileNames = VideoImageFileNames;+ }+ else{- names.Add("movie");+ imageFileNames = CommonImageFileNames;}var fileNameWithoutExtension = item.FileNameWithoutExtension;@@ -201,14 +236,14 @@ namespace MediaBrowser.LocalMetadata.ImagesAddImage(files, images, fileNameWithoutExtension, ImageType.Primary);}- foreach (var name in names)+ foreach (var name in imageFileNames){AddImage(files, images, imagePrefix + name, ImageType.Primary);}if (!isInMixedFolder){- foreach (var name in names)+ foreach (var name in imageFileNames){AddImage(files, images, name, ImageType.Primary);}diff --git a/MediaBrowser.Model/Channels/AllChannelMediaQuery.cs b/MediaBrowser.Model/Channels/AllChannelMediaQuery.csindex c5631899e2..920f3e4b2b 100644--- a/MediaBrowser.Model/Channels/AllChannelMediaQuery.cs+++ b/MediaBrowser.Model/Channels/AllChannelMediaQuery.cs@@ -52,10 +52,10 @@ namespace MediaBrowser.Model.ChannelsTrailerTypes = new TrailerType[] { };Filters = new ItemFilter[] { };- Fields = new List<ItemFields>();+ Fields = new ItemFields[]{};}public ItemFilter[] Filters { get; set; }- public List<ItemFields> Fields { get; set; }+ public ItemFields[] Fields { get; set; }}}\ No newline at end of filediff --git a/MediaBrowser.Model/Channels/ChannelFeatures.cs b/MediaBrowser.Model/Channels/ChannelFeatures.csindex 8dfdbcd7a4..39b40cabc4 100644--- a/MediaBrowser.Model/Channels/ChannelFeatures.cs+++ b/MediaBrowser.Model/Channels/ChannelFeatures.cs@@ -26,13 +26,13 @@ namespace MediaBrowser.Model.Channels/// Gets or sets the media types./// </summary>/// <value>The media types.</value>- public List<ChannelMediaType> MediaTypes { get; set; }+ public ChannelMediaType[] MediaTypes { get; set; }/// <summary>/// Gets or sets the content types./// </summary>/// <value>The content types.</value>- public List<ChannelMediaContentType> ContentTypes { get; set; }+ public ChannelMediaContentType[] ContentTypes { get; set; }/// <summary>/// Represents the maximum number of records the channel allows retrieving at a time@@ -49,7 +49,7 @@ namespace MediaBrowser.Model.Channels/// Gets or sets the default sort orders./// </summary>/// <value>The default sort orders.</value>- public List<ChannelItemSortField> DefaultSortFields { get; set; }+ public ChannelItemSortField[] DefaultSortFields { get; set; }/// <summary>/// Indicates if a sort ascending/descending toggle is supported or not.@@ -76,10 +76,10 @@ namespace MediaBrowser.Model.Channelspublic ChannelFeatures(){- MediaTypes = new List<ChannelMediaType>();- ContentTypes = new List<ChannelMediaContentType>();+ MediaTypes = new ChannelMediaType[] { };+ ContentTypes = new ChannelMediaContentType[] { };- DefaultSortFields = new List<ChannelItemSortField>();+ DefaultSortFields = new ChannelItemSortField[] { };}}}diff --git a/MediaBrowser.Model/Configuration/MetadataOptions.cs b/MediaBrowser.Model/Configuration/MetadataOptions.csindex ddde688b25..8a41decbf7 100644--- a/MediaBrowser.Model/Configuration/MetadataOptions.cs+++ b/MediaBrowser.Model/Configuration/MetadataOptions.cs@@ -29,7 +29,7 @@ namespace MediaBrowser.Model.Configurationpublic MetadataOptions(int backdropLimit, int minBackdropWidth){- List<ImageOption> imageOptions = new List<ImageOption>+ ImageOptions = new[]{new ImageOption{@@ -39,7 +39,6 @@ namespace MediaBrowser.Model.Configuration}};- ImageOptions = imageOptions.ToArray();DisabledMetadataSavers = new string[] { };LocalMetadataReaderOrder = new string[] { };diff --git a/MediaBrowser.Model/Configuration/MetadataPluginSummary.cs b/MediaBrowser.Model/Configuration/MetadataPluginSummary.csindex 90b3933eb9..80142cf434 100644--- a/MediaBrowser.Model/Configuration/MetadataPluginSummary.cs+++ b/MediaBrowser.Model/Configuration/MetadataPluginSummary.cs@@ -15,18 +15,18 @@ namespace MediaBrowser.Model.Configuration/// Gets or sets the plugins./// </summary>/// <value>The plugins.</value>- public List<MetadataPlugin> Plugins { get; set; }+ public MetadataPlugin[] Plugins { get; set; }/// <summary>/// Gets or sets the supported image types./// </summary>/// <value>The supported image types.</value>- public List<ImageType> SupportedImageTypes { get; set; }+ public ImageType[] SupportedImageTypes { get; set; }public MetadataPluginSummary(){- SupportedImageTypes = new List<ImageType>();- Plugins = new List<MetadataPlugin>();+ SupportedImageTypes = new ImageType[] { };+ Plugins = new MetadataPlugin[] { };}}}\ No newline at end of filediff --git a/MediaBrowser.Model/Devices/ContentUploadHistory.cs b/MediaBrowser.Model/Devices/ContentUploadHistory.csindex cd4858d907..2b344df242 100644--- a/MediaBrowser.Model/Devices/ContentUploadHistory.cs+++ b/MediaBrowser.Model/Devices/ContentUploadHistory.cs@@ -5,11 +5,11 @@ namespace MediaBrowser.Model.Devicespublic class ContentUploadHistory{public string DeviceId { get; set; }- public List<LocalFileInfo> FilesUploaded { get; set; }+ public LocalFileInfo[] FilesUploaded { get; set; }public ContentUploadHistory(){- FilesUploaded = new List<LocalFileInfo>();+ FilesUploaded = new LocalFileInfo[] { };}}}diff --git a/MediaBrowser.Model/Dlna/AudioOptions.cs b/MediaBrowser.Model/Dlna/AudioOptions.csindex 24c7aef98b..6584bb3ccd 100644--- a/MediaBrowser.Model/Dlna/AudioOptions.cs+++ b/MediaBrowser.Model/Dlna/AudioOptions.cs@@ -22,7 +22,7 @@ namespace MediaBrowser.Model.Dlnapublic bool ForceDirectStream { get; set; }public string ItemId { get; set; }- public List<MediaSourceInfo> MediaSources { get; set; }+ public MediaSourceInfo[] MediaSources { get; set; }public DeviceProfile Profile { get; set; }/// <summary>diff --git a/MediaBrowser.Model/Dlna/CodecProfile.cs b/MediaBrowser.Model/Dlna/CodecProfile.csindex 14b1875c19..d75547adb1 100644--- a/MediaBrowser.Model/Dlna/CodecProfile.cs+++ b/MediaBrowser.Model/Dlna/CodecProfile.cs@@ -26,19 +26,9 @@ namespace MediaBrowser.Model.DlnaApplyConditions = new ProfileCondition[] { };}- private static List<string> SplitValue(string value)+ public string[] GetCodecs(){- List<string> list = new List<string>();- foreach (string i in (value ?? string.Empty).Split(','))- {- if (!string.IsNullOrEmpty(i)) list.Add(i);- }- return list;- }-- public List<string> GetCodecs()- {- return SplitValue(Codec);+ return ContainerProfile.SplitValue(Codec);}private bool ContainsContainer(string container)@@ -53,10 +43,9 @@ namespace MediaBrowser.Model.Dlnareturn false;}- List<string> codecs = GetCodecs();+ var codecs = GetCodecs();- return codecs.Count == 0 || ListHelper.ContainsIgnoreCase(codecs, SplitValue(codec)[0]);- //return codecs.Count == 0 || SplitValue(codec).Any(i => ListHelper.ContainsIgnoreCase(codecs, i));+ return codecs.Length == 0 || ListHelper.ContainsIgnoreCase(codecs, ContainerProfile.SplitValue(codec)[0]);}}}diff --git a/MediaBrowser.Model/Dlna/ContainerProfile.cs b/MediaBrowser.Model/Dlna/ContainerProfile.csindex 2004cfc1fe..23bbf01939 100644--- a/MediaBrowser.Model/Dlna/ContainerProfile.cs+++ b/MediaBrowser.Model/Dlna/ContainerProfile.cs@@ -20,24 +20,26 @@ namespace MediaBrowser.Model.DlnaConditions = new ProfileCondition[] { };}- public List<string> GetContainers()+ public string[] GetContainers(){return SplitValue(Container);}- public static List<string> SplitValue(string value)+ private static readonly string[] EmptyStringArray = new string[] { };++ public static string[] SplitValue(string value){- List<string> list = new List<string>();- foreach (string i in (value ?? string.Empty).Split(','))+ if (string.IsNullOrWhiteSpace(value)){- if (!string.IsNullOrWhiteSpace(i)) list.Add(i);+ return EmptyStringArray;}- return list;++ return value.Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries);}public bool ContainsContainer(string container){- List<string> containers = GetContainers();+ var containers = GetContainers();return ContainsContainer(containers, container);}@@ -47,9 +49,9 @@ namespace MediaBrowser.Model.Dlnareturn ContainsContainer(SplitValue(profileContainers), inputContainer);}- public static bool ContainsContainer(List<string> profileContainers, string inputContainer)+ public static bool ContainsContainer(string[] profileContainers, string inputContainer){- if (profileContainers.Count == 0)+ if (profileContainers.Length == 0){return true;}diff --git a/MediaBrowser.Model/Dlna/DeviceProfile.cs b/MediaBrowser.Model/Dlna/DeviceProfile.csindex 5f9bd772cc..d6f0eafc75 100644--- a/MediaBrowser.Model/Dlna/DeviceProfile.cs+++ b/MediaBrowser.Model/Dlna/DeviceProfile.cs@@ -117,15 +117,9 @@ namespace MediaBrowser.Model.DlnaMusicStreamingTranscodingBitrate = 128000;}- public List<string> GetSupportedMediaTypes()+ public string[] GetSupportedMediaTypes(){- List<string> list = new List<string>();- foreach (string i in (SupportedMediaTypes ?? string.Empty).Split(','))- {- if (!string.IsNullOrEmpty(i))- list.Add(i);- }- return list;+ return ContainerProfile.SplitValue(SupportedMediaTypes);}public TranscodingProfile GetAudioTranscodingProfile(string container, string audioCodec)@@ -199,8 +193,8 @@ namespace MediaBrowser.Model.Dlnacontinue;}- List<string> audioCodecs = i.GetAudioCodecs();- if (audioCodecs.Count > 0 && !ListHelper.ContainsIgnoreCase(audioCodecs, audioCodec ?? string.Empty))+ var audioCodecs = i.GetAudioCodecs();+ if (audioCodecs.Length > 0 && !ListHelper.ContainsIgnoreCase(audioCodecs, audioCodec ?? string.Empty)){continue;}@@ -306,14 +300,14 @@ namespace MediaBrowser.Model.Dlnacontinue;}- List<string> audioCodecs = i.GetAudioCodecs();- if (audioCodecs.Count > 0 && !ListHelper.ContainsIgnoreCase(audioCodecs, audioCodec ?? string.Empty))+ var audioCodecs = i.GetAudioCodecs();+ if (audioCodecs.Length > 0 && !ListHelper.ContainsIgnoreCase(audioCodecs, audioCodec ?? string.Empty)){continue;}- List<string> videoCodecs = i.GetVideoCodecs();- if (videoCodecs.Count > 0 && !ListHelper.ContainsIgnoreCase(videoCodecs, videoCodec ?? string.Empty))+ var videoCodecs = i.GetVideoCodecs();+ if (videoCodecs.Length > 0 && !ListHelper.ContainsIgnoreCase(videoCodecs, videoCodec ?? string.Empty)){continue;}diff --git a/MediaBrowser.Model/Dlna/DirectPlayProfile.cs b/MediaBrowser.Model/Dlna/DirectPlayProfile.csindex e80f59be4c..7430c449f2 100644--- a/MediaBrowser.Model/Dlna/DirectPlayProfile.cs+++ b/MediaBrowser.Model/Dlna/DirectPlayProfile.cs@@ -23,24 +23,14 @@ namespace MediaBrowser.Model.Dlnareturn ContainerProfile.ContainsContainer(Container, container);}- public List<string> GetAudioCodecs()+ public string[] GetAudioCodecs(){- List<string> list = new List<string>();- foreach (string i in (AudioCodec ?? string.Empty).Split(','))- {- if (!string.IsNullOrEmpty(i)) list.Add(i);- }- return list;+ return ContainerProfile.SplitValue(AudioCodec);}- public List<string> GetVideoCodecs()+ public string[] GetVideoCodecs(){- List<string> list = new List<string>();- foreach (string i in (VideoCodec ?? string.Empty).Split(','))- {- if (!string.IsNullOrEmpty(i)) list.Add(i);- }- return list;+ return ContainerProfile.SplitValue(VideoCodec);}}}diff --git a/MediaBrowser.Model/Dlna/MediaFormatProfileResolver.cs b/MediaBrowser.Model/Dlna/MediaFormatProfileResolver.csindex a464b045bf..034e0fe6a4 100644--- a/MediaBrowser.Model/Dlna/MediaFormatProfileResolver.cs+++ b/MediaBrowser.Model/Dlna/MediaFormatProfileResolver.cs@@ -7,33 +7,33 @@ namespace MediaBrowser.Model.Dlna{public class MediaFormatProfileResolver{- public List<MediaFormatProfile> ResolveVideoFormat(string container, string videoCodec, string audioCodec, int? width, int? height, TransportStreamTimestamp timestampType)+ public MediaFormatProfile[] ResolveVideoFormat(string container, string videoCodec, string audioCodec, int? width, int? height, TransportStreamTimestamp timestampType){if (StringHelper.EqualsIgnoreCase(container, "asf")){MediaFormatProfile? val = ResolveVideoASFFormat(videoCodec, audioCodec, width, height);- return val.HasValue ? new List<MediaFormatProfile> { val.Value } : new List<MediaFormatProfile>();+ return val.HasValue ? new MediaFormatProfile[] { val.Value } : new MediaFormatProfile[]{};}if (StringHelper.EqualsIgnoreCase(container, "mp4")){MediaFormatProfile? val = ResolveVideoMP4Format(videoCodec, audioCodec, width, height);- return val.HasValue ? new List<MediaFormatProfile> { val.Value } : new List<MediaFormatProfile>();+ return val.HasValue ? new MediaFormatProfile[] { val.Value } : new MediaFormatProfile[] { };}if (StringHelper.EqualsIgnoreCase(container, "avi"))- return new List<MediaFormatProfile> { MediaFormatProfile.AVI };+ return new MediaFormatProfile[] { MediaFormatProfile.AVI };if (StringHelper.EqualsIgnoreCase(container, "mkv"))- return new List<MediaFormatProfile> { MediaFormatProfile.MATROSKA };+ return new MediaFormatProfile[] { MediaFormatProfile.MATROSKA };if (StringHelper.EqualsIgnoreCase(container, "mpeg2ps") ||StringHelper.EqualsIgnoreCase(container, "ts"))- return new List<MediaFormatProfile> { MediaFormatProfile.MPEG_PS_NTSC, MediaFormatProfile.MPEG_PS_PAL };+ return new MediaFormatProfile[] { MediaFormatProfile.MPEG_PS_NTSC, MediaFormatProfile.MPEG_PS_PAL };if (StringHelper.EqualsIgnoreCase(container, "mpeg1video"))- return new List<MediaFormatProfile> { MediaFormatProfile.MPEG1 };+ return new MediaFormatProfile[] { MediaFormatProfile.MPEG1 };if (StringHelper.EqualsIgnoreCase(container, "mpeg2ts") ||StringHelper.EqualsIgnoreCase(container, "mpegts") ||@@ -44,24 +44,24 @@ namespace MediaBrowser.Model.Dlna}if (StringHelper.EqualsIgnoreCase(container, "flv"))- return new List<MediaFormatProfile> { MediaFormatProfile.FLV };+ return new MediaFormatProfile[] { MediaFormatProfile.FLV };if (StringHelper.EqualsIgnoreCase(container, "wtv"))- return new List<MediaFormatProfile> { MediaFormatProfile.WTV };+ return new MediaFormatProfile[] { MediaFormatProfile.WTV };if (StringHelper.EqualsIgnoreCase(container, "3gp")){MediaFormatProfile? val = ResolveVideo3GPFormat(videoCodec, audioCodec);- return val.HasValue ? new List<MediaFormatProfile> { val.Value } : new List<MediaFormatProfile>();+ return val.HasValue ? new MediaFormatProfile[] { val.Value } : new MediaFormatProfile[] { };}if (StringHelper.EqualsIgnoreCase(container, "ogv") || StringHelper.EqualsIgnoreCase(container, "ogg"))- return new List<MediaFormatProfile> { MediaFormatProfile.OGV };+ return new MediaFormatProfile[] { MediaFormatProfile.OGV };- return new List<MediaFormatProfile>();+ return new MediaFormatProfile[] { };}- private List<MediaFormatProfile> ResolveVideoMPEG2TSFormat(string videoCodec, string audioCodec, int? width, int? height, TransportStreamTimestamp timestampType)+ private MediaFormatProfile[] ResolveVideoMPEG2TSFormat(string videoCodec, string audioCodec, int? width, int? height, TransportStreamTimestamp timestampType){string suffix = "";@@ -93,41 +93,41 @@ namespace MediaBrowser.Model.Dlna{list.Add(MediaFormatProfile.MPEG_TS_JP_T);}- return list;+ return list.ToArray(list.Count);}if (StringHelper.EqualsIgnoreCase(videoCodec, "h264")){if (StringHelper.EqualsIgnoreCase(audioCodec, "lpcm"))- return new List<MediaFormatProfile> { MediaFormatProfile.AVC_TS_HD_50_LPCM_T };+ return new MediaFormatProfile[] { MediaFormatProfile.AVC_TS_HD_50_LPCM_T };if (StringHelper.EqualsIgnoreCase(audioCodec, "dts")){if (timestampType == TransportStreamTimestamp.None){- return new List<MediaFormatProfile> { MediaFormatProfile.AVC_TS_HD_DTS_ISO };+ return new MediaFormatProfile[] { MediaFormatProfile.AVC_TS_HD_DTS_ISO };}- return new List<MediaFormatProfile> { MediaFormatProfile.AVC_TS_HD_DTS_T };+ return new MediaFormatProfile[] { MediaFormatProfile.AVC_TS_HD_DTS_T };}if (StringHelper.EqualsIgnoreCase(audioCodec, "mp2")){if (timestampType == TransportStreamTimestamp.None){- return new List<MediaFormatProfile> { ValueOf(string.Format("AVC_TS_HP_{0}D_MPEG1_L2_ISO", resolution)) };+ return new MediaFormatProfile[] { ValueOf(string.Format("AVC_TS_HP_{0}D_MPEG1_L2_ISO", resolution)) };}- return new List<MediaFormatProfile> { ValueOf(string.Format("AVC_TS_HP_{0}D_MPEG1_L2_T", resolution)) };+ return new MediaFormatProfile[] { ValueOf(string.Format("AVC_TS_HP_{0}D_MPEG1_L2_T", resolution)) };}if (StringHelper.EqualsIgnoreCase(audioCodec, "aac"))- return new List<MediaFormatProfile> { ValueOf(string.Format("AVC_TS_MP_{0}D_AAC_MULT5{1}", resolution, suffix)) };+ return new MediaFormatProfile[] { ValueOf(string.Format("AVC_TS_MP_{0}D_AAC_MULT5{1}", resolution, suffix)) };if (StringHelper.EqualsIgnoreCase(audioCodec, "mp3"))- return new List<MediaFormatProfile> { ValueOf(string.Format("AVC_TS_MP_{0}D_MPEG1_L3{1}", resolution, suffix)) };+ return new MediaFormatProfile[] { ValueOf(string.Format("AVC_TS_MP_{0}D_MPEG1_L3{1}", resolution, suffix)) };if (string.IsNullOrEmpty(audioCodec) ||StringHelper.EqualsIgnoreCase(audioCodec, "ac3"))- return new List<MediaFormatProfile> { ValueOf(string.Format("AVC_TS_MP_{0}D_AC3{1}", resolution, suffix)) };+ return new MediaFormatProfile[] { ValueOf(string.Format("AVC_TS_MP_{0}D_AC3{1}", resolution, suffix)) };}else if (StringHelper.EqualsIgnoreCase(videoCodec, "vc1")){@@ -135,31 +135,31 @@ namespace MediaBrowser.Model.Dlna{if ((width.HasValue && width.Value > 720) || (height.HasValue && height.Value > 576)){- return new List<MediaFormatProfile> { MediaFormatProfile.VC1_TS_AP_L2_AC3_ISO };+ return new MediaFormatProfile[] { MediaFormatProfile.VC1_TS_AP_L2_AC3_ISO };}- return new List<MediaFormatProfile> { MediaFormatProfile.VC1_TS_AP_L1_AC3_ISO };+ return new MediaFormatProfile[] { MediaFormatProfile.VC1_TS_AP_L1_AC3_ISO };}if (StringHelper.EqualsIgnoreCase(audioCodec, "dts")){suffix = StringHelper.EqualsIgnoreCase(suffix, "_ISO") ? suffix : "_T";- return new List<MediaFormatProfile> { ValueOf(string.Format("VC1_TS_HD_DTS{0}", suffix)) };+ return new MediaFormatProfile[] { ValueOf(string.Format("VC1_TS_HD_DTS{0}", suffix)) };}}else if (StringHelper.EqualsIgnoreCase(videoCodec, "mpeg4") || StringHelper.EqualsIgnoreCase(videoCodec, "msmpeg4")){if (StringHelper.EqualsIgnoreCase(audioCodec, "aac"))- return new List<MediaFormatProfile> { ValueOf(string.Format("MPEG4_P2_TS_ASP_AAC{0}", suffix)) };+ return new MediaFormatProfile[] { ValueOf(string.Format("MPEG4_P2_TS_ASP_AAC{0}", suffix)) };if (StringHelper.EqualsIgnoreCase(audioCodec, "mp3"))- return new List<MediaFormatProfile> { ValueOf(string.Format("MPEG4_P2_TS_ASP_MPEG1_L3{0}", suffix)) };+ return new MediaFormatProfile[] { ValueOf(string.Format("MPEG4_P2_TS_ASP_MPEG1_L3{0}", suffix)) };if (StringHelper.EqualsIgnoreCase(audioCodec, "mp2"))- return new List<MediaFormatProfile> { ValueOf(string.Format("MPEG4_P2_TS_ASP_MPEG2_L2{0}", suffix)) };+ return new MediaFormatProfile[] { ValueOf(string.Format("MPEG4_P2_TS_ASP_MPEG2_L2{0}", suffix)) };if (StringHelper.EqualsIgnoreCase(audioCodec, "ac3"))- return new List<MediaFormatProfile> { ValueOf(string.Format("MPEG4_P2_TS_ASP_AC3{0}", suffix)) };+ return new MediaFormatProfile[] { ValueOf(string.Format("MPEG4_P2_TS_ASP_AC3{0}", suffix)) };}- return new List<MediaFormatProfile>();+ return new MediaFormatProfile[]{};}private MediaFormatProfile ValueOf(string value)diff --git a/MediaBrowser.Model/Dlna/ResolutionNormalizer.cs b/MediaBrowser.Model/Dlna/ResolutionNormalizer.csindex 950d3680df..ae74e255b0 100644--- a/MediaBrowser.Model/Dlna/ResolutionNormalizer.cs+++ b/MediaBrowser.Model/Dlna/ResolutionNormalizer.cs@@ -6,8 +6,8 @@ namespace MediaBrowser.Model.Dlna{public class ResolutionNormalizer{- private static readonly List<ResolutionConfiguration> Configurations =- new List<ResolutionConfiguration>+ private static readonly ResolutionConfiguration[] Configurations =+ new []{new ResolutionConfiguration(426, 320000),new ResolutionConfiguration(640, 400000),diff --git a/MediaBrowser.Model/Dlna/ResponseProfile.cs b/MediaBrowser.Model/Dlna/ResponseProfile.csindex f1a001bbab..742253fa35 100644--- a/MediaBrowser.Model/Dlna/ResponseProfile.cs+++ b/MediaBrowser.Model/Dlna/ResponseProfile.cs@@ -31,29 +31,19 @@ namespace MediaBrowser.Model.DlnaConditions = new ProfileCondition[] {};}- public List<string> GetContainers()+ public string[] GetContainers(){return ContainerProfile.SplitValue(Container);}- public List<string> GetAudioCodecs()+ public string[] GetAudioCodecs(){- List<string> list = new List<string>();- foreach (string i in (AudioCodec ?? string.Empty).Split(','))- {- if (!string.IsNullOrEmpty(i)) list.Add(i);- }- return list;+ return ContainerProfile.SplitValue(AudioCodec);}- public List<string> GetVideoCodecs()+ public string[] GetVideoCodecs(){- List<string> list = new List<string>();- foreach (string i in (VideoCodec ?? string.Empty).Split(','))- {- if (!string.IsNullOrEmpty(i)) list.Add(i);- }- return list;+ return ContainerProfile.SplitValue(VideoCodec);}}}diff --git a/MediaBrowser.Model/Dlna/StreamBuilder.cs b/MediaBrowser.Model/Dlna/StreamBuilder.csindex 189ed27e46..1cb7836699 100644--- a/MediaBrowser.Model/Dlna/StreamBuilder.cs+++ b/MediaBrowser.Model/Dlna/StreamBuilder.cs@@ -31,7 +31,7 @@ namespace MediaBrowser.Model.Dlna{ValidateAudioInput(options);- List<MediaSourceInfo> mediaSources = new List<MediaSourceInfo>();+ var mediaSources = new List<MediaSourceInfo>();foreach (MediaSourceInfo i in options.MediaSources){if (string.IsNullOrEmpty(options.MediaSourceId) ||@@ -41,7 +41,7 @@ namespace MediaBrowser.Model.Dlna}}- List<StreamInfo> streams = new List<StreamInfo>();+ var streams = new List<StreamInfo>();foreach (MediaSourceInfo i in mediaSources){StreamInfo streamInfo = BuildAudioItem(i, options);@@ -64,7 +64,7 @@ namespace MediaBrowser.Model.Dlna{ValidateInput(options);- List<MediaSourceInfo> mediaSources = new List<MediaSourceInfo>();+ var mediaSources = new List<MediaSourceInfo>();foreach (MediaSourceInfo i in options.MediaSources){if (string.IsNullOrEmpty(options.MediaSourceId) ||@@ -74,7 +74,7 @@ namespace MediaBrowser.Model.Dlna}}- List<StreamInfo> streams = new List<StreamInfo>();+ var streams = new List<StreamInfo>();foreach (MediaSourceInfo i in mediaSources){StreamInfo streamInfo = BuildVideoItem(i, options);@@ -95,9 +95,9 @@ namespace MediaBrowser.Model.Dlnaprivate StreamInfo GetOptimalStream(List<StreamInfo> streams, long? maxBitrate){- streams = StreamInfoSorter.SortMediaSources(streams, maxBitrate);+ var sorted = StreamInfoSorter.SortMediaSources(streams, maxBitrate);- foreach (StreamInfo stream in streams)+ foreach (StreamInfo stream in sorted){return stream;}@@ -206,7 +206,7 @@ namespace MediaBrowser.Model.Dlnavar formats = ContainerProfile.SplitValue(inputContainer);- if (formats.Count == 1)+ if (formats.Length == 1){return formats[0];}@@ -233,7 +233,7 @@ namespace MediaBrowser.Model.Dlnaprivate StreamInfo BuildAudioItem(MediaSourceInfo item, AudioOptions options){- List<TranscodeReason> transcodeReasons = new List<TranscodeReason>();+ var transcodeReasons = new List<TranscodeReason>();StreamInfo playlistItem = new StreamInfo{@@ -263,7 +263,7 @@ namespace MediaBrowser.Model.Dlnavar directPlayInfo = GetAudioDirectPlayMethods(item, audioStream, options);- List<PlayMethod> directPlayMethods = directPlayInfo.Item1;+ var directPlayMethods = directPlayInfo.Item1;transcodeReasons.AddRange(directPlayInfo.Item2);ConditionProcessor conditionProcessor = new ConditionProcessor();@@ -280,7 +280,7 @@ namespace MediaBrowser.Model.Dlna// Make sure audio codec profiles are satisfiedif (!string.IsNullOrEmpty(audioCodec)){- List<ProfileCondition> conditions = new List<ProfileCondition>();+ var conditions = new List<ProfileCondition>();foreach (CodecProfile i in options.Profile.CodecProfiles){if (i.Type == CodecType.Audio && i.ContainsCodec(audioCodec, item.Container))@@ -372,7 +372,7 @@ namespace MediaBrowser.Model.DlnaplaylistItem.SubProtocol = transcodingProfile.Protocol;- List<CodecProfile> audioCodecProfiles = new List<CodecProfile>();+ var audioCodecProfiles = new List<CodecProfile>();foreach (CodecProfile i in options.Profile.CodecProfiles){if (i.Type == CodecType.Audio && i.ContainsCodec(transcodingProfile.AudioCodec, transcodingProfile.Container))@@ -383,7 +383,7 @@ namespace MediaBrowser.Model.Dlnaif (audioCodecProfiles.Count >= 1) break;}- List<ProfileCondition> audioTranscodingConditions = new List<ProfileCondition>();+ var audioTranscodingConditions = new List<ProfileCondition>();foreach (CodecProfile i in audioCodecProfiles){bool applyConditions = true;@@ -447,7 +447,7 @@ namespace MediaBrowser.Model.Dlnaprivate Tuple<List<PlayMethod>, List<TranscodeReason>> GetAudioDirectPlayMethods(MediaSourceInfo item, MediaStream audioStream, AudioOptions options){- List<TranscodeReason> transcodeReasons = new List<TranscodeReason>();+ var transcodeReasons = new List<TranscodeReason>();DirectPlayProfile directPlayProfile = null;foreach (DirectPlayProfile i in options.Profile.DirectPlayProfiles)@@ -459,7 +459,7 @@ namespace MediaBrowser.Model.Dlna}}- List<PlayMethod> playMethods = new List<PlayMethod>();+ var playMethods = new List<PlayMethod>();if (directPlayProfile != null){@@ -534,8 +534,8 @@ namespace MediaBrowser.Model.Dlnaif (videoStream != null){// Check video codec- List<string> videoCodecs = profile.GetVideoCodecs();- if (videoCodecs.Count > 0)+ var videoCodecs = profile.GetVideoCodecs();+ if (videoCodecs.Length > 0){string videoCodec = videoStream.Codec;if (!string.IsNullOrEmpty(videoCodec) && ListHelper.ContainsIgnoreCase(videoCodecs, videoCodec))@@ -552,8 +552,8 @@ namespace MediaBrowser.Model.Dlnaif (audioStream != null){// Check audio codec- List<string> audioCodecs = profile.GetAudioCodecs();- if (audioCodecs.Count > 0)+ var audioCodecs = profile.GetAudioCodecs();+ if (audioCodecs.Length > 0){string audioCodec = audioStream.Codec;if (!string.IsNullOrEmpty(audioCodec) && ListHelper.ContainsIgnoreCase(audioCodecs, audioCodec))@@ -602,7 +602,7 @@ namespace MediaBrowser.Model.Dlna}}- List<MediaStream> topStreams = new List<MediaStream>();+ var topStreams = new List<MediaStream>();foreach (MediaStream stream in item.MediaStreams){if (stream.Type == MediaStreamType.Subtitle && stream.Score.HasValue && stream.Score.Value == highestScore)@@ -637,7 +637,7 @@ namespace MediaBrowser.Model.Dlnathrow new ArgumentNullException("item");}- List<TranscodeReason> transcodeReasons = new List<TranscodeReason>();+ var transcodeReasons = new List<TranscodeReason>();StreamInfo playlistItem = new StreamInfo{@@ -769,7 +769,7 @@ namespace MediaBrowser.Model.DlnaplaylistItem.AudioStreamIndex = audioStreamIndex;ConditionProcessor conditionProcessor = new ConditionProcessor();- List<ProfileCondition> videoTranscodingConditions = new List<ProfileCondition>();+ var videoTranscodingConditions = new List<ProfileCondition>();foreach (CodecProfile i in options.Profile.CodecProfiles){if (i.Type == CodecType.Video && i.ContainsCodec(transcodingProfile.VideoCodec, transcodingProfile.Container))@@ -804,7 +804,7 @@ namespace MediaBrowser.Model.Dlna}ApplyTranscodingConditions(playlistItem, videoTranscodingConditions);- List<ProfileCondition> audioTranscodingConditions = new List<ProfileCondition>();+ var audioTranscodingConditions = new List<ProfileCondition>();foreach (CodecProfile i in options.Profile.CodecProfiles){if (i.Type == CodecType.VideoAudio && i.ContainsCodec(playlistItem.TargetAudioCodec, transcodingProfile.Container))@@ -990,7 +990,7 @@ namespace MediaBrowser.Model.Dlnastring container = mediaSource.Container;- List<ProfileCondition> conditions = new List<ProfileCondition>();+ var conditions = new List<ProfileCondition>();foreach (ContainerProfile i in profile.ContainerProfiles){if (i.Type == DlnaProfileType.Video &&@@ -1578,8 +1578,8 @@ namespace MediaBrowser.Model.Dlna}// Check audio codec- List<string> audioCodecs = profile.GetAudioCodecs();- if (audioCodecs.Count > 0)+ var audioCodecs = profile.GetAudioCodecs();+ if (audioCodecs.Length > 0){// Check audio codecsstring audioCodec = audioStream == null ? null : audioStream.Codec;@@ -1601,8 +1601,8 @@ namespace MediaBrowser.Model.Dlna}// Check video codec- List<string> videoCodecs = profile.GetVideoCodecs();- if (videoCodecs.Count > 0)+ var videoCodecs = profile.GetVideoCodecs();+ if (videoCodecs.Length > 0){string videoCodec = videoStream == null ? null : videoStream.Codec;if (string.IsNullOrEmpty(videoCodec) || !ListHelper.ContainsIgnoreCase(videoCodecs, videoCodec))@@ -1614,8 +1614,8 @@ namespace MediaBrowser.Model.Dlna// Check audio codecif (audioStream != null){- List<string> audioCodecs = profile.GetAudioCodecs();- if (audioCodecs.Count > 0)+ var audioCodecs = profile.GetAudioCodecs();+ if (audioCodecs.Length > 0){// Check audio codecsstring audioCodec = audioStream == null ? null : audioStream.Codec;diff --git a/MediaBrowser.Model/Dlna/StreamInfoSorter.cs b/MediaBrowser.Model/Dlna/StreamInfoSorter.csindex badd3c5b11..e13b327672 100644--- a/MediaBrowser.Model/Dlna/StreamInfoSorter.cs+++ b/MediaBrowser.Model/Dlna/StreamInfoSorter.cs@@ -8,7 +8,7 @@ namespace MediaBrowser.Model.Dlna{public class StreamInfoSorter{- public static List<StreamInfo> SortMediaSources(List<StreamInfo> streams, long? maxBitrate)+ public static StreamInfo[] SortMediaSources(List<StreamInfo> streams, long? maxBitrate){return streams.OrderBy(i =>{@@ -54,7 +54,7 @@ namespace MediaBrowser.Model.Dlnareturn 0;- }).ToList();+ }).ToArray();}}}diff --git a/MediaBrowser.Model/Dlna/SubtitleProfile.cs b/MediaBrowser.Model/Dlna/SubtitleProfile.csindex f182541d8a..3f639a520a 100644--- a/MediaBrowser.Model/Dlna/SubtitleProfile.cs+++ b/MediaBrowser.Model/Dlna/SubtitleProfile.cs@@ -19,14 +19,9 @@ namespace MediaBrowser.Model.Dlna[XmlAttribute("language")]public string Language { get; set; }- public List<string> GetLanguages()+ public string[] GetLanguages(){- List<string> list = new List<string>();- foreach (string i in (Language ?? string.Empty).Split(','))- {- if (!string.IsNullOrEmpty(i)) list.Add(i);- }- return list;+ return ContainerProfile.SplitValue(Language);}public bool SupportsLanguage(string subLanguage)@@ -41,8 +36,8 @@ namespace MediaBrowser.Model.DlnasubLanguage = "und";}- List<string> languages = GetLanguages();- return languages.Count == 0 || ListHelper.ContainsIgnoreCase(languages, subLanguage);+ var languages = GetLanguages();+ return languages.Length == 0 || ListHelper.ContainsIgnoreCase(languages, subLanguage);}}}\ No newline at end of filediff --git a/MediaBrowser.Model/Dlna/TranscodingProfile.cs b/MediaBrowser.Model/Dlna/TranscodingProfile.csindex 9623a68b08..8453fdf6d6 100644--- a/MediaBrowser.Model/Dlna/TranscodingProfile.cs+++ b/MediaBrowser.Model/Dlna/TranscodingProfile.cs@@ -51,14 +51,9 @@ namespace MediaBrowser.Model.Dlna[XmlAttribute("breakOnNonKeyFrames")]public bool BreakOnNonKeyFrames { get; set; }- public List<string> GetAudioCodecs()+ public string[] GetAudioCodecs(){- List<string> list = new List<string>();- foreach (string i in (AudioCodec ?? string.Empty).Split(','))- {- if (!string.IsNullOrEmpty(i)) list.Add(i);- }- return list;+ return ContainerProfile.SplitValue(AudioCodec);}}}diff --git a/MediaBrowser.Model/Dto/BaseItemDto.cs b/MediaBrowser.Model/Dto/BaseItemDto.csindex e0e7e55aae..8da20c9f5b 100644--- a/MediaBrowser.Model/Dto/BaseItemDto.cs+++ b/MediaBrowser.Model/Dto/BaseItemDto.cs@@ -497,7 +497,7 @@ namespace MediaBrowser.Model.Dto/// Gets or sets the media streams./// </summary>/// <value>The media streams.</value>- public List<MediaStream> MediaStreams { get; set; }+ public MediaStream[] MediaStreams { get; set; }/// <summary>/// Gets or sets the type of the video.diff --git a/MediaBrowser.Model/Dto/GameSystemSummary.cs b/MediaBrowser.Model/Dto/GameSystemSummary.csindex 1da3bb0acd..2cd9d408db 100644--- a/MediaBrowser.Model/Dto/GameSystemSummary.cs+++ b/MediaBrowser.Model/Dto/GameSystemSummary.cs@@ -29,7 +29,7 @@ namespace MediaBrowser.Model.Dto/// Gets or sets the game extensions./// </summary>/// <value>The game extensions.</value>- public List<string> GameFileExtensions { get; set; }+ public string[] GameFileExtensions { get; set; }/// <summary>/// Gets or sets the client installed game count.@@ -42,7 +42,7 @@ namespace MediaBrowser.Model.Dto/// </summary>public GameSystemSummary(){- GameFileExtensions = new List<string>();+ GameFileExtensions = new string[] { };}}}diff --git a/MediaBrowser.Model/Dto/ItemLayout.cs b/MediaBrowser.Model/Dto/ItemLayout.csdeleted file mode 100644index c85818390d..0000000000--- a/MediaBrowser.Model/Dto/ItemLayout.cs+++ /dev/null@@ -1,72 +0,0 @@-using System;-using System.Collections.Generic;--namespace MediaBrowser.Model.Dto-{- public static class ItemLayout- {- public static double? GetDisplayAspectRatio(BaseItemDto item)- {- List<BaseItemDto> items = new List<BaseItemDto>();- items.Add(item);- return GetDisplayAspectRatio(items);- }-- public static double? GetDisplayAspectRatio(List<BaseItemDto> items)- {- List<double> values = new List<double>();-- foreach (BaseItemDto item in items)- {- if (item.PrimaryImageAspectRatio.HasValue)- {- values.Add(item.PrimaryImageAspectRatio.Value);- }- }-- if (values.Count == 0)- {- return null;- }-- values.Sort();-- double halfDouble = values.Count;- halfDouble /= 2;- int half = Convert.ToInt32(Math.Floor(halfDouble));-- double result;-- if (values.Count % 2 > 0)- result = values[half];- else- result = (values[half - 1] + values[half]) / 2.0;-- // If really close to 2:3 (poster image), just return 2:3- if (Math.Abs(0.66666666667 - result) <= .15)- {- return 0.66666666667;- }-- // If really close to 16:9 (episode image), just return 16:9- if (Math.Abs(1.777777778 - result) <= .2)- {- return 1.777777778;- }-- // If really close to 1 (square image), just return 1- if (Math.Abs(1 - result) <= .15)- {- return 1.0;- }-- // If really close to 4:3 (poster image), just return 2:3- if (Math.Abs(1.33333333333 - result) <= .15)- {- return 1.33333333333;- }-- return result;- }- }-}diff --git a/MediaBrowser.Model/Dto/MediaSourceInfo.cs b/MediaBrowser.Model/Dto/MediaSourceInfo.csindex 1bf67f66cc..488b1e7a86 100644--- a/MediaBrowser.Model/Dto/MediaSourceInfo.cs+++ b/MediaBrowser.Model/Dto/MediaSourceInfo.cs@@ -54,7 +54,7 @@ namespace MediaBrowser.Model.Dtopublic List<MediaStream> MediaStreams { get; set; }- public List<string> Formats { get; set; }+ public string[] Formats { get; set; }public int? Bitrate { get; set; }@@ -69,7 +69,7 @@ namespace MediaBrowser.Model.Dtopublic MediaSourceInfo(){- Formats = new List<string>();+ Formats = new string[] { };MediaStreams = new List<MediaStream>();RequiredHttpHeaders = new Dictionary<string, string>();SupportsTranscoding = true;diff --git a/MediaBrowser.Model/Dto/MetadataEditorInfo.cs b/MediaBrowser.Model/Dto/MetadataEditorInfo.csindex 9bd15fc8f6..aa8b33c817 100644--- a/MediaBrowser.Model/Dto/MetadataEditorInfo.cs+++ b/MediaBrowser.Model/Dto/MetadataEditorInfo.cs@@ -7,21 +7,21 @@ namespace MediaBrowser.Model.Dto{public class MetadataEditorInfo{- public List<ParentalRating> ParentalRatingOptions { get; set; }- public List<CountryInfo> Countries { get; set; }- public List<CultureDto> Cultures { get; set; }- public List<ExternalIdInfo> ExternalIdInfos { get; set; }+ public ParentalRating[] ParentalRatingOptions { get; set; }+ public CountryInfo[] Countries { get; set; }+ public CultureDto[] Cultures { get; set; }+ public ExternalIdInfo[] ExternalIdInfos { get; set; }public string ContentType { get; set; }- public List<NameValuePair> ContentTypeOptions { get; set; }+ public NameValuePair[] ContentTypeOptions { get; set; }public MetadataEditorInfo(){- ParentalRatingOptions = new List<ParentalRating>();- Countries = new List<CountryInfo>();- Cultures = new List<CultureDto>();- ExternalIdInfos = new List<ExternalIdInfo>();- ContentTypeOptions = new List<NameValuePair>();+ ParentalRatingOptions = new ParentalRating[] { };+ Countries = new CountryInfo[] { };+ Cultures = new CultureDto[] { };+ ExternalIdInfos = new ExternalIdInfo[] { };+ ContentTypeOptions = new NameValuePair[] { };}}}diff --git a/MediaBrowser.Model/Entities/LibraryUpdateInfo.cs b/MediaBrowser.Model/Entities/LibraryUpdateInfo.csindex 07a4b5f605..b3d3be70e8 100644--- a/MediaBrowser.Model/Entities/LibraryUpdateInfo.cs+++ b/MediaBrowser.Model/Entities/LibraryUpdateInfo.cs@@ -1,5 +1,4 @@-using System.Collections.Generic;-+namespace MediaBrowser.Model.Entities{/// <summary>@@ -11,41 +10,41 @@ namespace MediaBrowser.Model.Entities/// Gets or sets the folders added to./// </summary>/// <value>The folders added to.</value>- public List<string> FoldersAddedTo { get; set; }+ public string[] FoldersAddedTo { get; set; }/// <summary>/// Gets or sets the folders removed from./// </summary>/// <value>The folders removed from.</value>- public List<string> FoldersRemovedFrom { get; set; }+ public string[] FoldersRemovedFrom { get; set; }/// <summary>/// Gets or sets the items added./// </summary>/// <value>The items added.</value>- public List<string> ItemsAdded { get; set; }+ public string[] ItemsAdded { get; set; }/// <summary>/// Gets or sets the items removed./// </summary>/// <value>The items removed.</value>- public List<string> ItemsRemoved { get; set; }+ public string[] ItemsRemoved { get; set; }/// <summary>/// Gets or sets the items updated./// </summary>/// <value>The items updated.</value>- public List<string> ItemsUpdated { get; set; }+ public string[] ItemsUpdated { get; set; }/// <summary>/// Initializes a new instance of the <see cref="LibraryUpdateInfo"/> class./// </summary>public LibraryUpdateInfo(){- FoldersAddedTo = new List<string>();- FoldersRemovedFrom = new List<string>();- ItemsAdded = new List<string>();- ItemsRemoved = new List<string>();- ItemsUpdated = new List<string>();+ FoldersAddedTo = new string[] { };+ FoldersRemovedFrom = new string[] { };+ ItemsAdded = new string[] { };+ ItemsRemoved = new string[] { };+ ItemsUpdated = new string[] { };}}}diff --git a/MediaBrowser.Model/Entities/VirtualFolderInfo.cs b/MediaBrowser.Model/Entities/VirtualFolderInfo.csindex 374d8d028d..901090717f 100644--- a/MediaBrowser.Model/Entities/VirtualFolderInfo.cs+++ b/MediaBrowser.Model/Entities/VirtualFolderInfo.cs@@ -18,7 +18,7 @@ namespace MediaBrowser.Model.Entities/// Gets or sets the locations./// </summary>/// <value>The locations.</value>- public List<string> Locations { get; set; }+ public string[] Locations { get; set; }/// <summary>/// Gets or sets the type of the collection.@@ -33,7 +33,7 @@ namespace MediaBrowser.Model.Entities/// </summary>public VirtualFolderInfo(){- Locations = new List<string>();+ Locations = new string[] { };}/// <summary>diff --git a/MediaBrowser.Model/Extensions/ListHelper.cs b/MediaBrowser.Model/Extensions/ListHelper.csindex 741f07469c..cfcb229c8f 100644--- a/MediaBrowser.Model/Extensions/ListHelper.cs+++ b/MediaBrowser.Model/Extensions/ListHelper.cs@@ -6,15 +6,6 @@ namespace MediaBrowser.Model.Extensions{public static class ListHelper{- public static bool ContainsIgnoreCase(List<string> list, string value)- {- if (value == null)- {- throw new ArgumentNullException("value");- }-- return list.Contains(value, StringComparer.OrdinalIgnoreCase);- }public static bool ContainsIgnoreCase(string[] list, string value){if (value == null)diff --git a/MediaBrowser.Model/Globalization/ILocalizationManager.cs b/MediaBrowser.Model/Globalization/ILocalizationManager.csindex 47cec14593..2356a2fa19 100644--- a/MediaBrowser.Model/Globalization/ILocalizationManager.cs+++ b/MediaBrowser.Model/Globalization/ILocalizationManager.cs@@ -12,17 +12,17 @@ namespace MediaBrowser.Model.Globalization/// Gets the cultures./// </summary>/// <returns>IEnumerable{CultureDto}.</returns>- List<CultureDto> GetCultures();+ CultureDto[] GetCultures();/// <summary>/// Gets the countries./// </summary>/// <returns>IEnumerable{CountryInfo}.</returns>- List<CountryInfo> GetCountries();+ CountryInfo[] GetCountries();/// <summary>/// Gets the parental ratings./// </summary>/// <returns>IEnumerable{ParentalRating}.</returns>- IEnumerable<ParentalRating> GetParentalRatings();+ ParentalRating[] GetParentalRatings();/// <summary>/// Gets the rating level./// </summary>@@ -49,7 +49,7 @@ namespace MediaBrowser.Model.Globalization/// Gets the localization options./// </summary>/// <returns>IEnumerable{LocalizatonOption}.</returns>- IEnumerable<LocalizatonOption> GetLocalizationOptions();+ LocalizatonOption[] GetLocalizationOptions();string RemoveDiacritics(string text);diff --git a/MediaBrowser.Model/Health/IHealthMonitor.cs b/MediaBrowser.Model/Health/IHealthMonitor.csdeleted file mode 100644index a4f95c1bcc..0000000000--- a/MediaBrowser.Model/Health/IHealthMonitor.cs+++ /dev/null@@ -1,12 +0,0 @@-using System.Collections.Generic;-using System.Threading;-using System.Threading.Tasks;-using MediaBrowser.Model.Notifications;--namespace MediaBrowser.Model.Health-{- public interface IHealthMonitor- {- Task<List<Notification>> GetNotifications(CancellationToken cancellationToken);- }-}diff --git a/MediaBrowser.Model/LiveTv/BaseTimerInfoDto.cs b/MediaBrowser.Model/LiveTv/BaseTimerInfoDto.csindex 9d7fdd129e..7c9fe07909 100644--- a/MediaBrowser.Model/LiveTv/BaseTimerInfoDto.cs+++ b/MediaBrowser.Model/LiveTv/BaseTimerInfoDto.cs@@ -113,7 +113,7 @@ namespace MediaBrowser.Model.LiveTv/// Gets or sets the parent backdrop image tags./// </summary>/// <value>The parent backdrop image tags.</value>- public List<string> ParentBackdropImageTags { get; set; }+ public string[] ParentBackdropImageTags { get; set; }/// <summary>/// Gets or sets a value indicating whether this instance is post padding required.diff --git a/MediaBrowser.Model/LiveTv/ChannelInfoDto.cs b/MediaBrowser.Model/LiveTv/ChannelInfoDto.csindex a8ea864944..67e3d44dac 100644--- a/MediaBrowser.Model/LiveTv/ChannelInfoDto.cs+++ b/MediaBrowser.Model/LiveTv/ChannelInfoDto.cs@@ -41,7 +41,7 @@ namespace MediaBrowser.Model.LiveTv/// Gets or sets the media sources./// </summary>/// <value>The media sources.</value>- public List<MediaSourceInfo> MediaSources { get; set; }+ public MediaSourceInfo[] MediaSources { get; set; }/// <summary>/// Gets or sets the image tags.@@ -116,7 +116,7 @@ namespace MediaBrowser.Model.LiveTvpublic ChannelInfoDto(){ImageTags = new Dictionary<ImageType, string>();- MediaSources = new List<MediaSourceInfo>();+ MediaSources = new MediaSourceInfo[] { };}}}diff --git a/MediaBrowser.Model/LiveTv/LiveTvInfo.cs b/MediaBrowser.Model/LiveTv/LiveTvInfo.csindex f4d3e21d98..4620fbf0c6 100644--- a/MediaBrowser.Model/LiveTv/LiveTvInfo.cs+++ b/MediaBrowser.Model/LiveTv/LiveTvInfo.cs@@ -8,7 +8,7 @@ namespace MediaBrowser.Model.LiveTv/// Gets or sets the services./// </summary>/// <value>The services.</value>- public List<LiveTvServiceInfo> Services { get; set; }+ public LiveTvServiceInfo[] Services { get; set; }/// <summary>/// Gets or sets a value indicating whether this instance is enabled.@@ -20,12 +20,12 @@ namespace MediaBrowser.Model.LiveTv/// Gets or sets the enabled users./// </summary>/// <value>The enabled users.</value>- public List<string> EnabledUsers { get; set; }+ public string[] EnabledUsers { get; set; }public LiveTvInfo(){- Services = new List<LiveTvServiceInfo>();- EnabledUsers = new List<string>();+ Services = new LiveTvServiceInfo[] { };+ EnabledUsers = new string[] { };}}}\ No newline at end of filediff --git a/MediaBrowser.Model/LiveTv/LiveTvOptions.cs b/MediaBrowser.Model/LiveTv/LiveTvOptions.csindex a1df35b127..64b628a138 100644--- a/MediaBrowser.Model/LiveTv/LiveTvOptions.cs+++ b/MediaBrowser.Model/LiveTv/LiveTvOptions.cs@@ -15,8 +15,8 @@ namespace MediaBrowser.Model.LiveTvpublic bool EnableOriginalAudioWithEncodedRecordings { get; set; }public string RecordedVideoCodec { get; set; }- public List<TunerHostInfo> TunerHosts { get; set; }- public List<ListingsProviderInfo> ListingProviders { get; set; }+ public TunerHostInfo[] TunerHosts { get; set; }+ public ListingsProviderInfo[] ListingProviders { get; set; }public int PrePaddingSeconds { get; set; }public int PostPaddingSeconds { get; set; }@@ -28,8 +28,8 @@ namespace MediaBrowser.Model.LiveTvpublic LiveTvOptions(){- TunerHosts = new List<TunerHostInfo>();- ListingProviders = new List<ListingsProviderInfo>();+ TunerHosts = new TunerHostInfo[] { };+ ListingProviders = new ListingsProviderInfo[] { };MediaLocationsCreated = new string[] { };RecordingEncodingFormat = "mkv";RecordingPostProcessorArguments = "\"{path}\"";diff --git a/MediaBrowser.Model/LiveTv/LiveTvServiceInfo.cs b/MediaBrowser.Model/LiveTv/LiveTvServiceInfo.csindex 25d3b289f0..09ec4b9315 100644--- a/MediaBrowser.Model/LiveTv/LiveTvServiceInfo.cs+++ b/MediaBrowser.Model/LiveTv/LiveTvServiceInfo.cs@@ -48,11 +48,11 @@ namespace MediaBrowser.Model.LiveTv/// <value><c>true</c> if this instance is visible; otherwise, <c>false</c>.</value>public bool IsVisible { get; set; }- public List<LiveTvTunerInfoDto> Tuners { get; set; }+ public LiveTvTunerInfoDto[] Tuners { get; set; }public LiveTvServiceInfo(){- Tuners = new List<LiveTvTunerInfoDto>();+ Tuners = new LiveTvTunerInfoDto[] { };}}}diff --git a/MediaBrowser.Model/LiveTv/LiveTvTunerInfoDto.cs b/MediaBrowser.Model/LiveTv/LiveTvTunerInfoDto.csindex 9af96df434..937cef0571 100644--- a/MediaBrowser.Model/LiveTv/LiveTvTunerInfoDto.cs+++ b/MediaBrowser.Model/LiveTv/LiveTvTunerInfoDto.cs@@ -62,7 +62,7 @@ namespace MediaBrowser.Model.LiveTv/// Gets or sets the clients./// </summary>/// <value>The clients.</value>- public List<string> Clients { get; set; }+ public string[] Clients { get; set; }/// <summary>/// Gets or sets a value indicating whether this instance can reset.@@ -72,7 +72,7 @@ namespace MediaBrowser.Model.LiveTvpublic LiveTvTunerInfoDto(){- Clients = new List<string>();+ Clients = new string[] { };}}}\ No newline at end of filediff --git a/MediaBrowser.Model/LiveTv/SeriesTimerInfoDto.cs b/MediaBrowser.Model/LiveTv/SeriesTimerInfoDto.csindex 3880012874..743caa97ee 100644--- a/MediaBrowser.Model/LiveTv/SeriesTimerInfoDto.cs+++ b/MediaBrowser.Model/LiveTv/SeriesTimerInfoDto.cs@@ -15,7 +15,7 @@ namespace MediaBrowser.Model.LiveTvpublic SeriesTimerInfoDto(){ImageTags = new Dictionary<ImageType, string>();- Days = new List<DayOfWeek>();+ Days = new DayOfWeek[] { };Type = "SeriesTimer";}@@ -45,7 +45,7 @@ namespace MediaBrowser.Model.LiveTv/// Gets or sets the days./// </summary>/// <value>The days.</value>- public List<DayOfWeek> Days { get; set; }+ public DayOfWeek[] Days { get; set; }/// <summary>/// Gets or sets the day pattern.@@ -59,16 +59,6 @@ namespace MediaBrowser.Model.LiveTv/// <value>The image tags.</value>public Dictionary<ImageType, string> ImageTags { get; set; }- /// <summary>- /// Gets a value indicating whether this instance has primary image.- /// </summary>- /// <value><c>true</c> if this instance has primary image; otherwise, <c>false</c>.</value>- [IgnoreDataMember]- public bool HasPrimaryImage- {- get { return ImageTags != null && ImageTags.ContainsKey(ImageType.Primary); }- }-/// <summary>/// Gets or sets the parent thumb item id./// </summary>diff --git a/MediaBrowser.Model/MediaBrowser.Model.csproj b/MediaBrowser.Model/MediaBrowser.Model.csprojindex 0e4cc0623f..b36a773eb4 100644--- a/MediaBrowser.Model/MediaBrowser.Model.csproj+++ b/MediaBrowser.Model/MediaBrowser.Model.csproj@@ -111,7 +111,6 @@<Compile Include="Drawing\ImageOrientation.cs" /><Compile Include="Dto\IHasServerId.cs" /><Compile Include="Dto\IHasSyncInfo.cs" />- <Compile Include="Dto\ItemLayout.cs" /><Compile Include="Dto\MetadataEditorInfo.cs" /><Compile Include="Dto\NameIdPair.cs" /><Compile Include="Dto\NameValuePair.cs" />@@ -127,7 +126,6 @@<Compile Include="System\IPowerManagement.cs" /><Compile Include="Text\ITextEncoding.cs" /><Compile Include="Extensions\LinqExtensions.cs" />- <Compile Include="Health\IHealthMonitor.cs" /><Compile Include="IO\FileSystemMetadata.cs" /><Compile Include="IO\IFileSystem.cs" /><Compile Include="IO\IMemoryStreamFactory.cs" />@@ -413,7 +411,6 @@<Compile Include="Querying\ItemSortBy.cs" /><Compile Include="Dto\BaseItemDto.cs" /><Compile Include="Dto\UserDto.cs" />- <Compile Include="Querying\ItemsResult.cs" /><Compile Include="Entities\DisplayPreferences.cs" /><Compile Include="Entities\ImageType.cs" /><Compile Include="Entities\IHasProviderIds.cs" />diff --git a/MediaBrowser.Model/MediaInfo/BlurayDiscInfo.cs b/MediaBrowser.Model/MediaInfo/BlurayDiscInfo.csindex 963e8dd95e..1b573fba7a 100644--- a/MediaBrowser.Model/MediaInfo/BlurayDiscInfo.cs+++ b/MediaBrowser.Model/MediaInfo/BlurayDiscInfo.cs@@ -12,7 +12,7 @@ namespace MediaBrowser.Model.MediaInfo/// Gets or sets the media streams./// </summary>/// <value>The media streams.</value>- public List<MediaStream> MediaStreams { get; set; }+ public MediaStream[] MediaStreams { get; set; }/// <summary>/// Gets or sets the run time ticks.@@ -24,7 +24,7 @@ namespace MediaBrowser.Model.MediaInfo/// Gets or sets the files./// </summary>/// <value>The files.</value>- public List<string> Files { get; set; }+ public string[] Files { get; set; }public string PlaylistName { get; set; }@@ -32,6 +32,6 @@ namespace MediaBrowser.Model.MediaInfo/// Gets or sets the chapters./// </summary>/// <value>The chapters.</value>- public List<double> Chapters { get; set; }+ public double[] Chapters { get; set; }}}diff --git a/MediaBrowser.Model/MediaInfo/MediaInfo.cs b/MediaBrowser.Model/MediaInfo/MediaInfo.csindex 691dcc6c8f..63b1c9cfdb 100644--- a/MediaBrowser.Model/MediaInfo/MediaInfo.cs+++ b/MediaBrowser.Model/MediaInfo/MediaInfo.cs@@ -9,7 +9,7 @@ namespace MediaBrowser.Model.MediaInfo{private static readonly string[] EmptyStringArray = new string[] { };- public List<ChapterInfo> Chapters { get; set; }+ public ChapterInfo[] Chapters { get; set; }/// <summary>/// Gets or sets the album.@@ -20,7 +20,7 @@ namespace MediaBrowser.Model.MediaInfo/// Gets or sets the artists./// </summary>/// <value>The artists.</value>- public List<string> Artists { get; set; }+ public string[] Artists { get; set; }/// <summary>/// Gets or sets the album artists./// </summary>@@ -30,13 +30,13 @@ namespace MediaBrowser.Model.MediaInfo/// Gets or sets the studios./// </summary>/// <value>The studios.</value>- public List<string> Studios { get; set; }- public List<string> Genres { get; set; }+ public string[] Studios { get; set; }+ public string[] Genres { get; set; }public int? IndexNumber { get; set; }public int? ParentIndexNumber { get; set; }public int? ProductionYear { get; set; }public DateTime? PremiereDate { get; set; }- public List<BaseItemPerson> People { get; set; }+ public BaseItemPerson[] People { get; set; }public Dictionary<string, string> ProviderIds { get; set; }/// <summary>/// Gets or sets the official rating.@@ -56,12 +56,12 @@ namespace MediaBrowser.Model.MediaInfopublic MediaInfo(){- Chapters = new List<ChapterInfo>();- Artists = new List<string>();+ Chapters = new ChapterInfo[] { };+ Artists = new string[] { };AlbumArtists = EmptyStringArray;- Studios = new List<string>();- Genres = new List<string>();- People = new List<BaseItemPerson>();+ Studios = new string[] { };+ Genres = new string[] { };+ People = new BaseItemPerson[] { };ProviderIds = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase);}}diff --git a/MediaBrowser.Model/MediaInfo/PlaybackInfoResponse.cs b/MediaBrowser.Model/MediaInfo/PlaybackInfoResponse.csindex 1f8936d018..b38fec7d47 100644--- a/MediaBrowser.Model/MediaInfo/PlaybackInfoResponse.cs+++ b/MediaBrowser.Model/MediaInfo/PlaybackInfoResponse.cs@@ -10,7 +10,7 @@ namespace MediaBrowser.Model.MediaInfo/// Gets or sets the media sources./// </summary>/// <value>The media sources.</value>- public List<MediaSourceInfo> MediaSources { get; set; }+ public MediaSourceInfo[] MediaSources { get; set; }/// <summary>/// Gets or sets the play session identifier.@@ -26,7 +26,7 @@ namespace MediaBrowser.Model.MediaInfopublic PlaybackInfoResponse(){- MediaSources = new List<MediaSourceInfo>();+ MediaSources = new MediaSourceInfo[] { };}}}diff --git a/MediaBrowser.Model/MediaInfo/SubtitleTrackInfo.cs b/MediaBrowser.Model/MediaInfo/SubtitleTrackInfo.csindex 765cfe32fc..d3a3bb1d0b 100644--- a/MediaBrowser.Model/MediaInfo/SubtitleTrackInfo.cs+++ b/MediaBrowser.Model/MediaInfo/SubtitleTrackInfo.cs@@ -4,11 +4,11 @@ namespace MediaBrowser.Model.MediaInfo{public class SubtitleTrackInfo{- public List<SubtitleTrackEvent> TrackEvents { get; set; }+ public SubtitleTrackEvent[] TrackEvents { get; set; }public SubtitleTrackInfo(){- TrackEvents = new List<SubtitleTrackEvent>();+ TrackEvents = new SubtitleTrackEvent[] { };}}}diff --git a/MediaBrowser.Model/Net/MimeTypes.cs b/MediaBrowser.Model/Net/MimeTypes.csindex 7a2e1f2159..c4dfd25ca4 100644--- a/MediaBrowser.Model/Net/MimeTypes.cs+++ b/MediaBrowser.Model/Net/MimeTypes.cs@@ -14,7 +14,7 @@ namespace MediaBrowser.Model.Net/// <summary>/// Any extension in this list is considered a video file - can be added to at runtime for extensibility/// </summary>- private static readonly List<string> VideoFileExtensions = new List<string>+ private static readonly string[] VideoFileExtensions = new string[]{".mkv",".m2t",diff --git a/MediaBrowser.Model/Notifications/NotificationTypeInfo.cs b/MediaBrowser.Model/Notifications/NotificationTypeInfo.csindex 59b39fbc78..ee51010115 100644--- a/MediaBrowser.Model/Notifications/NotificationTypeInfo.cs+++ b/MediaBrowser.Model/Notifications/NotificationTypeInfo.cs@@ -18,11 +18,11 @@ namespace MediaBrowser.Model.Notificationspublic string DefaultDescription { get; set; }- public List<string> Variables { get; set; }+ public string[] Variables { get; set; }public NotificationTypeInfo(){- Variables = new List<string>();+ Variables = new string[] { };}}}\ No newline at end of filediff --git a/MediaBrowser.Model/Playlists/PlaylistCreationRequest.cs b/MediaBrowser.Model/Playlists/PlaylistCreationRequest.csindex 63deb19dcd..5314e791a3 100644--- a/MediaBrowser.Model/Playlists/PlaylistCreationRequest.cs+++ b/MediaBrowser.Model/Playlists/PlaylistCreationRequest.cs@@ -6,7 +6,7 @@ namespace MediaBrowser.Model.Playlists{public string Name { get; set; }- public List<string> ItemIdList { get; set; }+ public string[] ItemIdList { get; set; }public string MediaType { get; set; }@@ -14,7 +14,7 @@ namespace MediaBrowser.Model.Playlistspublic PlaylistCreationRequest(){- ItemIdList = new List<string>();+ ItemIdList = new string[] { };}}}diff --git a/MediaBrowser.Model/Providers/ImageProviderInfo.cs b/MediaBrowser.Model/Providers/ImageProviderInfo.csindex c519d66cb5..199552640f 100644--- a/MediaBrowser.Model/Providers/ImageProviderInfo.cs+++ b/MediaBrowser.Model/Providers/ImageProviderInfo.cs@@ -14,11 +14,11 @@ namespace MediaBrowser.Model.Providers/// <value>The name.</value>public string Name { get; set; }- public List<ImageType> SupportedImages { get; set; }+ public ImageType[] SupportedImages { get; set; }public ImageProviderInfo(){- SupportedImages = new List<ImageType>();+ SupportedImages = new ImageType[] { };}}}diff --git a/MediaBrowser.Model/Providers/RemoteImageResult.cs b/MediaBrowser.Model/Providers/RemoteImageResult.csindex 1c60db6ae1..7e38badfcf 100644--- a/MediaBrowser.Model/Providers/RemoteImageResult.cs+++ b/MediaBrowser.Model/Providers/RemoteImageResult.cs@@ -11,7 +11,7 @@ namespace MediaBrowser.Model.Providers/// Gets or sets the images./// </summary>/// <value>The images.</value>- public List<RemoteImageInfo> Images { get; set; }+ public RemoteImageInfo[] Images { get; set; }/// <summary>/// Gets or sets the total record count.@@ -23,6 +23,6 @@ namespace MediaBrowser.Model.Providers/// Gets or sets the providers./// </summary>/// <value>The providers.</value>- public List<string> Providers { get; set; }+ public string[] Providers { get; set; }}}diff --git a/MediaBrowser.Model/Querying/ItemsResult.cs b/MediaBrowser.Model/Querying/ItemsResult.csdeleted file mode 100644index 3b9c59733c..0000000000--- a/MediaBrowser.Model/Querying/ItemsResult.cs+++ /dev/null@@ -1,11 +0,0 @@-using MediaBrowser.Model.Dto;--namespace MediaBrowser.Model.Querying-{- /// <summary>- /// Represents the result of a query for items- /// </summary>- public class ItemsResult : QueryResult<BaseItemDto>- {- }-}diff --git a/MediaBrowser.Model/Querying/QueryResult.cs b/MediaBrowser.Model/Querying/QueryResult.csindex 1ecc1de6c4..6f9923d087 100644--- a/MediaBrowser.Model/Querying/QueryResult.cs+++ b/MediaBrowser.Model/Querying/QueryResult.cs@@ -15,9 +15,6 @@ namespace MediaBrowser.Model.Querying/// <value>The total record count.</value>public int TotalRecordCount { get; set; }- /// <summary>- /// Initializes a new instance of the <see cref="ItemsResult" /> class.- /// </summary>public QueryResult(){Items = new T[] { };diff --git a/MediaBrowser.Model/Querying/ThemeMediaResult.cs b/MediaBrowser.Model/Querying/ThemeMediaResult.csindex 80478a9102..0d7eb502f8 100644--- a/MediaBrowser.Model/Querying/ThemeMediaResult.cs+++ b/MediaBrowser.Model/Querying/ThemeMediaResult.cs@@ -1,10 +1,11 @@-+using MediaBrowser.Model.Dto;+namespace MediaBrowser.Model.Querying{/// <summary>/// Class ThemeMediaResult/// </summary>- public class ThemeMediaResult : ItemsResult+ public class ThemeMediaResult : QueryResult<BaseItemDto>{/// <summary>/// Gets or sets the owner id.diff --git a/MediaBrowser.Model/Session/ClientCapabilities.cs b/MediaBrowser.Model/Session/ClientCapabilities.csindex 222c1bd64b..9ae1fae9f4 100644--- a/MediaBrowser.Model/Session/ClientCapabilities.cs+++ b/MediaBrowser.Model/Session/ClientCapabilities.cs@@ -5,9 +5,9 @@ namespace MediaBrowser.Model.Session{public class ClientCapabilities{- public List<string> PlayableMediaTypes { get; set; }+ public string[] PlayableMediaTypes { get; set; }- public List<string> SupportedCommands { get; set; }+ public string[] SupportedCommands { get; set; }public bool SupportsMediaControl { get; set; }public bool SupportsContentUploading { get; set; }@@ -17,17 +17,17 @@ namespace MediaBrowser.Model.Sessionpublic bool SupportsSync { get; set; }public DeviceProfile DeviceProfile { get; set; }- public List<string> SupportedLiveMediaTypes { get; set; }+ public string[] SupportedLiveMediaTypes { get; set; }public string AppStoreUrl { get; set; }public string IconUrl { get; set; }public ClientCapabilities(){- PlayableMediaTypes = new List<string>();- SupportedCommands = new List<string>();+ PlayableMediaTypes = new string[] { };+ SupportedCommands = new string[] { };SupportsPersistentIdentifier = true;- SupportedLiveMediaTypes = new List<string>();+ SupportedLiveMediaTypes = new string[] { };}}}\ No newline at end of filediff --git a/MediaBrowser.Model/Session/SessionInfoDto.cs b/MediaBrowser.Model/Session/SessionInfoDto.csindex 3081d7ee3b..78ee72f619 100644--- a/MediaBrowser.Model/Session/SessionInfoDto.cs+++ b/MediaBrowser.Model/Session/SessionInfoDto.cs@@ -12,13 +12,13 @@ namespace MediaBrowser.Model.Session/// Gets or sets the supported commands./// </summary>/// <value>The supported commands.</value>- public List<string> SupportedCommands { get; set; }+ public string[] SupportedCommands { get; set; }/// <summary>/// Gets or sets the playable media types./// </summary>/// <value>The playable media types.</value>- public List<string> PlayableMediaTypes { get; set; }+ public string[] PlayableMediaTypes { get; set; }/// <summary>/// Gets or sets the id.@@ -50,7 +50,7 @@ namespace MediaBrowser.Model.Session/// Gets or sets the additional users present./// </summary>/// <value>The additional users present.</value>- public List<SessionUserInfo> AdditionalUsers { get; set; }+ public SessionUserInfo[] AdditionalUsers { get; set; }/// <summary>/// Gets or sets the application version.@@ -112,10 +112,10 @@ namespace MediaBrowser.Model.Sessionpublic SessionInfoDto(){- AdditionalUsers = new List<SessionUserInfo>();+ AdditionalUsers = new SessionUserInfo[] { };- PlayableMediaTypes = new List<string>();- SupportedCommands = new List<string>();+ PlayableMediaTypes = new string[] { };+ SupportedCommands = new string[] { };}}}diff --git a/MediaBrowser.Model/Session/TranscodingInfo.cs b/MediaBrowser.Model/Session/TranscodingInfo.csindex f58e605b28..70c299bc25 100644--- a/MediaBrowser.Model/Session/TranscodingInfo.cs+++ b/MediaBrowser.Model/Session/TranscodingInfo.cs@@ -18,11 +18,11 @@ namespace MediaBrowser.Model.Sessionpublic int? Height { get; set; }public int? AudioChannels { get; set; }- public List<TranscodeReason> TranscodeReasons { get; set; }+ public TranscodeReason[] TranscodeReasons { get; set; }public TranscodingInfo(){- TranscodeReasons = new List<TranscodeReason>();+ TranscodeReasons = new TranscodeReason[] { };}}diff --git a/MediaBrowser.Model/Session/UserDataChangeInfo.cs b/MediaBrowser.Model/Session/UserDataChangeInfo.csindex f92f445860..c6b03200d2 100644--- a/MediaBrowser.Model/Session/UserDataChangeInfo.cs+++ b/MediaBrowser.Model/Session/UserDataChangeInfo.cs@@ -18,6 +18,6 @@ namespace MediaBrowser.Model.Session/// Gets or sets the user data list./// </summary>/// <value>The user data list.</value>- public List<UserItemDataDto> UserDataList { get; set; }+ public UserItemDataDto[] UserDataList { get; set; }}}diff --git a/MediaBrowser.Model/Sync/CompleteSyncJobInfo.cs b/MediaBrowser.Model/Sync/CompleteSyncJobInfo.csindex 52d3fab3c0..adfb84b055 100644--- a/MediaBrowser.Model/Sync/CompleteSyncJobInfo.cs+++ b/MediaBrowser.Model/Sync/CompleteSyncJobInfo.cs@@ -5,11 +5,11 @@ namespace MediaBrowser.Model.Syncpublic class CompleteSyncJobInfo{public SyncJob Job { get; set; }- public List<SyncJobItem> JobItems { get; set; }+ public SyncJobItem[] JobItems { get; set; }public CompleteSyncJobInfo(){- JobItems = new List<SyncJobItem>();+ JobItems = new SyncJobItem[] { };}}}diff --git a/MediaBrowser.Model/Sync/LocalItem.cs b/MediaBrowser.Model/Sync/LocalItem.csindex c5728ac97e..3d625aa998 100644--- a/MediaBrowser.Model/Sync/LocalItem.cs+++ b/MediaBrowser.Model/Sync/LocalItem.cs@@ -44,17 +44,17 @@ namespace MediaBrowser.Model.Sync/// Gets or sets the user ids with access./// </summary>/// <value>The user ids with access.</value>- public List<string> UserIdsWithAccess { get; set; }+ public string[] UserIdsWithAccess { get; set; }/// <summary>/// Gets or sets the additional files./// </summary>/// <value>The additional files.</value>- public List<string> AdditionalFiles { get; set; }+ public string[] AdditionalFiles { get; set; }public LocalItem(){- AdditionalFiles = new List<string>();- UserIdsWithAccess = new List<string>();+ AdditionalFiles = new string[] { };+ UserIdsWithAccess = new string[] { };}}}diff --git a/MediaBrowser.Model/Sync/SyncDataRequest.cs b/MediaBrowser.Model/Sync/SyncDataRequest.csindex 0df4de86d1..c0941caee5 100644--- a/MediaBrowser.Model/Sync/SyncDataRequest.cs+++ b/MediaBrowser.Model/Sync/SyncDataRequest.cs@@ -4,16 +4,16 @@ namespace MediaBrowser.Model.Sync{public class SyncDataRequest{- public List<string> LocalItemIds { get; set; }- public List<string> OfflineUserIds { get; set; }- public List<string> SyncJobItemIds { get; set; }+ public string[] LocalItemIds { get; set; }+ public string[] OfflineUserIds { get; set; }+ public string[] SyncJobItemIds { get; set; }public string TargetId { get; set; }public SyncDataRequest(){- LocalItemIds = new List<string>();- OfflineUserIds = new List<string>();+ LocalItemIds = new string[] { };+ OfflineUserIds = new string[] { };}}}diff --git a/MediaBrowser.Model/Sync/SyncDataResponse.cs b/MediaBrowser.Model/Sync/SyncDataResponse.csindex 3799e94557..0b017af6e1 100644--- a/MediaBrowser.Model/Sync/SyncDataResponse.cs+++ b/MediaBrowser.Model/Sync/SyncDataResponse.cs@@ -1,16 +1,13 @@-using System.Collections.Generic;-+namespace MediaBrowser.Model.Sync{public class SyncDataResponse{- public List<string> ItemIdsToRemove { get; set; }- public Dictionary<string, List<string>> ItemUserAccess { get; set; }+ public string[] ItemIdsToRemove { get; set; }public SyncDataResponse(){- ItemIdsToRemove = new List<string>();- ItemUserAccess = new Dictionary<string, List<string>>();+ ItemIdsToRemove = new string[] { };}}}diff --git a/MediaBrowser.Model/Sync/SyncDialogOptions.cs b/MediaBrowser.Model/Sync/SyncDialogOptions.csindex a987a6cd69..e55ca4f085 100644--- a/MediaBrowser.Model/Sync/SyncDialogOptions.cs+++ b/MediaBrowser.Model/Sync/SyncDialogOptions.cs@@ -8,29 +8,29 @@ namespace MediaBrowser.Model.Sync/// Gets or sets the targets./// </summary>/// <value>The targets.</value>- public List<SyncTarget> Targets { get; set; }+ public SyncTarget[] Targets { get; set; }/// <summary>/// Gets or sets the options./// </summary>/// <value>The options.</value>- public List<SyncJobOption> Options { get; set; }+ public SyncJobOption[] Options { get; set; }/// <summary>/// Gets or sets the quality options./// </summary>/// <value>The quality options.</value>- public List<SyncQualityOption> QualityOptions { get; set; }+ public SyncQualityOption[] QualityOptions { get; set; }/// <summary>/// Gets or sets the profile options./// </summary>/// <value>The profile options.</value>- public List<SyncProfileOption> ProfileOptions { get; set; }+ public SyncProfileOption[] ProfileOptions { get; set; }public SyncDialogOptions(){- Targets = new List<SyncTarget>();- Options = new List<SyncJobOption>();- QualityOptions = new List<SyncQualityOption>();- ProfileOptions = new List<SyncProfileOption>();+ Targets = new SyncTarget[] { };+ Options = new SyncJobOption[] { };+ QualityOptions = new SyncQualityOption[] { };+ ProfileOptions = new SyncProfileOption[] { };}}}diff --git a/MediaBrowser.Model/Sync/SyncJob.cs b/MediaBrowser.Model/Sync/SyncJob.csindex eb153427c7..e8b698f62d 100644--- a/MediaBrowser.Model/Sync/SyncJob.cs+++ b/MediaBrowser.Model/Sync/SyncJob.cs@@ -84,7 +84,7 @@ namespace MediaBrowser.Model.Sync/// Gets or sets the requested item ids./// </summary>/// <value>The requested item ids.</value>- public List<string> RequestedItemIds { get; set; }+ public string[] RequestedItemIds { get; set; }/// <summary>/// Gets or sets the date created./// </summary>@@ -107,7 +107,7 @@ namespace MediaBrowser.Model.Syncpublic SyncJob(){- RequestedItemIds = new List<string>();+ RequestedItemIds = new string[] { };}}}diff --git a/MediaBrowser.Model/Sync/SyncJobCreationResult.cs b/MediaBrowser.Model/Sync/SyncJobCreationResult.csindex 6723aa2cf7..ee46bc155b 100644--- a/MediaBrowser.Model/Sync/SyncJobCreationResult.cs+++ b/MediaBrowser.Model/Sync/SyncJobCreationResult.cs@@ -5,11 +5,11 @@ namespace MediaBrowser.Model.Syncpublic class SyncJobCreationResult{public SyncJob Job { get; set; }- public List<SyncJobItem> JobItems { get; set; }+ public SyncJobItem[] JobItems { get; set; }public SyncJobCreationResult(){- JobItems = new List<SyncJobItem>();+ JobItems = new SyncJobItem[] { };}}}diff --git a/MediaBrowser.Model/Sync/SyncJobItem.cs b/MediaBrowser.Model/Sync/SyncJobItem.csindex 9fb275823a..5a97bc92e7 100644--- a/MediaBrowser.Model/Sync/SyncJobItem.cs+++ b/MediaBrowser.Model/Sync/SyncJobItem.cs@@ -90,7 +90,7 @@ namespace MediaBrowser.Model.Sync/// Gets or sets the additional files./// </summary>/// <value>The additional files.</value>- public List<ItemFileInfo> AdditionalFiles { get; set; }+ public ItemFileInfo[] AdditionalFiles { get; set; }/// <summary>/// Gets or sets the index of the job item./// </summary>@@ -101,7 +101,7 @@ namespace MediaBrowser.Model.Syncpublic SyncJobItem(){- AdditionalFiles = new List<ItemFileInfo>();+ AdditionalFiles = new ItemFileInfo[] { };}}}diff --git a/MediaBrowser.Model/Sync/SyncJobRequest.cs b/MediaBrowser.Model/Sync/SyncJobRequest.csindex a96c86ed9c..3dc863b757 100644--- a/MediaBrowser.Model/Sync/SyncJobRequest.cs+++ b/MediaBrowser.Model/Sync/SyncJobRequest.cs@@ -13,7 +13,7 @@ namespace MediaBrowser.Model.Sync/// Gets or sets the item ids./// </summary>/// <value>The item ids.</value>- public List<string> ItemIds { get; set; }+ public string[] ItemIds { get; set; }/// <summary>/// Gets or sets the category./// </summary>@@ -67,7 +67,7 @@ namespace MediaBrowser.Model.Syncpublic SyncJobRequest(){- ItemIds = new List<string>();+ ItemIds = new string[] { };SyncNewContent = true;}}diff --git a/MediaBrowser.Model/Sync/SyncedItem.cs b/MediaBrowser.Model/Sync/SyncedItem.csindex 4dedcfd2dc..68bd8a2ebf 100644--- a/MediaBrowser.Model/Sync/SyncedItem.cs+++ b/MediaBrowser.Model/Sync/SyncedItem.cs@@ -50,11 +50,11 @@ namespace MediaBrowser.Model.Sync/// Gets or sets the additional files./// </summary>/// <value>The additional files.</value>- public List<ItemFileInfo> AdditionalFiles { get; set; }+ public ItemFileInfo[] AdditionalFiles { get; set; }public SyncedItem(){- AdditionalFiles = new List<ItemFileInfo>();+ AdditionalFiles = new ItemFileInfo[] { };}}}diff --git a/MediaBrowser.Model/System/SystemInfo.cs b/MediaBrowser.Model/System/SystemInfo.csindex 4154093cba..fce9dea4f1 100644--- a/MediaBrowser.Model/System/SystemInfo.cs+++ b/MediaBrowser.Model/System/SystemInfo.cs@@ -46,7 +46,7 @@ namespace MediaBrowser.Model.System/// Gets or sets the in progress installations./// </summary>/// <value>The in progress installations.</value>- public List<InstallationInfo> InProgressInstallations { get; set; }+ public InstallationInfo[] InProgressInstallations { get; set; }/// <summary>/// Gets or sets the web socket port number.@@ -58,7 +58,7 @@ namespace MediaBrowser.Model.System/// Gets or sets the completed installations./// </summary>/// <value>The completed installations.</value>- public List<InstallationInfo> CompletedInstallations { get; set; }+ public InstallationInfo[] CompletedInstallations { get; set; }/// <summary>/// Gets or sets a value indicating whether this instance can self restart.@@ -76,7 +76,7 @@ namespace MediaBrowser.Model.System/// Gets or sets plugin assemblies that failed to load./// </summary>/// <value>The failed assembly loads.</value>- public List<string> FailedPluginAssemblies { get; set; }+ public string[] FailedPluginAssemblies { get; set; }/// <summary>/// Gets or sets the program data path.@@ -153,11 +153,11 @@ namespace MediaBrowser.Model.System/// </summary>public SystemInfo(){- InProgressInstallations = new List<InstallationInfo>();+ InProgressInstallations = new InstallationInfo[] { };- CompletedInstallations = new List<InstallationInfo>();+ CompletedInstallations = new InstallationInfo[] { };- FailedPluginAssemblies = new List<string>();+ FailedPluginAssemblies = new string[] { };}}}diff --git a/MediaBrowser.Model/Updates/PackageInfo.cs b/MediaBrowser.Model/Updates/PackageInfo.csindex 208d5b784f..e46d59fc07 100644--- a/MediaBrowser.Model/Updates/PackageInfo.cs+++ b/MediaBrowser.Model/Updates/PackageInfo.cs@@ -151,7 +151,7 @@ namespace MediaBrowser.Model.Updates/// Gets or sets the versions./// </summary>/// <value>The versions.</value>- public List<PackageVersionInfo> versions { get; set; }+ public PackageVersionInfo[] versions { get; set; }/// <summary>/// Gets or sets a value indicating whether [enable in application store].@@ -170,7 +170,7 @@ namespace MediaBrowser.Model.Updates/// </summary>public PackageInfo(){- versions = new List<PackageVersionInfo>();+ versions = new PackageVersionInfo[] { };}}}diff --git a/MediaBrowser.Providers/Manager/ProviderManager.cs b/MediaBrowser.Providers/Manager/ProviderManager.csindex 139bd6d588..d249b6b002 100644--- a/MediaBrowser.Providers/Manager/ProviderManager.cs+++ b/MediaBrowser.Providers/Manager/ProviderManager.cs@@ -24,6 +24,7 @@ using MediaBrowser.Controller.Dto;using MediaBrowser.Model.Events;using MediaBrowser.Model.Serialization;using Priority_Queue;+using MediaBrowser.Model.Extensions;namespace MediaBrowser.Providers.Manager{@@ -235,7 +236,7 @@ namespace MediaBrowser.Providers.Managerreturn GetRemoteImageProviders(item, true).Select(i => new ImageProviderInfo{Name = i.Name,- SupportedImages = i.GetSupportedImages(item).ToList()+ SupportedImages = i.GetSupportedImages(item).ToArray()});}@@ -435,9 +436,9 @@ namespace MediaBrowser.Providers.Managerreturn 0;}- public IEnumerable<MetadataPluginSummary> GetAllMetadataPlugins()+ public MetadataPluginSummary[] GetAllMetadataPlugins(){- var list = new List<MetadataPluginSummary>+ return new MetadataPluginSummary[]{GetPluginSummary<Game>(),GetPluginSummary<GameSystem>(),@@ -462,8 +463,6 @@ namespace MediaBrowser.Providers.ManagerGetPluginSummary<LiveTvVideoRecording>(),GetPluginSummary<LiveTvAudioRecording>()};-- return list;}private MetadataPluginSummary GetPluginSummary<T>()@@ -485,8 +484,12 @@ namespace MediaBrowser.Providers.Managervar imageProviders = GetImageProviders(dummy, options, new ImageRefreshOptions(new DirectoryService(_logger, _fileSystem)), true).ToList();- AddMetadataPlugins(summary.Plugins, dummy, options);- AddImagePlugins(summary.Plugins, dummy, imageProviders);+ var pluginList = summary.Plugins.ToList();++ AddMetadataPlugins(pluginList, dummy, options);+ AddImagePlugins(pluginList, dummy, imageProviders);++ summary.Plugins = pluginList.ToArray(pluginList.Count);var supportedImageTypes = imageProviders.OfType<IRemoteImageProvider>().SelectMany(i => i.GetSupportedImages(dummy))@@ -495,7 +498,7 @@ namespace MediaBrowser.Providers.ManagersupportedImageTypes.AddRange(imageProviders.OfType<IDynamicImageProvider>().SelectMany(i => i.GetSupportedImages(dummy)));- summary.SupportedImageTypes = supportedImageTypes.Distinct().ToList();+ summary.SupportedImageTypes = supportedImageTypes.Distinct().ToArray();return summary;}diff --git a/MediaBrowser.Providers/MediaInfo/FFProbeAudioInfo.cs b/MediaBrowser.Providers/MediaInfo/FFProbeAudioInfo.csindex b0785298b8..fb1fed8b3f 100644--- a/MediaBrowser.Providers/MediaInfo/FFProbeAudioInfo.cs+++ b/MediaBrowser.Providers/MediaInfo/FFProbeAudioInfo.cs@@ -141,7 +141,7 @@ namespace MediaBrowser.Providers.MediaInfo}audio.Album = data.Album;- audio.Artists = data.Artists;+ audio.Artists = data.Artists.ToList();audio.AlbumArtists = data.AlbumArtists;audio.IndexNumber = data.IndexNumber;audio.ParentIndexNumber = data.ParentIndexNumber;diff --git a/MediaBrowser.Providers/MediaInfo/FFProbeVideoInfo.cs b/MediaBrowser.Providers/MediaInfo/FFProbeVideoInfo.csindex 791a5c57b3..ea8d7bdb0b 100644--- a/MediaBrowser.Providers/MediaInfo/FFProbeVideoInfo.cs+++ b/MediaBrowser.Providers/MediaInfo/FFProbeVideoInfo.cs@@ -80,7 +80,7 @@ namespace MediaBrowser.Providers.MediaInfotry{- List<string> streamFileNames = null;+ string[] streamFileNames = null;if (item.VideoType == VideoType.Iso){@@ -91,7 +91,7 @@ namespace MediaBrowser.Providers.MediaInfo{streamFileNames = FetchFromDvdLib(item, isoMount);- if (streamFileNames.Count == 0)+ if (streamFileNames.Length == 0){_logger.Error("No playable vobs found in dvd structure, skipping ffprobe.");return ItemUpdateType.MetadataImport;@@ -106,7 +106,7 @@ namespace MediaBrowser.Providers.MediaInfostreamFileNames = blurayDiscInfo.Files;- if (streamFileNames.Count == 0)+ if (streamFileNames.Length == 0){_logger.Error("No playable vobs found in bluray structure, skipping ffprobe.");return ItemUpdateType.MetadataImport;@@ -115,7 +115,7 @@ namespace MediaBrowser.Providers.MediaInfoif (streamFileNames == null){- streamFileNames = new List<string>();+ streamFileNames = new string[] { };}var result = await GetMediaInfo(item, isoMount, streamFileNames, cancellationToken).ConfigureAwait(false);@@ -138,7 +138,7 @@ namespace MediaBrowser.Providers.MediaInfoprivate Task<Model.MediaInfo.MediaInfo> GetMediaInfo(Video item,IIsoMount isoMount,- List<string> streamFileNames,+ string[] streamFileNames,CancellationToken cancellationToken){cancellationToken.ThrowIfCancellationRequested();@@ -193,7 +193,7 @@ namespace MediaBrowser.Providers.MediaInfo}video.Container = mediaInfo.Container;- var chapters = mediaInfo.Chapters ?? new List<ChapterInfo>();+ var chapters = mediaInfo.Chapters == null ? new List<ChapterInfo>() : mediaInfo.Chapters.ToList();if (blurayInfo != null){FetchBdInfo(video, chapters, mediaStreams, blurayInfo);@@ -266,7 +266,7 @@ namespace MediaBrowser.Providers.MediaInfo//video.PlayableStreamFileNames = blurayInfo.Files.ToList();// Use BD Info if it has multiple m2ts. Otherwise, treat it like a video file and rely more on ffprobe output- if (blurayInfo.Files.Count > 1)+ if (blurayInfo.Files.Length > 1){int? currentHeight = null;int? currentWidth = null;@@ -551,7 +551,7 @@ namespace MediaBrowser.Providers.MediaInfo}}- private List<string> FetchFromDvdLib(Video item, IIsoMount mount)+ private string[] FetchFromDvdLib(Video item, IIsoMount mount){var path = mount == null ? item.Path : mount.MountedPath;var dvd = new Dvd(path, _fileSystem);@@ -568,7 +568,7 @@ namespace MediaBrowser.Providers.MediaInforeturn GetPrimaryPlaylistVobFiles(item, mount, titleNumber).Select(Path.GetFileName)- .ToList();+ .ToArray();}private long GetRuntime(Title title)diff --git a/MediaBrowser.Providers/Subtitles/SubtitleManager.cs b/MediaBrowser.Providers/Subtitles/SubtitleManager.csindex fce95364ef..fe655759e1 100644--- a/MediaBrowser.Providers/Subtitles/SubtitleManager.cs+++ b/MediaBrowser.Providers/Subtitles/SubtitleManager.cs@@ -48,12 +48,12 @@ namespace MediaBrowser.Providers.Subtitles_subtitleProviders = subtitleProviders.ToArray();}- public async Task<IEnumerable<RemoteSubtitleInfo>> SearchSubtitles(SubtitleSearchRequest request, CancellationToken cancellationToken)+ public async Task<RemoteSubtitleInfo[]> SearchSubtitles(SubtitleSearchRequest request, CancellationToken cancellationToken){var contentType = request.ContentType;var providers = _subtitleProviders.Where(i => i.SupportedMediaTypes.Contains(contentType))- .ToList();+ .ToArray();// If not searching all, search one at a time until something is foundif (!request.SearchAllProviders)@@ -64,9 +64,9 @@ namespace MediaBrowser.Providers.Subtitles{var searchResults = await provider.Search(request, cancellationToken).ConfigureAwait(false);- var list = searchResults.ToList();+ var list = searchResults.ToArray();- if (list.Count > 0)+ if (list.Length > 0){Normalize(list);return list;@@ -77,7 +77,7 @@ namespace MediaBrowser.Providers.Subtitles_logger.ErrorException("Error downloading subtitles from {0}", ex, provider.Name);}}- return new List<RemoteSubtitleInfo>();+ return new RemoteSubtitleInfo[] { };}var tasks = providers.Select(async i =>@@ -86,20 +86,20 @@ namespace MediaBrowser.Providers.Subtitles{var searchResults = await i.Search(request, cancellationToken).ConfigureAwait(false);- var list = searchResults.ToList();+ var list = searchResults.ToArray();Normalize(list);return list;}catch (Exception ex){_logger.ErrorException("Error downloading subtitles from {0}", ex, i.Name);- return new List<RemoteSubtitleInfo>();+ return new RemoteSubtitleInfo[] { };}});var results = await Task.WhenAll(tasks).ConfigureAwait(false);- return results.SelectMany(i => i);+ return results.SelectMany(i => i).ToArray();}public async Task DownloadSubtitles(Video video,@@ -173,12 +173,12 @@ namespace MediaBrowser.Providers.Subtitles}}- public Task<IEnumerable<RemoteSubtitleInfo>> SearchSubtitles(Video video, string language, bool? isPerfectMatch, CancellationToken cancellationToken)+ public Task<RemoteSubtitleInfo[]> SearchSubtitles(Video video, string language, bool? isPerfectMatch, CancellationToken cancellationToken){if (video.LocationType != LocationType.FileSystem ||video.VideoType != VideoType.VideoFile){- return Task.FromResult<IEnumerable<RemoteSubtitleInfo>>(new List<RemoteSubtitleInfo>());+ return Task.FromResult<RemoteSubtitleInfo[]>(new RemoteSubtitleInfo[] { });}VideoContentType mediaType;@@ -194,7 +194,7 @@ namespace MediaBrowser.Providers.Subtitleselse{// These are the only supported types- return Task.FromResult<IEnumerable<RemoteSubtitleInfo>>(new List<RemoteSubtitleInfo>());+ return Task.FromResult<RemoteSubtitleInfo[]>(new RemoteSubtitleInfo[] { });}var request = new SubtitleSearchRequest@@ -275,7 +275,7 @@ namespace MediaBrowser.Providers.Subtitlesreturn provider.GetSubtitles(id, cancellationToken);}- public IEnumerable<SubtitleProviderInfo> GetProviders(string itemId)+ public SubtitleProviderInfo[] GetProviders(string itemId){var video = _libraryManager.GetItemById(itemId) as Video;VideoContentType mediaType;@@ -291,17 +291,17 @@ namespace MediaBrowser.Providers.Subtitleselse{// These are the only supported types- return new List<SubtitleProviderInfo>();+ return new SubtitleProviderInfo[] { };}- var providers = _subtitleProviders- .Where(i => i.SupportedMediaTypes.Contains(mediaType));+ return _subtitleProviders+ .Where(i => i.SupportedMediaTypes.Contains(mediaType))+ .Select(i => new SubtitleProviderInfo+ {+ Name = i.Name,+ Id = GetProviderId(i.Name)- return providers.Select(i => new SubtitleProviderInfo- {- Name = i.Name,- Id = GetProviderId(i.Name)- });+ }).ToArray();}}diff --git a/MediaBrowser.Providers/TV/SeasonMetadataService.cs b/MediaBrowser.Providers/TV/SeasonMetadataService.csindex c10b0ef9db..7cd4087911 100644--- a/MediaBrowser.Providers/TV/SeasonMetadataService.cs+++ b/MediaBrowser.Providers/TV/SeasonMetadataService.cs@@ -9,7 +9,7 @@ using System;using System.Collections.Generic;using System.Linq;using System.Threading.Tasks;-+using MediaBrowser.Controller.Entities;using MediaBrowser.Controller.IO;using MediaBrowser.Model.IO;@@ -32,7 +32,7 @@ namespace MediaBrowser.Providers.TVif (isFullRefresh || currentUpdateType > ItemUpdateType.None){- var episodes = item.GetEpisodes().ToList();+ var episodes = item.GetEpisodes();updateType |= SavePremiereDate(item, episodes);updateType |= SaveIsVirtualItem(item, episodes);}@@ -66,7 +66,7 @@ namespace MediaBrowser.Providers.TVProviderUtils.MergeBaseItemData(source, target, lockedFields, replaceData, mergeMetadataSettings);}- private ItemUpdateType SavePremiereDate(Season item, List<Episode> episodes)+ private ItemUpdateType SavePremiereDate(Season item, List<BaseItem> episodes){var dates = episodes.Where(i => i.PremiereDate.HasValue).Select(i => i.PremiereDate.Value).ToList();@@ -86,7 +86,7 @@ namespace MediaBrowser.Providers.TVreturn ItemUpdateType.None;}- private ItemUpdateType SaveIsVirtualItem(Season item, List<Episode> episodes)+ private ItemUpdateType SaveIsVirtualItem(Season item, List<BaseItem> episodes){var isVirtualItem = item.LocationType == LocationType.Virtual && (episodes.Count == 0 || episodes.All(i => i.LocationType == LocationType.Virtual));diff --git a/MediaBrowser.Tests/MediaEncoding/Subtitles/AssParserTests.cs b/MediaBrowser.Tests/MediaEncoding/Subtitles/AssParserTests.csindex 47f5891c6e..dde9f2fe2c 100644--- a/MediaBrowser.Tests/MediaEncoding/Subtitles/AssParserTests.cs+++ b/MediaBrowser.Tests/MediaEncoding/Subtitles/AssParserTests.cs@@ -17,7 +17,7 @@ namespace MediaBrowser.Tests.MediaEncoding.Subtitles {var expectedSubs =new SubtitleTrackInfo {- TrackEvents = new List<SubtitleTrackEvent> {+ TrackEvents = new SubtitleTrackEvent[] {new SubtitleTrackEvent {Id = "1",StartPositionTicks = 24000000,@@ -48,8 +48,8 @@ namespace MediaBrowser.Tests.MediaEncoding.Subtitles {var result = sut.Parse(stream, CancellationToken.None);Assert.IsNotNull(result);- Assert.AreEqual(expectedSubs.TrackEvents.Count,result.TrackEvents.Count);- for (int i = 0; i < expectedSubs.TrackEvents.Count; i++)+ Assert.AreEqual(expectedSubs.TrackEvents.Length,result.TrackEvents.Length);+ for (int i = 0; i < expectedSubs.TrackEvents.Length; i++){Assert.AreEqual(expectedSubs.TrackEvents[i].Id, result.TrackEvents[i].Id);Assert.AreEqual(expectedSubs.TrackEvents[i].StartPositionTicks, result.TrackEvents[i].StartPositionTicks);diff --git a/MediaBrowser.Tests/MediaEncoding/Subtitles/SrtParserTests.cs b/MediaBrowser.Tests/MediaEncoding/Subtitles/SrtParserTests.csindex 280dc5d785..8acc490e7a 100644--- a/MediaBrowser.Tests/MediaEncoding/Subtitles/SrtParserTests.cs+++ b/MediaBrowser.Tests/MediaEncoding/Subtitles/SrtParserTests.cs@@ -20,7 +20,7 @@ namespace MediaBrowser.Tests.MediaEncoding.Subtitlesvar expectedSubs =new SubtitleTrackInfo{- TrackEvents = new List<SubtitleTrackEvent> {+ TrackEvents = new SubtitleTrackEvent[] {new SubtitleTrackEvent {Id = "1",StartPositionTicks = 24000000,@@ -100,8 +100,8 @@ namespace MediaBrowser.Tests.MediaEncoding.Subtitlesvar result = sut.Parse(stream, CancellationToken.None);Assert.IsNotNull(result);- Assert.AreEqual(expectedSubs.TrackEvents.Count, result.TrackEvents.Count);- for (int i = 0; i < expectedSubs.TrackEvents.Count; i++)+ Assert.AreEqual(expectedSubs.TrackEvents.Length, result.TrackEvents.Length);+ for (int i = 0; i < expectedSubs.TrackEvents.Length; i++){Assert.AreEqual(expectedSubs.TrackEvents[i].Id, result.TrackEvents[i].Id);Assert.AreEqual(expectedSubs.TrackEvents[i].StartPositionTicks, result.TrackEvents[i].StartPositionTicks);diff --git a/MediaBrowser.Tests/MediaEncoding/Subtitles/VttWriterTest.cs b/MediaBrowser.Tests/MediaEncoding/Subtitles/VttWriterTest.csindex f6e2c5298e..00feb286c7 100644--- a/MediaBrowser.Tests/MediaEncoding/Subtitles/VttWriterTest.cs+++ b/MediaBrowser.Tests/MediaEncoding/Subtitles/VttWriterTest.cs@@ -14,7 +14,7 @@ namespace MediaBrowser.Tests.MediaEncoding.Subtitles {var infoSubs =new SubtitleTrackInfo{- TrackEvents = new List<SubtitleTrackEvent> {+ TrackEvents = new SubtitleTrackEvent[] {new SubtitleTrackEvent {Id = "1",StartPositionTicks = 24000000,diff --git a/Nuget/MediaBrowser.Common.nuspec b/Nuget/MediaBrowser.Common.nuspecindex d9e6fdc7d9..94c00a6027 100644--- a/Nuget/MediaBrowser.Common.nuspec+++ b/Nuget/MediaBrowser.Common.nuspec@@ -2,7 +2,7 @@<package xmlns="http://schemas.microsoft.com/packaging/2011/08/nuspec.xsd"><metadata><id>MediaBrowser.Common</id>- <version>3.0.730</version>+ <version>3.0.734</version><title>Emby.Common</title><authors>Emby Team</authors><owners>ebr,Luke,scottisafool</owners>diff --git a/Nuget/MediaBrowser.Server.Core.nuspec b/Nuget/MediaBrowser.Server.Core.nuspecindex b79e0c4353..99c9af0959 100644--- a/Nuget/MediaBrowser.Server.Core.nuspec+++ b/Nuget/MediaBrowser.Server.Core.nuspec@@ -2,7 +2,7 @@<package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd"><metadata><id>MediaBrowser.Server.Core</id>- <version>3.0.730</version>+ <version>3.0.734</version><title>Emby.Server.Core</title><authors>Emby Team</authors><owners>ebr,Luke,scottisafool</owners>@@ -12,7 +12,7 @@<description>Contains core components required to build plugins for Emby Server.</description><copyright>Copyright © Emby 2013</copyright><dependencies>- <dependency id="MediaBrowser.Common" version="3.0.730" />+ <dependency id="MediaBrowser.Common" version="3.0.734" /></dependencies></metadata><files>