diff --git a/Emby.Common.Implementations/Emby.Common.Implementations.csproj b/Emby.Common.Implementations/Emby.Common.Implementations.csproj index 879e8e82f9..cbd077e199 100644 --- a/Emby.Common.Implementations/Emby.Common.Implementations.csproj +++ b/Emby.Common.Implementations/Emby.Common.Implementations.csproj @@ -34,8 +34,9 @@ ..\packages\NLog.4.4.12\lib\net45\NLog.dll - - ..\packages\ServiceStack.Text.4.5.12\lib\net45\ServiceStack.Text.dll + + ..\packages\ServiceStack.Text.4.5.8\lib\net45\ServiceStack.Text.dll + True ..\packages\SharpCompress.0.14.0\lib\net45\SharpCompress.dll diff --git a/Emby.Common.Implementations/packages.config b/Emby.Common.Implementations/packages.config index a9fc75af68..eb8fd586ef 100644 --- a/Emby.Common.Implementations/packages.config +++ b/Emby.Common.Implementations/packages.config @@ -1,7 +1,7 @@  - + \ No newline at end of file diff --git a/Emby.Server.Implementations/Channels/ChannelManager.cs b/Emby.Server.Implementations/Channels/ChannelManager.cs index 5e97cd5f5c..e41e0ea87f 100644 --- a/Emby.Server.Implementations/Channels/ChannelManager.cs +++ b/Emby.Server.Implementations/Channels/ChannelManager.cs @@ -1344,7 +1344,7 @@ namespace Emby.Server.Implementations.Channels var hasAlbumArtists = item as IHasAlbumArtist; if (hasAlbumArtists != null) { - hasAlbumArtists.AlbumArtists = info.AlbumArtists; + hasAlbumArtists.AlbumArtists = info.AlbumArtists.ToArray(info.AlbumArtists.Count); } var trailer = item as Trailer; diff --git a/Emby.Server.Implementations/Collections/CollectionManager.cs b/Emby.Server.Implementations/Collections/CollectionManager.cs index 4e5d344a3f..5b168f6cc1 100644 --- a/Emby.Server.Implementations/Collections/CollectionManager.cs +++ b/Emby.Server.Implementations/Collections/CollectionManager.cs @@ -12,6 +12,7 @@ using System.Linq; using System.Threading; using System.Threading.Tasks; using MediaBrowser.Model.IO; +using MediaBrowser.Model.Extensions; namespace Emby.Server.Implementations.Collections { @@ -190,7 +191,9 @@ namespace Emby.Server.Implementations.Collections if (list.Count > 0) { - collection.LinkedChildren.AddRange(list); + var newList = collection.LinkedChildren.ToList(); + newList.AddRange(list); + collection.LinkedChildren = newList.ToArray(newList.Count); collection.UpdateRatingToContent(); @@ -241,9 +244,9 @@ namespace Emby.Server.Implementations.Collections } } - foreach (var child in list) + if (list.Count > 0) { - collection.LinkedChildren.Remove(child); + collection.LinkedChildren = collection.LinkedChildren.Except(list).ToArray(); } collection.UpdateRatingToContent(); diff --git a/Emby.Server.Implementations/Data/SqliteItemRepository.cs b/Emby.Server.Implementations/Data/SqliteItemRepository.cs index 23d46e8211..b7e2687ec8 100644 --- a/Emby.Server.Implementations/Data/SqliteItemRepository.cs +++ b/Emby.Server.Implementations/Data/SqliteItemRepository.cs @@ -1037,9 +1037,9 @@ namespace Emby.Server.Implementations.Data var hasAlbumArtists = item as IHasAlbumArtist; if (hasAlbumArtists != null) { - if (hasAlbumArtists.AlbumArtists.Count > 0) + if (hasAlbumArtists.AlbumArtists.Length > 0) { - albumArtists = string.Join("|", hasAlbumArtists.AlbumArtists.ToArray()); + albumArtists = string.Join("|", hasAlbumArtists.AlbumArtists); } } saveItemStatement.TryBind("@AlbumArtists", albumArtists); @@ -1927,7 +1927,7 @@ namespace Emby.Server.Implementations.Data var hasAlbumArtists = item as IHasAlbumArtist; if (hasAlbumArtists != null && !reader.IsDBNull(index)) { - hasAlbumArtists.AlbumArtists = reader.GetString(index).Split('|').Where(i => !string.IsNullOrWhiteSpace(i)).ToList(); + hasAlbumArtists.AlbumArtists = reader.GetString(index).Split(new[] { '|' }, StringSplitOptions.RemoveEmptyEntries); } index++; } @@ -1995,7 +1995,7 @@ namespace Emby.Server.Implementations.Data /// The id. /// IEnumerable{ChapterInfo}. /// id - public IEnumerable GetChapters(Guid id) + public List GetChapters(Guid id) { CheckDisposed(); if (id == Guid.Empty) @@ -2091,18 +2091,7 @@ namespace Emby.Server.Implementations.Data /// /// Saves the chapters. /// - /// The id. - /// The chapters. - /// The cancellation token. - /// Task. - /// - /// id - /// or - /// chapters - /// or - /// cancellationToken - /// - public async Task SaveChapters(Guid id, List chapters, CancellationToken cancellationToken) + public async Task SaveChapters(Guid id, List chapters) { CheckDisposed(); @@ -2116,8 +2105,6 @@ namespace Emby.Server.Implementations.Data throw new ArgumentNullException("chapters"); } - cancellationToken.ThrowIfCancellationRequested(); - var index = 0; using (WriteLock.Write()) @@ -2826,7 +2813,7 @@ namespace Emby.Server.Implementations.Data var slowThreshold = 1000; #if DEBUG - slowThreshold = 2; + slowThreshold = 10; #endif if (elapsed >= slowThreshold) diff --git a/Emby.Server.Implementations/Dto/DtoService.cs b/Emby.Server.Implementations/Dto/DtoService.cs index 098e11720b..bf70cc19b4 100644 --- a/Emby.Server.Implementations/Dto/DtoService.cs +++ b/Emby.Server.Implementations/Dto/DtoService.cs @@ -993,7 +993,7 @@ namespace Emby.Server.Implementations.Dto { dto.RemoteTrailers = hasTrailers != null ? hasTrailers.RemoteTrailers : - new List(); + new MediaUrl[] {}; } dto.Name = item.Name; @@ -1172,8 +1172,7 @@ namespace Emby.Server.Implementations.Dto // }) // .ToList(); - dto.AlbumArtists = new List(); - dto.AlbumArtists.AddRange(hasAlbumArtist.AlbumArtists + dto.AlbumArtists = hasAlbumArtist.AlbumArtists //.Except(foundArtists, new DistinctNameComparer()) .Select(i => { @@ -1198,7 +1197,7 @@ namespace Emby.Server.Implementations.Dto return null; - }).Where(i => i != null)); + }).Where(i => i != null).ToArray(); } // Add video info @@ -1214,9 +1213,9 @@ namespace Emby.Server.Implementations.Dto dto.HasSubtitles = video.HasSubtitles; } - if (video.AdditionalParts.Count != 0) + if (video.AdditionalParts.Length != 0) { - dto.PartCount = video.AdditionalParts.Count + 1; + dto.PartCount = video.AdditionalParts.Length + 1; } if (fields.Contains(ItemFields.MediaSourceCount)) diff --git a/Emby.Server.Implementations/Emby.Server.Implementations.csproj b/Emby.Server.Implementations/Emby.Server.Implementations.csproj index 8ebd28bf72..d4976196cb 100644 --- a/Emby.Server.Implementations/Emby.Server.Implementations.csproj +++ b/Emby.Server.Implementations/Emby.Server.Implementations.csproj @@ -367,8 +367,9 @@ ..\packages\Microsoft.IO.RecyclableMemoryStream.1.2.2\lib\net45\Microsoft.IO.RecyclableMemoryStream.dll - - ..\packages\ServiceStack.Text.4.5.12\lib\net45\ServiceStack.Text.dll + + ..\packages\ServiceStack.Text.4.5.8\lib\net45\ServiceStack.Text.dll + True ..\packages\SimpleInjector.4.0.8\lib\net45\SimpleInjector.dll diff --git a/Emby.Server.Implementations/Library/LocalTrailerPostScanTask.cs b/Emby.Server.Implementations/Library/LocalTrailerPostScanTask.cs index 83bee89e05..757e67eb49 100644 --- a/Emby.Server.Implementations/Library/LocalTrailerPostScanTask.cs +++ b/Emby.Server.Implementations/Library/LocalTrailerPostScanTask.cs @@ -91,7 +91,7 @@ namespace Emby.Server.Implementations.Library }); var trailerIds = trailers.Select(i => i.Id) - .ToList(); + .ToArray(); if (!trailerIds.SequenceEqual(item.RemoteTrailerIds)) { diff --git a/Emby.Server.Implementations/Library/Resolvers/Movies/MovieResolver.cs b/Emby.Server.Implementations/Library/Resolvers/Movies/MovieResolver.cs index d88076b994..d7cc1a7f7e 100644 --- a/Emby.Server.Implementations/Library/Resolvers/Movies/MovieResolver.cs +++ b/Emby.Server.Implementations/Library/Resolvers/Movies/MovieResolver.cs @@ -159,8 +159,8 @@ namespace Emby.Server.Implementations.Library.Resolvers.Movies IsInMixedFolder = isInMixedFolder, ProductionYear = video.Year, Name = video.Name, - AdditionalParts = video.Files.Skip(1).Select(i => i.Path).ToList(), - LocalAlternateVersions = video.AlternateVersions.Select(i => i.Path).ToList() + AdditionalParts = video.Files.Skip(1).Select(i => i.Path).ToArray(), + LocalAlternateVersions = video.AlternateVersions.Select(i => i.Path).ToArray() }; SetVideoType(videoItem, firstVideo); @@ -503,7 +503,7 @@ namespace Emby.Server.Implementations.Library.Resolvers.Movies { Path = folderPaths[0], - AdditionalParts = folderPaths.Skip(1).ToList(), + AdditionalParts = folderPaths.Skip(1).ToArray(), VideoType = videoTypes[0], diff --git a/Emby.Server.Implementations/MediaEncoder/EncodingManager.cs b/Emby.Server.Implementations/MediaEncoder/EncodingManager.cs index 884f46f1fb..7ee6e9e38b 100644 --- a/Emby.Server.Implementations/MediaEncoder/EncodingManager.cs +++ b/Emby.Server.Implementations/MediaEncoder/EncodingManager.cs @@ -84,13 +84,8 @@ namespace Emby.Server.Implementations.MediaEncoder /// private static readonly long FirstChapterTicks = TimeSpan.FromSeconds(15).Ticks; - public async Task RefreshChapterImages(ChapterImageRefreshOptions options, CancellationToken cancellationToken) + public async Task RefreshChapterImages(Video video, List chapters, bool extractImages, bool saveChapters, CancellationToken cancellationToken) { - var extractImages = options.ExtractImages; - var video = options.Video; - var chapters = options.Chapters; - var saveChapters = options.SaveChapters; - if (!IsEligibleForChapterImageExtraction(video)) { extractImages = false; @@ -179,7 +174,7 @@ namespace Emby.Server.Implementations.MediaEncoder if (saveChapters && changesMade) { - await _chapterManager.SaveChapters(video.Id.ToString(), chapters, cancellationToken).ConfigureAwait(false); + await _chapterManager.SaveChapters(video.Id.ToString(), chapters).ConfigureAwait(false); } DeleteDeadImages(currentImages, chapters); diff --git a/Emby.Server.Implementations/Playlists/PlaylistManager.cs b/Emby.Server.Implementations/Playlists/PlaylistManager.cs index e0e133e38d..578a2321cc 100644 --- a/Emby.Server.Implementations/Playlists/PlaylistManager.cs +++ b/Emby.Server.Implementations/Playlists/PlaylistManager.cs @@ -12,10 +12,9 @@ using System.IO; using System.Linq; using System.Threading; using System.Threading.Tasks; - using MediaBrowser.Controller.Dto; -using MediaBrowser.Controller.IO; using MediaBrowser.Model.IO; +using MediaBrowser.Model.Extensions; namespace Emby.Server.Implementations.Playlists { @@ -164,7 +163,7 @@ namespace Emby.Server.Implementations.Playlists return path; } - private IEnumerable GetPlaylistItems(IEnumerable itemIds, string playlistMediaType, User user, DtoOptions options) + private List GetPlaylistItems(IEnumerable itemIds, string playlistMediaType, User user, DtoOptions options) { var items = itemIds.Select(i => _libraryManager.GetItemById(i)).Where(i => i != null); @@ -206,7 +205,9 @@ namespace Emby.Server.Implementations.Playlists list.Add(LinkedChild.Create(item)); } - playlist.LinkedChildren.AddRange(list); + var newList = playlist.LinkedChildren.ToList(); + newList.AddRange(list); + playlist.LinkedChildren = newList.ToArray(newList.Count); await playlist.UpdateToRepository(ItemUpdateType.MetadataEdit, CancellationToken.None).ConfigureAwait(false); @@ -234,7 +235,7 @@ namespace Emby.Server.Implementations.Playlists playlist.LinkedChildren = children.Except(removals) .Select(i => i.Item1) - .ToList(); + .ToArray(); await playlist.UpdateToRepository(ItemUpdateType.MetadataEdit, CancellationToken.None).ConfigureAwait(false); @@ -265,17 +266,21 @@ namespace Emby.Server.Implementations.Playlists var item = playlist.LinkedChildren[oldIndex]; - playlist.LinkedChildren.Remove(item); + var newList = playlist.LinkedChildren.ToList(); - if (newIndex >= playlist.LinkedChildren.Count) + newList.Remove(item); + + if (newIndex >= newList.Count) { - playlist.LinkedChildren.Add(item); + newList.Add(item); } else { - playlist.LinkedChildren.Insert(newIndex, item); + newList.Insert(newIndex, item); } + playlist.LinkedChildren = newList.ToArray(newList.Count); + await playlist.UpdateToRepository(ItemUpdateType.MetadataEdit, CancellationToken.None).ConfigureAwait(false); } diff --git a/Emby.Server.Implementations/ScheduledTasks/ChapterImagesTask.cs b/Emby.Server.Implementations/ScheduledTasks/ChapterImagesTask.cs index 91ae2afd1c..ec371c741f 100644 --- a/Emby.Server.Implementations/ScheduledTasks/ChapterImagesTask.cs +++ b/Emby.Server.Implementations/ScheduledTasks/ChapterImagesTask.cs @@ -124,16 +124,9 @@ namespace Emby.Server.Implementations.ScheduledTasks try { - var chapters = _itemRepo.GetChapters(video.Id).ToList(); + var chapters = _itemRepo.GetChapters(video.Id); - var success = await _encodingManager.RefreshChapterImages(new ChapterImageRefreshOptions - { - SaveChapters = true, - ExtractImages = extract, - Video = video, - Chapters = chapters - - }, CancellationToken.None); + var success = await _encodingManager.RefreshChapterImages(video, chapters, extract, true, CancellationToken.None); if (!success) { diff --git a/Emby.Server.Implementations/packages.config b/Emby.Server.Implementations/packages.config index c86812ee00..3675e1950e 100644 --- a/Emby.Server.Implementations/packages.config +++ b/Emby.Server.Implementations/packages.config @@ -3,7 +3,7 @@ - + diff --git a/MediaBrowser.Api/ItemUpdateService.cs b/MediaBrowser.Api/ItemUpdateService.cs index a4b6c39562..68b30ec1e2 100644 --- a/MediaBrowser.Api/ItemUpdateService.cs +++ b/MediaBrowser.Api/ItemUpdateService.cs @@ -347,7 +347,7 @@ namespace MediaBrowser.Api hasAlbumArtists.AlbumArtists = request .AlbumArtists .Select(i => i.Name) - .ToList(); + .ToArray(); } } diff --git a/MediaBrowser.Api/Reports/Data/ReportBuilder.cs b/MediaBrowser.Api/Reports/Data/ReportBuilder.cs index e137ffc464..5339fa64b7 100644 --- a/MediaBrowser.Api/Reports/Data/ReportBuilder.cs +++ b/MediaBrowser.Api/Reports/Data/ReportBuilder.cs @@ -513,7 +513,7 @@ namespace MediaBrowser.Api.Reports internalHeader = HeaderMetadata.AlbumArtist; break; case HeaderMetadata.AudioAlbumArtist: - option.Column = (i, r) => this.GetListAsString(this.GetObject>(i, (x) => x.AlbumArtists)); + option.Column = (i, r) => this.GetListAsString(this.GetObject>(i, (x) => x.AlbumArtists.ToList())); option.Header.SortField = "AlbumArtist,Album,SortName"; internalHeader = HeaderMetadata.AlbumArtist; break; diff --git a/MediaBrowser.Api/VideosService.cs b/MediaBrowser.Api/VideosService.cs index 729b50c1f4..57d3d7e394 100644 --- a/MediaBrowser.Api/VideosService.cs +++ b/MediaBrowser.Api/VideosService.cs @@ -126,7 +126,7 @@ namespace MediaBrowser.Api await link.UpdateToRepository(ItemUpdateType.MetadataEdit, CancellationToken.None).ConfigureAwait(false); } - video.LinkedAlternateVersions.Clear(); + video.LinkedAlternateVersions = Video.EmptyLinkedChildArray; await video.UpdateToRepository(ItemUpdateType.MetadataEdit, CancellationToken.None).ConfigureAwait(false); } @@ -185,19 +185,23 @@ namespace MediaBrowser.Api }).First(); } + var list = primaryVersion.LinkedAlternateVersions.ToList(); + foreach (var item in items.Where(i => i.Id != primaryVersion.Id)) { item.PrimaryVersionId = primaryVersion.Id.ToString("N"); await item.UpdateToRepository(ItemUpdateType.MetadataEdit, CancellationToken.None).ConfigureAwait(false); - primaryVersion.LinkedAlternateVersions.Add(new LinkedChild + list.Add(new LinkedChild { Path = item.Path, ItemId = item.Id }); } + primaryVersion.LinkedAlternateVersions = list.ToArray(); + await primaryVersion.UpdateToRepository(ItemUpdateType.MetadataEdit, CancellationToken.None).ConfigureAwait(false); } } diff --git a/MediaBrowser.Controller/Chapters/IChapterManager.cs b/MediaBrowser.Controller/Chapters/IChapterManager.cs index 05517ebcd4..85feec40b7 100644 --- a/MediaBrowser.Controller/Chapters/IChapterManager.cs +++ b/MediaBrowser.Controller/Chapters/IChapterManager.cs @@ -1,7 +1,5 @@ using System.Collections.Generic; -using System.Threading; using System.Threading.Tasks; -using MediaBrowser.Model.Configuration; using MediaBrowser.Model.Entities; namespace MediaBrowser.Controller.Chapters @@ -21,10 +19,6 @@ namespace MediaBrowser.Controller.Chapters /// /// Saves the chapters. /// - /// The item identifier. - /// The chapters. - /// The cancellation token. - /// Task. - Task SaveChapters(string itemId, List chapters, CancellationToken cancellationToken); + Task SaveChapters(string itemId, List chapters); } } diff --git a/MediaBrowser.Controller/Entities/Audio/Audio.cs b/MediaBrowser.Controller/Entities/Audio/Audio.cs index 9761aad4ff..0781dc35b0 100644 --- a/MediaBrowser.Controller/Entities/Audio/Audio.cs +++ b/MediaBrowser.Controller/Entities/Audio/Audio.cs @@ -32,7 +32,7 @@ namespace MediaBrowser.Controller.Entities.Audio public List Artists { get; set; } [IgnoreDataMember] - public List AlbumArtists { get; set; } + public string[] AlbumArtists { get; set; } [IgnoreDataMember] public override bool EnableRefreshOnDateModifiedChange @@ -43,7 +43,7 @@ namespace MediaBrowser.Controller.Entities.Audio public Audio() { Artists = new List(); - AlbumArtists = new List(); + AlbumArtists = EmptyStringArray; } public override double? GetDefaultPrimaryImageAspectRatio() diff --git a/MediaBrowser.Controller/Entities/Audio/IHasAlbumArtist.cs b/MediaBrowser.Controller/Entities/Audio/IHasAlbumArtist.cs index a7c914664e..6900699e59 100644 --- a/MediaBrowser.Controller/Entities/Audio/IHasAlbumArtist.cs +++ b/MediaBrowser.Controller/Entities/Audio/IHasAlbumArtist.cs @@ -5,7 +5,7 @@ namespace MediaBrowser.Controller.Entities.Audio { public interface IHasAlbumArtist { - List AlbumArtists { get; set; } + string[] AlbumArtists { get; set; } } public interface IHasArtist diff --git a/MediaBrowser.Controller/Entities/Audio/MusicAlbum.cs b/MediaBrowser.Controller/Entities/Audio/MusicAlbum.cs index 516ab50530..c35e818265 100644 --- a/MediaBrowser.Controller/Entities/Audio/MusicAlbum.cs +++ b/MediaBrowser.Controller/Entities/Audio/MusicAlbum.cs @@ -19,13 +19,13 @@ namespace MediaBrowser.Controller.Entities.Audio /// public class MusicAlbum : Folder, IHasAlbumArtist, IHasArtist, IHasMusicGenres, IHasLookupInfo, IMetadataContainer { - public List AlbumArtists { get; set; } + public string[] AlbumArtists { get; set; } public List Artists { get; set; } public MusicAlbum() { Artists = new List(); - AlbumArtists = new List(); + AlbumArtists = EmptyStringArray; } [IgnoreDataMember] diff --git a/MediaBrowser.Controller/Entities/BaseItem.cs b/MediaBrowser.Controller/Entities/BaseItem.cs index 16ad008271..8cc90db7d4 100644 --- a/MediaBrowser.Controller/Entities/BaseItem.cs +++ b/MediaBrowser.Controller/Entities/BaseItem.cs @@ -44,7 +44,9 @@ namespace MediaBrowser.Controller.Entities protected static Guid[] EmptyGuidArray = new Guid[] { }; protected static MetadataFields[] EmptyMetadataFieldsArray = new MetadataFields[] { }; protected static string[] EmptyStringArray = new string[] { }; + protected static MediaUrl[] EmptyMediaUrlArray = new MediaUrl[] { }; protected static ItemImageInfo[] EmptyItemImageInfoArray = new ItemImageInfo[] { }; + public static readonly LinkedChild[] EmptyLinkedChildArray = new LinkedChild[] { }; protected BaseItem() { @@ -1169,7 +1171,7 @@ namespace MediaBrowser.Controller.Entities { var newItems = LibraryManager.FindTrailers(this, fileSystemChildren, options.DirectoryService).ToList(); - var newItemIds = newItems.Select(i => i.Id).ToList(); + var newItemIds = newItems.Select(i => i.Id).ToArray(); var itemsChanged = !item.LocalTrailerIds.SequenceEqual(newItemIds); diff --git a/MediaBrowser.Controller/Entities/CollectionFolder.cs b/MediaBrowser.Controller/Entities/CollectionFolder.cs index 9e9624aae5..f314d82c13 100644 --- a/MediaBrowser.Controller/Entities/CollectionFolder.cs +++ b/MediaBrowser.Controller/Entities/CollectionFolder.cs @@ -249,7 +249,7 @@ namespace MediaBrowser.Controller.Entities var changed = !linkedChildren.SequenceEqual(LinkedChildren, new LinkedChildComparer(FileSystem)); - LinkedChildren = linkedChildren; + LinkedChildren = linkedChildren.ToArray(linkedChildren.Count); var folderIds = PhysicalFolderIds.ToList(); var newFolderIds = physicalFolders.Select(i => i.Id).ToList(); diff --git a/MediaBrowser.Controller/Entities/Extensions.cs b/MediaBrowser.Controller/Entities/Extensions.cs index 5e792a03a4..36855a86c1 100644 --- a/MediaBrowser.Controller/Entities/Extensions.cs +++ b/MediaBrowser.Controller/Entities/Extensions.cs @@ -1,6 +1,7 @@ using MediaBrowser.Model.Entities; using System; using System.Linq; +using MediaBrowser.Model.Extensions; namespace MediaBrowser.Controller.Entities { @@ -12,11 +13,7 @@ namespace MediaBrowser.Controller.Entities /// /// Adds the trailer URL. /// - /// The item. - /// The URL. - /// if set to true [is direct link]. - /// url - public static void AddTrailerUrl(this IHasTrailers item, string url, bool isDirectLink) + public static void AddTrailerUrl(this IHasTrailers item, string url) { if (string.IsNullOrWhiteSpace(url)) { @@ -27,10 +24,22 @@ namespace MediaBrowser.Controller.Entities if (current == null) { - item.RemoteTrailers.Add(new MediaUrl + var mediaUrl = new MediaUrl { Url = url - }); + }; + + if (item.RemoteTrailers.Length == 0) + { + item.RemoteTrailers = new[] { mediaUrl }; + } + else + { + var list = item.RemoteTrailers.ToArray(item.RemoteTrailers.Length + 1); + list[list.Length - 1] = mediaUrl; + + item.RemoteTrailers = list; + } } } } diff --git a/MediaBrowser.Controller/Entities/Folder.cs b/MediaBrowser.Controller/Entities/Folder.cs index 80a1b5e2a4..c0e1423964 100644 --- a/MediaBrowser.Controller/Entities/Folder.cs +++ b/MediaBrowser.Controller/Entities/Folder.cs @@ -38,14 +38,14 @@ namespace MediaBrowser.Controller.Entities /// true if this instance is root; otherwise, false. public bool IsRoot { get; set; } - public virtual List LinkedChildren { get; set; } + public LinkedChild[] LinkedChildren { get; set; } [IgnoreDataMember] public DateTime? DateLastMediaAdded { get; set; } public Folder() { - LinkedChildren = new List(); + LinkedChildren = EmptyLinkedChildArray; } [IgnoreDataMember] @@ -707,7 +707,7 @@ namespace MediaBrowser.Controller.Entities public virtual int GetChildCount(User user) { - if (LinkedChildren.Count > 0) + if (LinkedChildren.Length > 0) { if (!(this is ICollectionFolder)) { @@ -844,7 +844,7 @@ namespace MediaBrowser.Controller.Entities private bool RequiresPostFiltering(InternalItemsQuery query) { - if (LinkedChildren.Count > 0) + if (LinkedChildren.Length > 0) { if (!(this is ICollectionFolder)) { @@ -1225,7 +1225,7 @@ namespace MediaBrowser.Controller.Entities return GetLinkedChildren(); } - if (LinkedChildren.Count == 0) + if (LinkedChildren.Length == 0) { return new List(); } @@ -1314,14 +1314,9 @@ namespace MediaBrowser.Controller.Entities /// true if XXXX, false otherwise protected virtual bool RefreshLinkedChildren(IEnumerable fileSystemChildren) { - var currentManualLinks = LinkedChildren.Where(i => i.Type == LinkedChildType.Manual).ToList(); - var currentShortcutLinks = LinkedChildren.Where(i => i.Type == LinkedChildType.Shortcut).ToList(); - - List newShortcutLinks; - if (SupportsShortcutChildren) { - newShortcutLinks = fileSystemChildren + var newShortcutLinks = fileSystemChildren .Where(i => !i.IsDirectory && FileSystem.IsShortcut(i.FullName)) .Select(i => { @@ -1352,16 +1347,17 @@ namespace MediaBrowser.Controller.Entities }) .Where(i => i != null) .ToList(); - } - else { newShortcutLinks = new List(); } - if (!newShortcutLinks.SequenceEqual(currentShortcutLinks, new LinkedChildComparer(FileSystem))) - { - Logger.Info("Shortcut links have changed for {0}", Path); + var currentShortcutLinks = LinkedChildren.Where(i => i.Type == LinkedChildType.Shortcut).ToList(); - newShortcutLinks.AddRange(currentManualLinks); - LinkedChildren = newShortcutLinks; - return true; + if (!newShortcutLinks.SequenceEqual(currentShortcutLinks, new LinkedChildComparer(FileSystem))) + { + Logger.Info("Shortcut links have changed for {0}", Path); + + newShortcutLinks.AddRange(LinkedChildren.Where(i => i.Type == LinkedChildType.Manual)); + LinkedChildren = newShortcutLinks.ToArray(newShortcutLinks.Count); + return true; + } } foreach (var child in LinkedChildren) diff --git a/MediaBrowser.Controller/Entities/Game.cs b/MediaBrowser.Controller/Entities/Game.cs index aec67c3db8..eb2638ee4a 100644 --- a/MediaBrowser.Controller/Entities/Game.cs +++ b/MediaBrowser.Controller/Entities/Game.cs @@ -14,13 +14,13 @@ namespace MediaBrowser.Controller.Entities public Game() { MultiPartGameFiles = EmptyStringArray; - RemoteTrailers = new List(); - LocalTrailerIds = new List(); - RemoteTrailerIds = new List(); + RemoteTrailers = EmptyMediaUrlArray; + LocalTrailerIds = EmptyGuidArray; + RemoteTrailerIds = EmptyGuidArray; } - public List LocalTrailerIds { get; set; } - public List RemoteTrailerIds { get; set; } + public Guid[] LocalTrailerIds { get; set; } + public Guid[] RemoteTrailerIds { get; set; } public override bool CanDownload() { @@ -45,7 +45,7 @@ namespace MediaBrowser.Controller.Entities /// Gets or sets the remote trailers. /// /// The remote trailers. - public List RemoteTrailers { get; set; } + public MediaUrl[] RemoteTrailers { get; set; } /// /// Gets the type of the media. @@ -127,16 +127,5 @@ namespace MediaBrowser.Controller.Entities return id; } - - /// - /// Gets the trailer ids. - /// - /// List<Guid>. - public List GetTrailerIds() - { - var list = LocalTrailerIds.ToList(); - list.AddRange(RemoteTrailerIds); - return list; - } } } diff --git a/MediaBrowser.Controller/Entities/IHasTrailers.cs b/MediaBrowser.Controller/Entities/IHasTrailers.cs index e5cbdff723..8686c802ab 100644 --- a/MediaBrowser.Controller/Entities/IHasTrailers.cs +++ b/MediaBrowser.Controller/Entities/IHasTrailers.cs @@ -11,14 +11,14 @@ namespace MediaBrowser.Controller.Entities /// Gets or sets the remote trailers. /// /// The remote trailers. - List RemoteTrailers { get; set; } + MediaUrl[] RemoteTrailers { get; set; } /// /// Gets or sets the local trailer ids. /// /// The local trailer ids. - List LocalTrailerIds { get; set; } - List RemoteTrailerIds { get; set; } + Guid[] LocalTrailerIds { get; set; } + Guid[] RemoteTrailerIds { get; set; } } public static class HasTrailerExtensions diff --git a/MediaBrowser.Controller/Entities/Movies/BoxSet.cs b/MediaBrowser.Controller/Entities/Movies/BoxSet.cs index 071ed405f1..a5387a2657 100644 --- a/MediaBrowser.Controller/Entities/Movies/BoxSet.cs +++ b/MediaBrowser.Controller/Entities/Movies/BoxSet.cs @@ -21,9 +21,9 @@ namespace MediaBrowser.Controller.Entities.Movies public BoxSet() { - RemoteTrailers = new List(); - LocalTrailerIds = new List(); - RemoteTrailerIds = new List(); + RemoteTrailers = EmptyMediaUrlArray; + LocalTrailerIds = EmptyGuidArray; + RemoteTrailerIds = EmptyGuidArray; DisplayOrder = ItemSortBy.PremiereDate; Shares = new List(); @@ -47,14 +47,14 @@ namespace MediaBrowser.Controller.Entities.Movies } } - public List LocalTrailerIds { get; set; } - public List RemoteTrailerIds { get; set; } + public Guid[] LocalTrailerIds { get; set; } + public Guid[] RemoteTrailerIds { get; set; } /// /// Gets or sets the remote trailers. /// /// The remote trailers. - public List RemoteTrailers { get; set; } + public MediaUrl[] RemoteTrailers { get; set; } /// /// Gets or sets the display order. @@ -147,17 +147,6 @@ namespace MediaBrowser.Controller.Entities.Movies return true; } - /// - /// Gets the trailer ids. - /// - /// List<Guid>. - public List GetTrailerIds() - { - var list = LocalTrailerIds.ToList(); - list.AddRange(RemoteTrailerIds); - return list; - } - /// /// Updates the official rating based on content and returns true or false indicating if it changed. /// diff --git a/MediaBrowser.Controller/Entities/Movies/Movie.cs b/MediaBrowser.Controller/Entities/Movies/Movie.cs index 632e3ba121..99d7fdecb4 100644 --- a/MediaBrowser.Controller/Entities/Movies/Movie.cs +++ b/MediaBrowser.Controller/Entities/Movies/Movie.cs @@ -24,15 +24,15 @@ namespace MediaBrowser.Controller.Entities.Movies public Movie() { SpecialFeatureIds = new List(); - RemoteTrailers = new List(); - LocalTrailerIds = new List(); - RemoteTrailerIds = new List(); + RemoteTrailers = EmptyMediaUrlArray; + LocalTrailerIds = EmptyGuidArray; + RemoteTrailerIds = EmptyGuidArray; } - public List LocalTrailerIds { get; set; } - public List RemoteTrailerIds { get; set; } + public Guid[] LocalTrailerIds { get; set; } + public Guid[] RemoteTrailerIds { get; set; } - public List RemoteTrailers { get; set; } + public MediaUrl[] RemoteTrailers { get; set; } /// /// Gets or sets the name of the TMDB collection. diff --git a/MediaBrowser.Controller/Entities/TV/Episode.cs b/MediaBrowser.Controller/Entities/TV/Episode.cs index 45b4de1b3b..3cdfd19f10 100644 --- a/MediaBrowser.Controller/Entities/TV/Episode.cs +++ b/MediaBrowser.Controller/Entities/TV/Episode.cs @@ -17,14 +17,14 @@ namespace MediaBrowser.Controller.Entities.TV { public Episode() { - RemoteTrailers = new List(); - LocalTrailerIds = new List(); - RemoteTrailerIds = new List(); + RemoteTrailers = EmptyMediaUrlArray; + LocalTrailerIds = EmptyGuidArray; + RemoteTrailerIds = EmptyGuidArray; } - public List LocalTrailerIds { get; set; } - public List RemoteTrailerIds { get; set; } - public List RemoteTrailers { get; set; } + public Guid[] LocalTrailerIds { get; set; } + public Guid[] RemoteTrailerIds { get; set; } + public MediaUrl[] RemoteTrailers { get; set; } /// /// Gets the season in which it aired. diff --git a/MediaBrowser.Controller/Entities/TV/Series.cs b/MediaBrowser.Controller/Entities/TV/Series.cs index a8051aa9dd..f9133ccb01 100644 --- a/MediaBrowser.Controller/Entities/TV/Series.cs +++ b/MediaBrowser.Controller/Entities/TV/Series.cs @@ -24,9 +24,9 @@ namespace MediaBrowser.Controller.Entities.TV { AirDays = new List(); - RemoteTrailers = new List(); - LocalTrailerIds = new List(); - RemoteTrailerIds = new List(); + RemoteTrailers = EmptyMediaUrlArray; + LocalTrailerIds = EmptyGuidArray; + RemoteTrailerIds = EmptyGuidArray; } [IgnoreDataMember] @@ -62,10 +62,10 @@ namespace MediaBrowser.Controller.Entities.TV } } - public List LocalTrailerIds { get; set; } - public List RemoteTrailerIds { get; set; } + public Guid[] LocalTrailerIds { get; set; } + public Guid[] RemoteTrailerIds { get; set; } - public List RemoteTrailers { get; set; } + public MediaUrl[] RemoteTrailers { get; set; } /// /// airdate, dvd or absolute @@ -225,17 +225,6 @@ namespace MediaBrowser.Controller.Entities.TV return list; } - /// - /// Gets the trailer ids. - /// - /// List<Guid>. - public List GetTrailerIds() - { - var list = LocalTrailerIds.ToList(); - list.AddRange(RemoteTrailerIds); - return list; - } - [IgnoreDataMember] public bool ContainsEpisodesWithoutSeasonFolders { diff --git a/MediaBrowser.Controller/Entities/Video.cs b/MediaBrowser.Controller/Entities/Video.cs index 585e2a478b..fbeefbbd9c 100644 --- a/MediaBrowser.Controller/Entities/Video.cs +++ b/MediaBrowser.Controller/Entities/Video.cs @@ -31,9 +31,9 @@ namespace MediaBrowser.Controller.Entities [IgnoreDataMember] public string PrimaryVersionId { get; set; } - public List AdditionalParts { get; set; } - public List LocalAlternateVersions { get; set; } - public List LinkedAlternateVersions { get; set; } + public string[] AdditionalParts { get; set; } + public string[] LocalAlternateVersions { get; set; } + public LinkedChild[] LinkedAlternateVersions { get; set; } [IgnoreDataMember] public override bool SupportsPlayedStatus @@ -119,7 +119,7 @@ namespace MediaBrowser.Controller.Entities /// Gets or sets the subtitle paths. /// /// The subtitle paths. - public List SubtitleFiles { get; set; } + public string[] SubtitleFiles { get; set; } /// /// Gets or sets a value indicating whether this instance has subtitles. @@ -177,10 +177,10 @@ namespace MediaBrowser.Controller.Entities public Video() { - AdditionalParts = new List(); - LocalAlternateVersions = new List(); - SubtitleFiles = new List(); - LinkedAlternateVersions = new List(); + AdditionalParts = EmptyStringArray; + LocalAlternateVersions = EmptyStringArray; + SubtitleFiles = EmptyStringArray; + LinkedAlternateVersions = EmptyLinkedChildArray; } public override bool CanDownload() @@ -214,20 +214,20 @@ namespace MediaBrowser.Controller.Entities return item.MediaSourceCount; } } - return LinkedAlternateVersions.Count + LocalAlternateVersions.Count + 1; + return LinkedAlternateVersions.Length + LocalAlternateVersions.Length + 1; } } [IgnoreDataMember] public bool IsStacked { - get { return AdditionalParts.Count > 0; } + get { return AdditionalParts.Length > 0; } } [IgnoreDataMember] public bool HasLocalAlternateVersions { - get { return LocalAlternateVersions.Count > 0; } + get { return LocalAlternateVersions.Length > 0; } } public IEnumerable GetAdditionalPartIds() diff --git a/MediaBrowser.Controller/MediaBrowser.Controller.csproj b/MediaBrowser.Controller/MediaBrowser.Controller.csproj index b72b9027ec..38a76c06a0 100644 --- a/MediaBrowser.Controller/MediaBrowser.Controller.csproj +++ b/MediaBrowser.Controller/MediaBrowser.Controller.csproj @@ -166,7 +166,6 @@ - diff --git a/MediaBrowser.Controller/MediaEncoding/ChapterImageRefreshOptions.cs b/MediaBrowser.Controller/MediaEncoding/ChapterImageRefreshOptions.cs deleted file mode 100644 index e11bd6cdf8..0000000000 --- a/MediaBrowser.Controller/MediaEncoding/ChapterImageRefreshOptions.cs +++ /dev/null @@ -1,17 +0,0 @@ -using MediaBrowser.Controller.Entities; -using MediaBrowser.Model.Entities; -using System.Collections.Generic; - -namespace MediaBrowser.Controller.MediaEncoding -{ - public class ChapterImageRefreshOptions - { - public Video Video { get; set; } - - public List Chapters { get; set; } - - public bool SaveChapters { get; set; } - - public bool ExtractImages { get; set; } - } -} diff --git a/MediaBrowser.Controller/MediaEncoding/EncodingHelper.cs b/MediaBrowser.Controller/MediaEncoding/EncodingHelper.cs index 190ccdd9cc..1f85a076e5 100644 --- a/MediaBrowser.Controller/MediaEncoding/EncodingHelper.cs +++ b/MediaBrowser.Controller/MediaEncoding/EncodingHelper.cs @@ -1622,26 +1622,6 @@ namespace MediaBrowser.Controller.MediaEncoding inputModifier += " -f " + inputFormat; } } - - // Only do this for video files due to sometimes unpredictable codec names coming from BDInfo - if (state.VideoType == VideoType.VideoFile && state.RunTimeTicks.HasValue && string.IsNullOrWhiteSpace(encodingOptions.HardwareAccelerationType)) - { - foreach (var stream in state.MediaSource.MediaStreams) - { - if (!stream.IsExternal && stream.Type != MediaStreamType.Subtitle) - { - if (!string.IsNullOrWhiteSpace(stream.Codec) && stream.Index != -1) - { - var decoder = GetDecoderFromCodec(stream.Codec); - - if (!string.IsNullOrWhiteSpace(decoder)) - { - inputModifier += " -codec:" + stream.Index.ToString(_usCulture) + " " + decoder; - } - } - } - } - } } if (state.MediaSource.RequiresLooping) diff --git a/MediaBrowser.Controller/MediaEncoding/IEncodingManager.cs b/MediaBrowser.Controller/MediaEncoding/IEncodingManager.cs index 8683a6af42..81269fe3fa 100644 --- a/MediaBrowser.Controller/MediaEncoding/IEncodingManager.cs +++ b/MediaBrowser.Controller/MediaEncoding/IEncodingManager.cs @@ -1,5 +1,8 @@ -using System.Threading; +using System.Collections.Generic; +using System.Threading; using System.Threading.Tasks; +using MediaBrowser.Controller.Entities; +using MediaBrowser.Model.Entities; namespace MediaBrowser.Controller.MediaEncoding { @@ -8,9 +11,6 @@ namespace MediaBrowser.Controller.MediaEncoding /// /// Refreshes the chapter images. /// - /// The options. - /// The cancellation token. - /// Task{System.Boolean}. - Task RefreshChapterImages(ChapterImageRefreshOptions options, CancellationToken cancellationToken); + Task RefreshChapterImages(Video video, List chapters, bool extractImages, bool saveChapters, CancellationToken cancellationToken); } } diff --git a/MediaBrowser.Controller/Persistence/IItemRepository.cs b/MediaBrowser.Controller/Persistence/IItemRepository.cs index 3fc92fa2ce..bf54914b1d 100644 --- a/MediaBrowser.Controller/Persistence/IItemRepository.cs +++ b/MediaBrowser.Controller/Persistence/IItemRepository.cs @@ -65,7 +65,7 @@ namespace MediaBrowser.Controller.Persistence /// /// /// - IEnumerable GetChapters(Guid id); + List GetChapters(Guid id); /// /// Gets a single chapter for an item @@ -78,11 +78,7 @@ namespace MediaBrowser.Controller.Persistence /// /// Saves the chapters. /// - /// The id. - /// The chapters. - /// The cancellation token. - /// Task. - Task SaveChapters(Guid id, List chapters, CancellationToken cancellationToken); + Task SaveChapters(Guid id, List chapters); /// /// Gets the media streams. diff --git a/MediaBrowser.Controller/Playlists/Playlist.cs b/MediaBrowser.Controller/Playlists/Playlist.cs index eaadc68717..aec0668d43 100644 --- a/MediaBrowser.Controller/Playlists/Playlist.cs +++ b/MediaBrowser.Controller/Playlists/Playlist.cs @@ -105,7 +105,7 @@ namespace MediaBrowser.Controller.Playlists if (query != null) { - items = items.Where(i => UserViewBuilder.FilterItem(i, query)); + items = items.Where(i => UserViewBuilder.FilterItem(i, query)).ToList(); } return items; @@ -116,12 +116,12 @@ namespace MediaBrowser.Controller.Playlists return GetLinkedChildrenInfos(); } - private IEnumerable GetPlayableItems(User user, DtoOptions options) + private List GetPlayableItems(User user, DtoOptions options) { return GetPlaylistItems(MediaType, base.GetChildren(user, true), user, options); } - public static IEnumerable GetPlaylistItems(string playlistMediaType, IEnumerable inputItems, User user, DtoOptions options) + public static List GetPlaylistItems(string playlistMediaType, IEnumerable inputItems, User user, DtoOptions options) { if (user != null) { diff --git a/MediaBrowser.Controller/Providers/AlbumInfo.cs b/MediaBrowser.Controller/Providers/AlbumInfo.cs index b884774094..74feb4ea21 100644 --- a/MediaBrowser.Controller/Providers/AlbumInfo.cs +++ b/MediaBrowser.Controller/Providers/AlbumInfo.cs @@ -9,7 +9,7 @@ namespace MediaBrowser.Controller.Providers /// Gets or sets the album artist. /// /// The album artist. - public List AlbumArtists { get; set; } + public string[] AlbumArtists { get; set; } /// /// Gets or sets the artist provider ids. @@ -22,7 +22,7 @@ namespace MediaBrowser.Controller.Providers { ArtistProviderIds = new Dictionary(StringComparer.OrdinalIgnoreCase); SongInfos = new List(); - AlbumArtists = new List(); + AlbumArtists = EmptyStringArray; } } } \ No newline at end of file diff --git a/MediaBrowser.Controller/Providers/ItemLookupInfo.cs b/MediaBrowser.Controller/Providers/ItemLookupInfo.cs index dc7a04135a..98122e7767 100644 --- a/MediaBrowser.Controller/Providers/ItemLookupInfo.cs +++ b/MediaBrowser.Controller/Providers/ItemLookupInfo.cs @@ -6,6 +6,8 @@ namespace MediaBrowser.Controller.Providers { public class ItemLookupInfo : IHasProviderIds { + protected static string[] EmptyStringArray = new string[] { }; + /// /// Gets or sets the name. /// diff --git a/MediaBrowser.Controller/Providers/SongInfo.cs b/MediaBrowser.Controller/Providers/SongInfo.cs index b83912a002..988e931cd3 100644 --- a/MediaBrowser.Controller/Providers/SongInfo.cs +++ b/MediaBrowser.Controller/Providers/SongInfo.cs @@ -4,14 +4,14 @@ namespace MediaBrowser.Controller.Providers { public class SongInfo : ItemLookupInfo { - public List AlbumArtists { get; set; } + public string[] AlbumArtists { get; set; } public string Album { get; set; } public List Artists { get; set; } public SongInfo() { Artists = new List(); - AlbumArtists = new List(); + AlbumArtists = EmptyStringArray; } } } \ No newline at end of file diff --git a/MediaBrowser.LocalMetadata/Parsers/BaseItemXmlParser.cs b/MediaBrowser.LocalMetadata/Parsers/BaseItemXmlParser.cs index d9bc35822e..9a814213b3 100644 --- a/MediaBrowser.LocalMetadata/Parsers/BaseItemXmlParser.cs +++ b/MediaBrowser.LocalMetadata/Parsers/BaseItemXmlParser.cs @@ -467,7 +467,7 @@ namespace MediaBrowser.LocalMetadata.Parsers { if (!string.IsNullOrWhiteSpace(val)) { - hasTrailers.AddTrailerUrl(val, false); + hasTrailers.AddTrailerUrl(val); } } break; @@ -1030,7 +1030,7 @@ namespace MediaBrowser.LocalMetadata.Parsers if (!string.IsNullOrWhiteSpace(val)) { - item.AddTrailerUrl(val, false); + item.AddTrailerUrl(val); } break; } diff --git a/MediaBrowser.LocalMetadata/Parsers/BoxSetXmlParser.cs b/MediaBrowser.LocalMetadata/Parsers/BoxSetXmlParser.cs index a0f0e44767..33eb75edb1 100644 --- a/MediaBrowser.LocalMetadata/Parsers/BoxSetXmlParser.cs +++ b/MediaBrowser.LocalMetadata/Parsers/BoxSetXmlParser.cs @@ -6,6 +6,7 @@ using System.Collections.Generic; using System.Xml; using MediaBrowser.Model.IO; using MediaBrowser.Model.Xml; +using MediaBrowser.Model.Extensions; namespace MediaBrowser.LocalMetadata.Parsers { @@ -84,7 +85,7 @@ namespace MediaBrowser.LocalMetadata.Parsers } } - item.Item.LinkedChildren = list; + item.Item.LinkedChildren = list.ToArray(list.Count); } public BoxSetXmlParser(ILogger logger, IProviderManager providerManager, IXmlReaderSettingsFactory xmlReaderSettingsFactory, IFileSystem fileSystem) : base(logger, providerManager, xmlReaderSettingsFactory, fileSystem) diff --git a/MediaBrowser.LocalMetadata/Parsers/PlaylistXmlParser.cs b/MediaBrowser.LocalMetadata/Parsers/PlaylistXmlParser.cs index 695fe2b12d..c6ef858140 100644 --- a/MediaBrowser.LocalMetadata/Parsers/PlaylistXmlParser.cs +++ b/MediaBrowser.LocalMetadata/Parsers/PlaylistXmlParser.cs @@ -8,6 +8,7 @@ using System.Linq; using System.Xml; using MediaBrowser.Model.IO; using MediaBrowser.Model.Xml; +using MediaBrowser.Model.Extensions; namespace MediaBrowser.LocalMetadata.Parsers { @@ -124,7 +125,7 @@ namespace MediaBrowser.LocalMetadata.Parsers } } - item.LinkedChildren = list; + item.LinkedChildren = list.ToArray(list.Count); } private void FetchFromSharesNode(XmlReader reader, Playlist item) diff --git a/MediaBrowser.LocalMetadata/Savers/BaseXmlSaver.cs b/MediaBrowser.LocalMetadata/Savers/BaseXmlSaver.cs index dbfd9a40c1..259f423918 100644 --- a/MediaBrowser.LocalMetadata/Savers/BaseXmlSaver.cs +++ b/MediaBrowser.LocalMetadata/Savers/BaseXmlSaver.cs @@ -364,7 +364,7 @@ namespace MediaBrowser.LocalMetadata.Savers var hasTrailers = item as IHasTrailers; if (hasTrailers != null) { - if (hasTrailers.RemoteTrailers.Count > 0) + if (hasTrailers.RemoteTrailers.Length > 0) { writer.WriteStartElement("Trailers"); diff --git a/MediaBrowser.Model/Dto/BaseItemDto.cs b/MediaBrowser.Model/Dto/BaseItemDto.cs index 92d8bfab2a..e5cc22c5fb 100644 --- a/MediaBrowser.Model/Dto/BaseItemDto.cs +++ b/MediaBrowser.Model/Dto/BaseItemDto.cs @@ -298,7 +298,7 @@ namespace MediaBrowser.Model.Dto /// Gets or sets the trailer urls. /// /// The trailer urls. - public List RemoteTrailers { get; set; } + public MediaUrl[] RemoteTrailers { get; set; } /// /// Gets or sets the provider ids. @@ -503,7 +503,7 @@ namespace MediaBrowser.Model.Dto /// Gets or sets the album artists. /// /// The album artists. - public List AlbumArtists { get; set; } + public NameIdPair[] AlbumArtists { get; set; } /// /// Gets or sets the name of the season. diff --git a/MediaBrowser.Model/MediaInfo/MediaInfo.cs b/MediaBrowser.Model/MediaInfo/MediaInfo.cs index 1267101976..691dcc6c8f 100644 --- a/MediaBrowser.Model/MediaInfo/MediaInfo.cs +++ b/MediaBrowser.Model/MediaInfo/MediaInfo.cs @@ -7,6 +7,8 @@ namespace MediaBrowser.Model.MediaInfo { public class MediaInfo : MediaSourceInfo, IHasProviderIds { + private static readonly string[] EmptyStringArray = new string[] { }; + public List Chapters { get; set; } /// @@ -23,7 +25,7 @@ namespace MediaBrowser.Model.MediaInfo /// Gets or sets the album artists. /// /// The album artists. - public List AlbumArtists { get; set; } + public string[] AlbumArtists { get; set; } /// /// Gets or sets the studios. /// @@ -56,7 +58,7 @@ namespace MediaBrowser.Model.MediaInfo { Chapters = new List(); Artists = new List(); - AlbumArtists = new List(); + AlbumArtists = EmptyStringArray; Studios = new List(); Genres = new List(); People = new List(); diff --git a/MediaBrowser.Providers/BoxSets/BoxSetMetadataService.cs b/MediaBrowser.Providers/BoxSets/BoxSetMetadataService.cs index a8400848d7..81cd416050 100644 --- a/MediaBrowser.Providers/BoxSets/BoxSetMetadataService.cs +++ b/MediaBrowser.Providers/BoxSets/BoxSetMetadataService.cs @@ -6,12 +6,9 @@ using MediaBrowser.Controller.Providers; using MediaBrowser.Model.Entities; using MediaBrowser.Model.Logging; using MediaBrowser.Providers.Manager; -using System.Collections.Generic; using System.Linq; -using System.Threading.Tasks; - -using MediaBrowser.Controller.IO; using MediaBrowser.Model.IO; +using MediaBrowser.Model.Extensions; namespace MediaBrowser.Providers.BoxSets { @@ -48,7 +45,7 @@ namespace MediaBrowser.Providers.BoxSets var linkedChildren = sourceItem.LinkedChildren.ToList(); linkedChildren.AddRange(sourceItem.LinkedChildren.Where(i => i.Type == LinkedChildType.Shortcut)); - targetItem.LinkedChildren = linkedChildren; + targetItem.LinkedChildren = linkedChildren.ToArray(linkedChildren.Count); targetItem.Shares = sourceItem.Shares; } } diff --git a/MediaBrowser.Providers/Chapters/ChapterManager.cs b/MediaBrowser.Providers/Chapters/ChapterManager.cs index 5fea2c3cdb..3973d3de7b 100644 --- a/MediaBrowser.Providers/Chapters/ChapterManager.cs +++ b/MediaBrowser.Providers/Chapters/ChapterManager.cs @@ -39,9 +39,9 @@ namespace MediaBrowser.Providers.Chapters return _itemRepo.GetChapters(new Guid(itemId)); } - public Task SaveChapters(string itemId, List chapters, CancellationToken cancellationToken) + public Task SaveChapters(string itemId, List chapters) { - return _itemRepo.SaveChapters(new Guid(itemId), chapters, cancellationToken); + return _itemRepo.SaveChapters(new Guid(itemId), chapters); } } } diff --git a/MediaBrowser.Providers/Manager/ProviderUtils.cs b/MediaBrowser.Providers/Manager/ProviderUtils.cs index a200b18b57..af91f5e020 100644 --- a/MediaBrowser.Providers/Manager/ProviderUtils.cs +++ b/MediaBrowser.Providers/Manager/ProviderUtils.cs @@ -284,7 +284,7 @@ namespace MediaBrowser.Providers.Manager if (sourceHasAlbumArtist != null && targetHasAlbumArtist != null) { - if (replaceData || targetHasAlbumArtist.AlbumArtists.Count == 0) + if (replaceData || targetHasAlbumArtist.AlbumArtists.Length == 0) { targetHasAlbumArtist.AlbumArtists = sourceHasAlbumArtist.AlbumArtists; } @@ -306,7 +306,7 @@ namespace MediaBrowser.Providers.Manager if (sourceCast != null && targetCast != null) { - if (replaceData || targetCast.RemoteTrailers.Count == 0) + if (replaceData || targetCast.RemoteTrailers.Length == 0) { targetCast.RemoteTrailers = sourceCast.RemoteTrailers; } diff --git a/MediaBrowser.Providers/MediaInfo/FFProbeVideoInfo.cs b/MediaBrowser.Providers/MediaInfo/FFProbeVideoInfo.cs index 7956b52af9..791a5c57b3 100644 --- a/MediaBrowser.Providers/MediaInfo/FFProbeVideoInfo.cs +++ b/MediaBrowser.Providers/MediaInfo/FFProbeVideoInfo.cs @@ -234,16 +234,9 @@ namespace MediaBrowser.Providers.MediaInfo extractDuringScan = libraryOptions.ExtractChapterImagesDuringLibraryScan; } - await _encodingManager.RefreshChapterImages(new ChapterImageRefreshOptions - { - Chapters = chapters, - Video = video, - ExtractImages = extractDuringScan, - SaveChapters = false - - }, cancellationToken).ConfigureAwait(false); + await _encodingManager.RefreshChapterImages(video, chapters, extractDuringScan, false, cancellationToken).ConfigureAwait(false); - await _chapterManager.SaveChapters(video.Id.ToString(), chapters, cancellationToken).ConfigureAwait(false); + await _chapterManager.SaveChapters(video.Id.ToString(), chapters).ConfigureAwait(false); } } @@ -513,7 +506,7 @@ namespace MediaBrowser.Providers.MediaInfo } } - video.SubtitleFiles = externalSubtitleStreams.Select(i => i.Path).OrderBy(i => i).ToList(); + video.SubtitleFiles = externalSubtitleStreams.Select(i => i.Path).OrderBy(i => i).ToArray(); currentStreams.AddRange(externalSubtitleStreams); } diff --git a/MediaBrowser.Providers/Movies/GenericMovieDbInfo.cs b/MediaBrowser.Providers/Movies/GenericMovieDbInfo.cs index ddf3e4d1a2..65742f6e6e 100644 --- a/MediaBrowser.Providers/Movies/GenericMovieDbInfo.cs +++ b/MediaBrowser.Providers/Movies/GenericMovieDbInfo.cs @@ -318,7 +318,7 @@ namespace MediaBrowser.Providers.Movies Url = string.Format("https://www.youtube.com/watch?v={0}", i.source), Name = i.name - }).ToList(); + }).ToArray(); } } } diff --git a/MediaBrowser.Providers/Music/AlbumMetadataService.cs b/MediaBrowser.Providers/Music/AlbumMetadataService.cs index 839bec6045..fe39a841e4 100644 --- a/MediaBrowser.Providers/Music/AlbumMetadataService.cs +++ b/MediaBrowser.Providers/Music/AlbumMetadataService.cs @@ -87,7 +87,7 @@ namespace MediaBrowser.Providers.Music .SelectMany(i => i.AlbumArtists) .Distinct(StringComparer.OrdinalIgnoreCase) .OrderBy(i => i) - .ToList(); + .ToArray(); if (!item.AlbumArtists.SequenceEqual(artists, StringComparer.OrdinalIgnoreCase)) { diff --git a/MediaBrowser.Providers/Music/AudioDbAlbumProvider.cs b/MediaBrowser.Providers/Music/AudioDbAlbumProvider.cs index cd6b0b8271..80f1224022 100644 --- a/MediaBrowser.Providers/Music/AudioDbAlbumProvider.cs +++ b/MediaBrowser.Providers/Music/AudioDbAlbumProvider.cs @@ -74,7 +74,7 @@ namespace MediaBrowser.Providers.Music { if (!string.IsNullOrWhiteSpace(result.strArtist)) { - item.AlbumArtists = new List { result.strArtist }; + item.AlbumArtists = new string[] { result.strArtist }; } if (!string.IsNullOrEmpty(result.intYearReleased)) diff --git a/MediaBrowser.Providers/TV/TheMovieDb/MovieDbEpisodeProvider.cs b/MediaBrowser.Providers/TV/TheMovieDb/MovieDbEpisodeProvider.cs index 618a4df45f..619e56baf7 100644 --- a/MediaBrowser.Providers/TV/TheMovieDb/MovieDbEpisodeProvider.cs +++ b/MediaBrowser.Providers/TV/TheMovieDb/MovieDbEpisodeProvider.cs @@ -134,7 +134,7 @@ namespace MediaBrowser.Providers.TV if (video.site.Equals("youtube", System.StringComparison.OrdinalIgnoreCase)) { var videoUrl = string.Format("http://www.youtube.com/watch?v={0}", video.key); - item.AddTrailerUrl(videoUrl, true); + item.AddTrailerUrl(videoUrl); } } } diff --git a/MediaBrowser.Providers/TV/TheMovieDb/MovieDbSeriesProvider.cs b/MediaBrowser.Providers/TV/TheMovieDb/MovieDbSeriesProvider.cs index 4de1712d20..72745a9c3a 100644 --- a/MediaBrowser.Providers/TV/TheMovieDb/MovieDbSeriesProvider.cs +++ b/MediaBrowser.Providers/TV/TheMovieDb/MovieDbSeriesProvider.cs @@ -302,7 +302,7 @@ namespace MediaBrowser.Providers.TV if (video.site.Equals("youtube", System.StringComparison.OrdinalIgnoreCase)) { var videoUrl = string.Format("http://www.youtube.com/watch?v={0}", video.key); - series.AddTrailerUrl(videoUrl, true); + series.AddTrailerUrl(videoUrl); } } } diff --git a/MediaBrowser.Server.Mac/Emby.Server.Mac.csproj b/MediaBrowser.Server.Mac/Emby.Server.Mac.csproj index 176bc19e43..cbf30db8e6 100644 --- a/MediaBrowser.Server.Mac/Emby.Server.Mac.csproj +++ b/MediaBrowser.Server.Mac/Emby.Server.Mac.csproj @@ -96,8 +96,8 @@ ..\packages\NLog.4.4.12\lib\net45\NLog.dll True - - ..\packages\ServiceStack.Text.4.5.12\lib\net45\ServiceStack.Text.dll + + ..\packages\ServiceStack.Text.4.5.8\lib\net45\ServiceStack.Text.dll True diff --git a/MediaBrowser.Server.Mono/MediaBrowser.Server.Mono.csproj b/MediaBrowser.Server.Mono/MediaBrowser.Server.Mono.csproj index 33678d323a..48b4fdb4fb 100644 --- a/MediaBrowser.Server.Mono/MediaBrowser.Server.Mono.csproj +++ b/MediaBrowser.Server.Mono/MediaBrowser.Server.Mono.csproj @@ -54,8 +54,9 @@ ..\packages\NLog.4.4.12\lib\net45\NLog.dll - - ..\packages\ServiceStack.Text.4.5.12\lib\net45\ServiceStack.Text.dll + + ..\packages\ServiceStack.Text.4.5.8\lib\net45\ServiceStack.Text.dll + True ..\packages\SharpCompress.0.14.0\lib\net45\SharpCompress.dll diff --git a/MediaBrowser.Server.Mono/packages.config b/MediaBrowser.Server.Mono/packages.config index 0cb6cc916e..c77327e228 100644 --- a/MediaBrowser.Server.Mono/packages.config +++ b/MediaBrowser.Server.Mono/packages.config @@ -2,7 +2,7 @@ - + diff --git a/MediaBrowser.ServerApplication/MediaBrowser.ServerApplication.csproj b/MediaBrowser.ServerApplication/MediaBrowser.ServerApplication.csproj index 6248227468..a4138a57da 100644 --- a/MediaBrowser.ServerApplication/MediaBrowser.ServerApplication.csproj +++ b/MediaBrowser.ServerApplication/MediaBrowser.ServerApplication.csproj @@ -76,8 +76,9 @@ ..\packages\NLog.4.4.12\lib\net45\NLog.dll - - ..\packages\ServiceStack.Text.4.5.12\lib\net45\ServiceStack.Text.dll + + ..\packages\ServiceStack.Text.4.5.8\lib\net45\ServiceStack.Text.dll + True ..\packages\SharpCompress.0.14.0\lib\net45\SharpCompress.dll diff --git a/MediaBrowser.ServerApplication/packages.config b/MediaBrowser.ServerApplication/packages.config index e3fea58a62..ed953e299a 100644 --- a/MediaBrowser.ServerApplication/packages.config +++ b/MediaBrowser.ServerApplication/packages.config @@ -1,7 +1,7 @@  - + diff --git a/MediaBrowser.XbmcMetadata/Parsers/BaseNfoParser.cs b/MediaBrowser.XbmcMetadata/Parsers/BaseNfoParser.cs index bc2fcb054b..789d840b82 100644 --- a/MediaBrowser.XbmcMetadata/Parsers/BaseNfoParser.cs +++ b/MediaBrowser.XbmcMetadata/Parsers/BaseNfoParser.cs @@ -599,7 +599,7 @@ namespace MediaBrowser.XbmcMetadata.Parsers { val = val.Replace("plugin://plugin.video.youtube/?action=play_video&videoid=", "https://www.youtube.com/watch?v=", StringComparison.OrdinalIgnoreCase); - hasTrailer.AddTrailerUrl(val, false); + hasTrailer.AddTrailerUrl(val); } } break; diff --git a/Nuget/MediaBrowser.Common.Internal.nuspec b/Nuget/MediaBrowser.Common.Internal.nuspec deleted file mode 100644 index fdc2b9f7d2..0000000000 --- a/Nuget/MediaBrowser.Common.Internal.nuspec +++ /dev/null @@ -1,24 +0,0 @@ - - - - MediaBrowser.Common.Internal - 3.0.681 - Emby.Common.Internal - Luke - ebr,Luke,scottisafool - https://github.com/MediaBrowser/Emby - http://www.mb3admin.com/images/mb3icons1-1.png - false - Contains common components shared by Emby Theater and Emby Server. Not intended for plugin developer consumption. - Copyright © Emby 2013 - - - - - - - - - - - \ No newline at end of file diff --git a/Nuget/MediaBrowser.Common.nuspec b/Nuget/MediaBrowser.Common.nuspec index f647797ddc..890ecaccdd 100644 --- a/Nuget/MediaBrowser.Common.nuspec +++ b/Nuget/MediaBrowser.Common.nuspec @@ -2,7 +2,7 @@ MediaBrowser.Common - 3.0.716 + 3.0.717 Emby.Common Emby Team ebr,Luke,scottisafool diff --git a/Nuget/MediaBrowser.Server.Core.nuspec b/Nuget/MediaBrowser.Server.Core.nuspec index 27b7513bcd..6b7a8729b2 100644 --- a/Nuget/MediaBrowser.Server.Core.nuspec +++ b/Nuget/MediaBrowser.Server.Core.nuspec @@ -2,7 +2,7 @@ MediaBrowser.Server.Core - 3.0.716 + 3.0.717 Emby.Server.Core Emby Team ebr,Luke,scottisafool @@ -12,7 +12,7 @@ Contains core components required to build plugins for Emby Server. Copyright © Emby 2013 - + diff --git a/SharedVersion.cs b/SharedVersion.cs index 988d4c255e..b201954e64 100644 --- a/SharedVersion.cs +++ b/SharedVersion.cs @@ -1,3 +1,3 @@ using System.Reflection; -[assembly: AssemblyVersion("3.2.26.19")] +[assembly: AssemblyVersion("3.2.26.20")]