diff options
| author | Luke Pulverenti <luke.pulverenti@gmail.com> | 2017-08-24 15:52:19 -0400 |
|---|---|---|
| committer | Luke Pulverenti <luke.pulverenti@gmail.com> | 2017-08-24 15:52:19 -0400 |
| commit | e441e2f53db0b587c9864fe91d7008a2344d147b (patch) | |
| tree | c37b2148eb277671c7ee285c73b738542f279b22 | |
| parent | 5e0f8fd8c486ac37e487786c10c2d3f9e1293ce8 (diff) | |
update active recordings
157 files changed, 571 insertions, 657 deletions
diff --git a/Emby.Dlna/ContentDirectory/ContentDirectory.cs b/Emby.Dlna/ContentDirectory/ContentDirectory.cs index 92d388e3b..d547ad8d4 100644 --- a/Emby.Dlna/ContentDirectory/ContentDirectory.cs +++ b/Emby.Dlna/ContentDirectory/ContentDirectory.cs @@ -10,7 +10,6 @@ using MediaBrowser.Model.Dlna; using MediaBrowser.Model.Logging; using System; using System.Collections.Generic; -using System.Linq; using MediaBrowser.Controller.MediaEncoding; using MediaBrowser.Controller.TV; using MediaBrowser.Model.Globalization; @@ -129,9 +128,20 @@ namespace Emby.Dlna.ContentDirectory } } - // No configuration so it's going to be pretty arbitrary - return _userManager.Users.FirstOrDefault(i => i.Policy.IsAdministrator) ?? - _userManager.Users.First(); + foreach (var user in _userManager.Users) + { + if (user.Policy.IsAdministrator) + { + return user; + } + } + + foreach (var user in _userManager.Users) + { + return user; + } + + return null; } public void Dispose() diff --git a/Emby.Dlna/Didl/Filter.cs b/Emby.Dlna/Didl/Filter.cs index 5e9aeb530..2c9a1ea18 100644 --- a/Emby.Dlna/Didl/Filter.cs +++ b/Emby.Dlna/Didl/Filter.cs @@ -1,13 +1,12 @@ using MediaBrowser.Model.Extensions; using System; using System.Collections.Generic; -using System.Linq; namespace Emby.Dlna.Didl { public class Filter { - private readonly List<string> _fields; + private readonly string[] _fields; private readonly bool _all; public Filter() @@ -20,9 +19,7 @@ namespace Emby.Dlna.Didl { _all = StringHelper.EqualsIgnoreCase(filter, "*"); - var list = (filter ?? string.Empty).Split(new[] {','}, StringSplitOptions.RemoveEmptyEntries).ToList(); - - _fields = list; + _fields = (filter ?? string.Empty).Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries); } public bool Contains(string field) diff --git a/Emby.Dlna/Didl/StringWriterWithEncoding.cs b/Emby.Dlna/Didl/StringWriterWithEncoding.cs index 052d6610b..b5c565801 100644 --- a/Emby.Dlna/Didl/StringWriterWithEncoding.cs +++ b/Emby.Dlna/Didl/StringWriterWithEncoding.cs @@ -1,7 +1,6 @@ using System; using System.Collections.Generic; using System.IO; -using System.Linq; using System.Text; using System.Threading.Tasks; diff --git a/Emby.Dlna/PlayTo/PlayToController.cs b/Emby.Dlna/PlayTo/PlayToController.cs index d563b5add..4b77f998d 100644 --- a/Emby.Dlna/PlayTo/PlayToController.cs +++ b/Emby.Dlna/PlayTo/PlayToController.cs @@ -13,7 +13,6 @@ using MediaBrowser.Model.System; using System; using System.Collections.Generic; using System.Globalization; -using System.Linq; using System.Threading; using System.Threading.Tasks; using MediaBrowser.Common.Configuration; @@ -49,7 +48,7 @@ namespace Emby.Dlna.PlayTo { get { - var lastDateKnownActivity = new[] { _creationTime, _device.DateLastActivity }.Max(); + var lastDateKnownActivity = _creationTime > _device.DateLastActivity ? _creationTime : _device.DateLastActivity; if (DateTime.UtcNow >= lastDateKnownActivity.AddSeconds(120)) { @@ -565,7 +564,7 @@ namespace Emby.Dlna.PlayTo streamInfo.TargetVideoCodecTag, streamInfo.IsTargetAVC); - return list.FirstOrDefault(); + return list.Count == 0 ? null : list[0]; } return null; diff --git a/Emby.Dlna/Profiles/PanasonicVieraProfile.cs b/Emby.Dlna/Profiles/PanasonicVieraProfile.cs index 63c7e3a8e..095788485 100644 --- a/Emby.Dlna/Profiles/PanasonicVieraProfile.cs +++ b/Emby.Dlna/Profiles/PanasonicVieraProfile.cs @@ -30,107 +30,6 @@ namespace Emby.Dlna.Profiles TimelineOffsetSeconds = 10; - TranscodingProfiles = new[] - { - new TranscodingProfile - { - Container = "mp3", - AudioCodec = "mp3", - Type = DlnaProfileType.Audio - }, - new TranscodingProfile - { - Container = "ts", - AudioCodec = "ac3", - VideoCodec = "h264", - Type = DlnaProfileType.Video - }, - new TranscodingProfile - { - Container = "jpeg", - Type = DlnaProfileType.Photo - } - }; - - DirectPlayProfiles = new[] - { - new DirectPlayProfile - { - Container = "mpeg,mpg", - VideoCodec = "mpeg2video,mpeg4", - AudioCodec = "ac3,mp3,pcm_dvd", - Type = DlnaProfileType.Video - }, - - new DirectPlayProfile - { - Container = "mkv", - VideoCodec = "h264,mpeg2video", - AudioCodec = "aac,ac3,dca,mp3,mp2,pcm,dts", - Type = DlnaProfileType.Video - }, - - new DirectPlayProfile - { - Container = "ts", - VideoCodec = "h264,mpeg2video", - AudioCodec = "aac,mp3,mp2", - Type = DlnaProfileType.Video - }, - - new DirectPlayProfile - { - Container = "mp4,m4v", - VideoCodec = "h264", - AudioCodec = "aac,ac3,mp3,pcm", - Type = DlnaProfileType.Video - }, - - new DirectPlayProfile - { - Container = "mov", - VideoCodec = "h264", - AudioCodec = "aac,pcm", - Type = DlnaProfileType.Video - }, - - new DirectPlayProfile - { - Container = "avi", - VideoCodec = "mpeg4", - AudioCodec = "pcm", - Type = DlnaProfileType.Video - }, - - new DirectPlayProfile - { - Container = "flv", - VideoCodec = "h264", - AudioCodec = "aac", - Type = DlnaProfileType.Video - }, - - new DirectPlayProfile - { - Container = "mp3", - AudioCodec = "mp3", - Type = DlnaProfileType.Audio - }, - - new DirectPlayProfile - { - Container = "mp4", - AudioCodec = "aac", - Type = DlnaProfileType.Audio - }, - - new DirectPlayProfile - { - Container = "jpeg", - Type = DlnaProfileType.Photo - } - }; - ContainerProfiles = new[] { new ContainerProfile diff --git a/Emby.Dlna/Ssdp/Extensions.cs b/Emby.Dlna/Ssdp/Extensions.cs index 611bf7e02..41a361515 100644 --- a/Emby.Dlna/Ssdp/Extensions.cs +++ b/Emby.Dlna/Ssdp/Extensions.cs @@ -1,5 +1,4 @@ using System; -using System.Linq; using System.Net; using System.Threading.Tasks; using System.Xml.Linq; @@ -24,10 +23,12 @@ namespace Emby.Dlna.Ssdp public static string GetDescendantValue(this XElement container, XName name) { - var node = container.Descendants(name) - .FirstOrDefault(); + foreach (var node in container.Descendants(name)) + { + return node.Value; + } - return node == null ? null : node.Value; + return null; } } } diff --git a/Emby.Drawing.ImageMagick/ImageHelpers.cs b/Emby.Drawing.ImageMagick/ImageHelpers.cs index c623c21aa..866693399 100644 --- a/Emby.Drawing.ImageMagick/ImageHelpers.cs +++ b/Emby.Drawing.ImageMagick/ImageHelpers.cs @@ -6,13 +6,13 @@ namespace Emby.Drawing.ImageMagick { internal static class ImageHelpers { - internal static List<string> ProjectPaths(List<string> paths, int count) + internal static List<string> ProjectPaths(string[] paths, int count) { if (count <= 0) { throw new ArgumentOutOfRangeException("count"); } - if (paths.Count == 0) + if (paths.Length == 0) { throw new ArgumentOutOfRangeException("paths"); } @@ -24,7 +24,7 @@ namespace Emby.Drawing.ImageMagick return list.Take(count).ToList(); } - private static void AddToList(List<string> list, List<string> paths, int count) + private static void AddToList(List<string> list, string[] paths, int count) { while (list.Count < count) { diff --git a/Emby.Drawing.ImageMagick/ImageMagickEncoder.cs b/Emby.Drawing.ImageMagick/ImageMagickEncoder.cs index ea8687de0..9abf85e70 100644 --- a/Emby.Drawing.ImageMagick/ImageMagickEncoder.cs +++ b/Emby.Drawing.ImageMagick/ImageMagickEncoder.cs @@ -7,7 +7,6 @@ using MediaBrowser.Model.Drawing; using MediaBrowser.Model.Logging; using System; using System.IO; -using System.Linq; using MediaBrowser.Model.IO; using MediaBrowser.Model.System; @@ -306,15 +305,15 @@ namespace Emby.Drawing.ImageMagick if (ratio >= 1.4) { - new StripCollageBuilder(_appPaths, _fileSystem).BuildThumbCollage(options.InputPaths.ToList(), options.OutputPath, options.Width, options.Height); + new StripCollageBuilder(_appPaths, _fileSystem).BuildThumbCollage(options.InputPaths, options.OutputPath, options.Width, options.Height); } else if (ratio >= .9) { - new StripCollageBuilder(_appPaths, _fileSystem).BuildSquareCollage(options.InputPaths.ToList(), options.OutputPath, options.Width, options.Height); + new StripCollageBuilder(_appPaths, _fileSystem).BuildSquareCollage(options.InputPaths, options.OutputPath, options.Width, options.Height); } else { - new StripCollageBuilder(_appPaths, _fileSystem).BuildPosterCollage(options.InputPaths.ToList(), options.OutputPath, options.Width, options.Height); + new StripCollageBuilder(_appPaths, _fileSystem).BuildPosterCollage(options.InputPaths, options.OutputPath, options.Width, options.Height); } } diff --git a/Emby.Drawing.ImageMagick/StripCollageBuilder.cs b/Emby.Drawing.ImageMagick/StripCollageBuilder.cs index 63cf8fe5f..26c6c868d 100644 --- a/Emby.Drawing.ImageMagick/StripCollageBuilder.cs +++ b/Emby.Drawing.ImageMagick/StripCollageBuilder.cs @@ -19,7 +19,7 @@ namespace Emby.Drawing.ImageMagick _fileSystem = fileSystem; } - public void BuildPosterCollage(List<string> paths, string outputPath, int width, int height) + public void BuildPosterCollage(string[] paths, string outputPath, int width, int height) { using (var wand = BuildPosterCollageWand(paths, width, height)) { @@ -27,7 +27,7 @@ namespace Emby.Drawing.ImageMagick } } - public void BuildSquareCollage(List<string> paths, string outputPath, int width, int height) + public void BuildSquareCollage(string[] paths, string outputPath, int width, int height) { using (var wand = BuildSquareCollageWand(paths, width, height)) { @@ -35,7 +35,7 @@ namespace Emby.Drawing.ImageMagick } } - public void BuildThumbCollage(List<string> paths, string outputPath, int width, int height) + public void BuildThumbCollage(string[] paths, string outputPath, int width, int height) { using (var wand = BuildThumbCollageWand(paths, width, height)) { @@ -43,7 +43,7 @@ namespace Emby.Drawing.ImageMagick } } - private MagickWand BuildPosterCollageWand(List<string> paths, int width, int height) + private MagickWand BuildPosterCollageWand(string[] paths, int width, int height) { var inputPaths = ImageHelpers.ProjectPaths(paths, 3); using (var wandImages = new MagickWand(inputPaths.ToArray())) @@ -108,7 +108,7 @@ namespace Emby.Drawing.ImageMagick } } - private MagickWand BuildThumbCollageWand(List<string> paths, int width, int height) + private MagickWand BuildThumbCollageWand(string[] paths, int width, int height) { var inputPaths = ImageHelpers.ProjectPaths(paths, 4); using (var wandImages = new MagickWand(inputPaths.ToArray())) @@ -173,7 +173,7 @@ namespace Emby.Drawing.ImageMagick } } - private MagickWand BuildSquareCollageWand(List<string> paths, int width, int height) + private MagickWand BuildSquareCollageWand(string[] paths, int width, int height) { var inputPaths = ImageHelpers.ProjectPaths(paths, 4); var outputWand = new MagickWand(width, height, new PixelWand("none", 1)); diff --git a/Emby.Drawing/ImageProcessor.cs b/Emby.Drawing/ImageProcessor.cs index bd23eba7a..63fa5f1f5 100644 --- a/Emby.Drawing/ImageProcessor.cs +++ b/Emby.Drawing/ImageProcessor.cs @@ -44,7 +44,7 @@ namespace Emby.Drawing /// Image processors are specialized metadata providers that run after the normal ones /// </summary> /// <value>The image enhancers.</value> - public IEnumerable<IImageEnhancer> ImageEnhancers { get; private set; } + public IImageEnhancer[] ImageEnhancers { get; private set; } /// <summary> /// The _logger @@ -71,7 +71,7 @@ namespace Emby.Drawing _libraryManager = libraryManager; _appPaths = appPaths; - ImageEnhancers = new List<IImageEnhancer>(); + ImageEnhancers = new IImageEnhancer[] {}; _saveImageSizeTimer = timerFactory.Create(SaveImageSizeCallback, null, Timeout.Infinite, Timeout.Infinite); ImageHelper.ImageProcessor = this; @@ -618,7 +618,7 @@ namespace Emby.Drawing var supportedEnhancers = GetSupportedEnhancers(item, image.Type); - return GetImageCacheTag(item, image, supportedEnhancers.ToList()); + return GetImageCacheTag(item, image, supportedEnhancers); } /// <summary> @@ -672,7 +672,7 @@ namespace Emby.Drawing /// <returns>Task{System.String}.</returns> public async Task<string> GetEnhancedImage(IHasMetadata item, ImageType imageType, int imageIndex) { - var enhancers = GetSupportedEnhancers(item, imageType).ToList(); + var enhancers = GetSupportedEnhancers(item, imageType); var imageInfo = item.GetImageInfo(imageType, imageIndex); @@ -866,21 +866,25 @@ namespace Emby.Drawing _logger.Info("Completed creation of image collage and saved to {0}", options.OutputPath); } - public IEnumerable<IImageEnhancer> GetSupportedEnhancers(IHasMetadata item, ImageType imageType) + public List<IImageEnhancer> GetSupportedEnhancers(IHasMetadata item, ImageType imageType) { - return ImageEnhancers.Where(i => + var list = new List<IImageEnhancer>(); + + foreach (var i in ImageEnhancers) { try { - return i.Supports(item, imageType); + if (i.Supports(item, imageType)) + { + list.Add(i); + } } catch (Exception ex) { _logger.ErrorException("Error in image enhancer: {0}", ex, i.GetType().Name); - - return false; } - }); + } + return list; } private bool _disposed; diff --git a/Emby.Server.Implementations/ApplicationHost.cs b/Emby.Server.Implementations/ApplicationHost.cs index ea6c2aaf5..6441fe4f2 100644 --- a/Emby.Server.Implementations/ApplicationHost.cs +++ b/Emby.Server.Implementations/ApplicationHost.cs @@ -861,7 +861,7 @@ namespace Emby.Server.Implementations SecurityManager = new PluginSecurityManager(this, HttpClient, JsonSerializer, ApplicationPaths, LogManager, FileSystemManager, CryptographyProvider); RegisterSingleInstance(SecurityManager); - InstallationManager = new InstallationManager(LogManager.GetLogger("InstallationManager"), this, ApplicationPaths, HttpClient, JsonSerializer, SecurityManager, ConfigurationManager, FileSystemManager, CryptographyProvider); + InstallationManager = new InstallationManager(LogManager.GetLogger("InstallationManager"), this, ApplicationPaths, HttpClient, JsonSerializer, SecurityManager, ConfigurationManager, FileSystemManager, CryptographyProvider, PackageRuntime); RegisterSingleInstance(InstallationManager); ZipClient = new ZipClient(FileSystemManager); @@ -1048,6 +1048,14 @@ namespace Emby.Server.Implementations await ((UserManager)UserManager).Initialize().ConfigureAwait(false); } + protected virtual string PackageRuntime + { + get + { + return "netframework"; + } + } + public static void LogEnvironmentInfo(ILogger logger, IApplicationPaths appPaths, bool isStartup) { logger.LogMultiline("Emby", LogSeverity.Info, GetBaseExceptionMessage(appPaths)); diff --git a/Emby.Server.Implementations/Channels/ChannelManager.cs b/Emby.Server.Implementations/Channels/ChannelManager.cs index 28a150370..d8d69a62e 100644 --- a/Emby.Server.Implementations/Channels/ChannelManager.cs +++ b/Emby.Server.Implementations/Channels/ChannelManager.cs @@ -1330,7 +1330,7 @@ namespace Emby.Server.Implementations.Channels var hasArtists = item as IHasArtist; if (hasArtists != null) { - hasArtists.Artists = info.Artists; + hasArtists.Artists = info.Artists.ToArray(); } var hasAlbumArtists = item as IHasAlbumArtist; diff --git a/Emby.Server.Implementations/Data/SqliteItemRepository.cs b/Emby.Server.Implementations/Data/SqliteItemRepository.cs index 064a66cd0..423ad2782 100644 --- a/Emby.Server.Implementations/Data/SqliteItemRepository.cs +++ b/Emby.Server.Implementations/Data/SqliteItemRepository.cs @@ -1028,9 +1028,9 @@ namespace Emby.Server.Implementations.Data var hasArtists = item as IHasArtist; if (hasArtists != null) { - if (hasArtists.Artists.Count > 0) + if (hasArtists.Artists.Length > 0) { - artists = string.Join("|", hasArtists.Artists.ToArray()); + artists = string.Join("|", hasArtists.Artists); } } saveItemStatement.TryBind("@Artists", artists); @@ -1908,7 +1908,7 @@ namespace Emby.Server.Implementations.Data var hasArtists = item as IHasArtist; if (hasArtists != null && !reader.IsDBNull(index)) { - hasArtists.Artists = reader.GetString(index).Split('|').Where(i => !string.IsNullOrWhiteSpace(i)).ToList(); + hasArtists.Artists = reader.GetString(index).Split(new[] { '|' }, StringSplitOptions.RemoveEmptyEntries); } index++; diff --git a/Emby.Server.Implementations/Dto/DtoService.cs b/Emby.Server.Implementations/Dto/DtoService.cs index 17e91bfa8..028257270 100644 --- a/Emby.Server.Implementations/Dto/DtoService.cs +++ b/Emby.Server.Implementations/Dto/DtoService.cs @@ -1617,7 +1617,7 @@ namespace Emby.Server.Implementations.Dto return null; } - var supportedEnhancers = _imageProcessor.GetSupportedEnhancers(item, ImageType.Primary).ToList(); + var supportedEnhancers = _imageProcessor.GetSupportedEnhancers(item, ImageType.Primary); ImageSize size; diff --git a/Emby.Server.Implementations/Library/Resolvers/SpecialFolderResolver.cs b/Emby.Server.Implementations/Library/Resolvers/SpecialFolderResolver.cs index 6c7c1f052..6a1f8ec6f 100644 --- a/Emby.Server.Implementations/Library/Resolvers/SpecialFolderResolver.cs +++ b/Emby.Server.Implementations/Library/Resolvers/SpecialFolderResolver.cs @@ -53,7 +53,7 @@ namespace Emby.Server.Implementations.Library.Resolvers return new CollectionFolder { CollectionType = GetCollectionType(args), - PhysicalLocationsList = args.PhysicalLocations.ToList() + PhysicalLocationsList = args.PhysicalLocations }; } } diff --git a/Emby.Server.Implementations/LiveTv/EmbyTV/EmbyTV.cs b/Emby.Server.Implementations/LiveTv/EmbyTV/EmbyTV.cs index f3d40ae19..2e12f46bf 100644 --- a/Emby.Server.Implementations/LiveTv/EmbyTV/EmbyTV.cs +++ b/Emby.Server.Implementations/LiveTv/EmbyTV/EmbyTV.cs @@ -607,20 +607,22 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV var timer = _timerProvider.GetTimer(timerId); if (timer != null) { + timer.Status = RecordingStatus.Cancelled; + if (string.IsNullOrWhiteSpace(timer.SeriesTimerId) || isSeriesCancelled) { _timerProvider.Delete(timer); } else { - timer.Status = RecordingStatus.Cancelled; _timerProvider.AddOrUpdate(timer, false); } } ActiveRecordingInfo activeRecordingInfo; if (_activeRecordings.TryGetValue(timerId, out activeRecordingInfo)) - { + { + activeRecordingInfo.Timer = timer; activeRecordingInfo.CancellationTokenSource.Cancel(); } } @@ -865,7 +867,6 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV public async Task<IEnumerable<RecordingInfo>> GetRecordingsAsync(CancellationToken cancellationToken) { return new List<RecordingInfo>(); - //return _activeRecordings.Values.ToList().Select(GetRecordingInfo).ToList(); } public string GetActiveRecordingPath(string id) @@ -881,7 +882,7 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV public IEnumerable<ActiveRecordingInfo> GetAllActiveRecordings() { - return _activeRecordings.Values; + return _activeRecordings.Values.Where(i => i.Timer.Status == RecordingStatus.InProgress && !i.CancellationTokenSource.IsCancellationRequested); } public ActiveRecordingInfo GetActiveRecordingInfo(string path) @@ -893,59 +894,19 @@ namespace Emby.Server.Implementations.LiveTv.EmbyTV foreach (var recording in _activeRecordings.Values) { - if (string.Equals(recording.Path, path, StringComparison.Ordinal)) + if (string.Equals(recording.Path, path, StringComparison.Ordinal) && !recording.CancellationTokenSource.IsCancellationRequested) { + var timer = recording.Timer; + if (timer.Status != RecordingStatus.InProgress) + { + return null; + } return recording; } } return null; } - private RecordingInfo GetRecordingInfo(ActiveRecordingInfo info) - { - var timer = info.Timer; - var program = info.Program; - - var result = new RecordingInfo - { - ChannelId = timer.ChannelId, - CommunityRating = timer.CommunityRating, - DateLastUpdated = DateTime.UtcNow, - EndDate = timer.EndDate, - EpisodeTitle = timer.EpisodeTitle, - Genres = timer.Genres, - Id = "recording" + timer.Id, - IsKids = timer.IsKids, - IsMovie = timer.IsMovie, - IsNews = timer.IsNews, - IsRepeat = timer.IsRepeat, - IsSeries = timer.IsProgramSeries, - IsSports = timer.IsSports, - Name = timer.Name, - OfficialRating = timer.OfficialRating, - OriginalAirDate = timer.OriginalAirDate, - Overview = timer.Overview, - ProgramId = timer.ProgramId, - SeriesTimerId = timer.SeriesTimerId, - StartDate = timer.StartDate, - Status = RecordingStatus.InProgress, - TimerId = timer.Id - }; - - if (program != null) - { - result.Audio = program.Audio; - result.ImagePath = program.ImagePath; - result.ImageUrl = program.ImageUrl; - result.IsHD = program.IsHD; - result.IsLive = program.IsLive; - result.IsPremiere = program.IsPremiere; - result.ShowId = program.ShowId; - } - - return result; - } - public Task<IEnumerable<TimerInfo>> GetTimersAsync(CancellationToken cancellationToken) { var excludeStatues = new List<RecordingStatus> diff --git a/Emby.Server.Implementations/Notifications/Notifications.cs b/Emby.Server.Implementations/Notifications/Notifications.cs index f95b3f701..ac3cc7564 100644 --- a/Emby.Server.Implementations/Notifications/Notifications.cs +++ b/Emby.Server.Implementations/Notifications/Notifications.cs @@ -422,7 +422,7 @@ namespace Emby.Server.Implementations.Notifications { var artists = hasArtist.AllArtists; - if (artists.Count > 0) + if (artists.Length > 0) { name = hasArtist.AllArtists[0] + " - " + name; } @@ -440,7 +440,7 @@ namespace Emby.Server.Implementations.Notifications name = item.SeriesName + " - " + name; } - if (item.Artists != null && item.Artists.Count > 0) + if (item.Artists != null && item.Artists.Length > 0) { name = item.Artists[0] + " - " + name; } diff --git a/Emby.Server.Implementations/Services/ServiceHandler.cs b/Emby.Server.Implementations/Services/ServiceHandler.cs index 526e62d39..f9fcfdbab 100644 --- a/Emby.Server.Implementations/Services/ServiceHandler.cs +++ b/Emby.Server.Implementations/Services/ServiceHandler.cs @@ -215,13 +215,13 @@ namespace Emby.Server.Implementations.Services if (name == null) continue; //thank you ASP.NET var values = request.QueryString.GetValues(name); - if (values.Length == 1) + if (values.Count == 1) { map[name] = values[0]; } else { - for (var i = 0; i < values.Length; i++) + for (var i = 0; i < values.Count; i++) { map[name + (i == 0 ? "" : "#" + i)] = values[i]; } @@ -235,13 +235,13 @@ namespace Emby.Server.Implementations.Services if (name == null) continue; //thank you ASP.NET var values = request.FormData.GetValues(name); - if (values.Length == 1) + if (values.Count == 1) { map[name] = values[0]; } else { - for (var i = 0; i < values.Length; i++) + for (var i = 0; i < values.Count; i++) { map[name + (i == 0 ? "" : "#" + i)] = values[i]; } diff --git a/Emby.Server.Implementations/Sorting/ArtistComparer.cs b/Emby.Server.Implementations/Sorting/ArtistComparer.cs index edb195820..616aff673 100644 --- a/Emby.Server.Implementations/Sorting/ArtistComparer.cs +++ b/Emby.Server.Implementations/Sorting/ArtistComparer.cs @@ -36,7 +36,7 @@ namespace Emby.Server.Implementations.Sorting return string.Empty; } - return audio.Artists.Count == 0 ? null : audio.Artists[0]; + return audio.Artists.Length == 0 ? null : audio.Artists[0]; } /// <summary> diff --git a/Emby.Server.Implementations/Updates/InstallationManager.cs b/Emby.Server.Implementations/Updates/InstallationManager.cs index 393fb76e2..75328a39a 100644 --- a/Emby.Server.Implementations/Updates/InstallationManager.cs +++ b/Emby.Server.Implementations/Updates/InstallationManager.cs @@ -122,7 +122,10 @@ namespace Emby.Server.Implementations.Updates private readonly ICryptoProvider _cryptographyProvider; - public InstallationManager(ILogger logger, IApplicationHost appHost, IApplicationPaths appPaths, IHttpClient httpClient, IJsonSerializer jsonSerializer, ISecurityManager securityManager, IConfigurationManager config, IFileSystem fileSystem, ICryptoProvider cryptographyProvider) + // netframework or netcore + private readonly string _packageRuntime; + + public InstallationManager(ILogger logger, IApplicationHost appHost, IApplicationPaths appPaths, IHttpClient httpClient, IJsonSerializer jsonSerializer, ISecurityManager securityManager, IConfigurationManager config, IFileSystem fileSystem, ICryptoProvider cryptographyProvider, string packageRuntime) { if (logger == null) { @@ -140,6 +143,7 @@ namespace Emby.Server.Implementations.Updates _config = config; _fileSystem = fileSystem; _cryptographyProvider = cryptographyProvider; + _packageRuntime = packageRuntime; _logger = logger; } @@ -157,7 +161,7 @@ namespace Emby.Server.Implementations.Updates /// Gets all available packages. /// </summary> /// <returns>Task{List{PackageInfo}}.</returns> - public async Task<PackageInfo[]> GetAvailablePackages(CancellationToken cancellationToken, + public async Task<List<PackageInfo>> GetAvailablePackages(CancellationToken cancellationToken, bool withRegistration = true, string packageType = null, Version applicationVersion = null) @@ -171,7 +175,7 @@ namespace Emby.Server.Implementations.Updates { "systemid", _applicationHost.SystemId } }; - using (var json = await _httpClient.Post("https://www.mb3admin.com/admin/service/package/retrieveall", data, cancellationToken).ConfigureAwait(false)) + using (var json = await _httpClient.Post("https://www.mb3admin.com/admin/service/package/retrieveall?includeAllRuntimes=true", data, cancellationToken).ConfigureAwait(false)) { cancellationToken.ThrowIfCancellationRequested(); @@ -195,7 +199,7 @@ namespace Emby.Server.Implementations.Updates /// </summary> /// <param name="cancellationToken">The cancellation token.</param> /// <returns>Task{List{PackageInfo}}.</returns> - public async Task<PackageInfo[]> GetAvailablePackagesWithoutRegistrationInfo(CancellationToken cancellationToken) + public async Task<List<PackageInfo>> GetAvailablePackagesWithoutRegistrationInfo(CancellationToken cancellationToken) { _logger.Info("Opening {0}", PackageCachePath); try @@ -209,7 +213,7 @@ namespace Emby.Server.Implementations.Updates UpdateCachedPackages(CancellationToken.None, false); } - return packages; + return FilterPackages(packages); } } catch (Exception) @@ -221,7 +225,7 @@ namespace Emby.Server.Implementations.Updates await UpdateCachedPackages(cancellationToken, true).ConfigureAwait(false); using (var stream = _fileSystem.OpenRead(PackageCachePath)) { - return _jsonSerializer.DeserializeFromStream<PackageInfo[]>(stream); + return FilterPackages(_jsonSerializer.DeserializeFromStream<PackageInfo[]>(stream)); } } @@ -244,7 +248,7 @@ namespace Emby.Server.Implementations.Updates var tempFile = await _httpClient.GetTempFile(new HttpRequestOptions { - Url = "https://www.mb3admin.com/admin/service/MB3Packages.json", + Url = "https://www.mb3admin.com/admin/service/EmbyPackages.json", CancellationToken = cancellationToken, Progress = new SimpleProgress<Double>() @@ -280,47 +284,74 @@ namespace Emby.Server.Implementations.Updates return TimeSpan.FromMinutes(3); } - protected PackageInfo[] FilterPackages(List<PackageInfo> packages) + protected List<PackageInfo> FilterPackages(IEnumerable<PackageInfo> packages) { + var list = new List<PackageInfo>(); foreach (var package in packages) { - package.versions = package.versions.Where(v => !string.IsNullOrWhiteSpace(v.sourceUrl)) - .OrderByDescending(GetPackageVersion).ToArray(); + var versions = new List<PackageVersionInfo>(); + foreach (var version in package.versions) + { + if (string.IsNullOrWhiteSpace(version.sourceUrl)) + { + continue; + } + + if (string.IsNullOrWhiteSpace(version.runtimes) || version.runtimes.IndexOf(_packageRuntime, StringComparison.OrdinalIgnoreCase) == -1) + { + continue; + } + + versions.Add(version); + } + + package.versions = versions + .OrderByDescending(GetPackageVersion) + .ToArray(); + + if (package.versions.Length == 0) + { + continue; + } + + list.Add(package); } // Remove packages with no versions - return packages.Where(p => p.versions.Any()).ToArray(); + return list; } - protected PackageInfo[] FilterPackages(PackageInfo[] packages, string packageType, Version applicationVersion) + protected List<PackageInfo> FilterPackages(IEnumerable<PackageInfo> packages, string packageType, Version applicationVersion) { - foreach (var package in packages) - { - package.versions = package.versions.Where(v => !string.IsNullOrWhiteSpace(v.sourceUrl)) - .OrderByDescending(GetPackageVersion).ToArray(); - } + var packagesList = FilterPackages(packages); - IEnumerable<PackageInfo> packagesList = packages; + var returnList = new List<PackageInfo>(); - if (!string.IsNullOrWhiteSpace(packageType)) - { - packagesList = packagesList.Where(p => string.Equals(p.type, packageType, StringComparison.OrdinalIgnoreCase)); - } + var filterOnPackageType = !string.IsNullOrWhiteSpace(packageType); - // If an app version was supplied, filter the versions for each package to only include supported versions - if (applicationVersion != null) + foreach (var p in packagesList) { - foreach (var package in packages) + if (filterOnPackageType && !string.Equals(p.type, packageType, StringComparison.OrdinalIgnoreCase)) { - package.versions = package.versions.Where(v => IsPackageVersionUpToDate(v, applicationVersion)).ToArray(); + continue; } - } - // Remove packages with no versions - packagesList = packagesList.Where(p => p.versions.Any()); + // If an app version was supplied, filter the versions for each package to only include supported versions + if (applicationVersion != null) + { + p.versions = p.versions.Where(v => IsPackageVersionUpToDate(v, applicationVersion)).ToArray(); + } + + if (p.versions.Length == 0) + { + continue; + } + + returnList.Add(p); + } - return packagesList.ToArray(); + return returnList; } /// <summary> diff --git a/MediaBrowser.Api/ChannelService.cs b/MediaBrowser.Api/ChannelService.cs index c7ceb41bc..35ac2b482 100644 --- a/MediaBrowser.Api/ChannelService.cs +++ b/MediaBrowser.Api/ChannelService.cs @@ -231,7 +231,7 @@ namespace MediaBrowser.Api SortOrder = request.SortOrder, SortBy = (request.SortBy ?? string.Empty).Split(',').Where(i => !string.IsNullOrWhiteSpace(i)).ToArray(), Filters = request.GetFilters().ToArray(), - Fields = request.GetItemFields().ToArray() + Fields = request.GetItemFields() }, CancellationToken.None).ConfigureAwait(false); diff --git a/MediaBrowser.Api/ConfigurationService.cs b/MediaBrowser.Api/ConfigurationService.cs index 92128634e..643ecd9c8 100644 --- a/MediaBrowser.Api/ConfigurationService.cs +++ b/MediaBrowser.Api/ConfigurationService.cs @@ -6,7 +6,6 @@ using MediaBrowser.Model.Configuration; using MediaBrowser.Model.Serialization; using System.Collections.Generic; using System.IO; -using System.Linq; using System.Threading.Tasks; using MediaBrowser.Controller.IO; diff --git a/MediaBrowser.Api/Devices/DeviceService.cs b/MediaBrowser.Api/Devices/DeviceService.cs index 544960f5f..012f0ddb2 100644 --- a/MediaBrowser.Api/Devices/DeviceService.cs +++ b/MediaBrowser.Api/Devices/DeviceService.cs @@ -1,5 +1,4 @@ using System; -using System.Linq; using MediaBrowser.Controller.Devices; using MediaBrowser.Controller.Net; using MediaBrowser.Model.Devices; @@ -143,7 +142,7 @@ namespace MediaBrowser.Api.Devices } else { - var file = Request.Files.First(); + var file = Request.Files.Length == 0 ? null : Request.Files[0]; var task = _deviceManager.AcceptCameraUpload(deviceId, file.InputStream, new LocalFileInfo { diff --git a/MediaBrowser.Api/Dlna/DlnaServerService.cs b/MediaBrowser.Api/Dlna/DlnaServerService.cs index fc8c0edf6..389244aa9 100644 --- a/MediaBrowser.Api/Dlna/DlnaServerService.cs +++ b/MediaBrowser.Api/Dlna/DlnaServerService.cs @@ -3,7 +3,6 @@ using System; using System.Collections.Generic; using System.Globalization; using System.IO; -using System.Linq; using System.Threading.Tasks; using MediaBrowser.Controller.IO; diff --git a/MediaBrowser.Api/Dlna/DlnaService.cs b/MediaBrowser.Api/Dlna/DlnaService.cs index fa3287ebd..4dd71f446 100644 --- a/MediaBrowser.Api/Dlna/DlnaService.cs +++ b/MediaBrowser.Api/Dlna/DlnaService.cs @@ -1,7 +1,7 @@ -using MediaBrowser.Controller.Dlna; +using System.Linq; +using MediaBrowser.Controller.Dlna; using MediaBrowser.Controller.Net; using MediaBrowser.Model.Dlna; -using System.Linq; using MediaBrowser.Model.Services; namespace MediaBrowser.Api.Dlna diff --git a/MediaBrowser.Api/Images/ImageService.cs b/MediaBrowser.Api/Images/ImageService.cs index 318360336..309c7195b 100644 --- a/MediaBrowser.Api/Images/ImageService.cs +++ b/MediaBrowser.Api/Images/ImageService.cs @@ -556,20 +556,7 @@ namespace MediaBrowser.Api.Images throw new ResourceNotFoundException(string.Format("{0} does not have an image of type {1}", item.Name, request.Type)); } - var supportedImageEnhancers = request.EnableImageEnhancers ? _imageProcessor.ImageEnhancers.Where(i => - { - try - { - return i.Supports(item, request.Type); - } - catch (Exception ex) - { - Logger.ErrorException("Error in image enhancer: {0}", ex, i.GetType().Name); - - return false; - } - - }).ToList() : new List<IImageEnhancer>(); + var supportedImageEnhancers = request.EnableImageEnhancers ? _imageProcessor.GetSupportedEnhancers(item, request.Type) : new List<IImageEnhancer>(); var cropwhitespace = request.Type == ImageType.Logo || request.Type == ImageType.Art diff --git a/MediaBrowser.Api/ItemUpdateService.cs b/MediaBrowser.Api/ItemUpdateService.cs index 56caf884b..47bd46ea5 100644 --- a/MediaBrowser.Api/ItemUpdateService.cs +++ b/MediaBrowser.Api/ItemUpdateService.cs @@ -352,7 +352,7 @@ namespace MediaBrowser.Api hasArtists.Artists = request .ArtistItems .Select(i => i.Name) - .ToList(); + .ToArray(); } } diff --git a/MediaBrowser.Api/LocalizationService.cs b/MediaBrowser.Api/LocalizationService.cs index 2c92505b1..56d32fc37 100644 --- a/MediaBrowser.Api/LocalizationService.cs +++ b/MediaBrowser.Api/LocalizationService.cs @@ -2,7 +2,6 @@ using MediaBrowser.Model.Entities; using MediaBrowser.Model.Globalization; using System.Collections.Generic; -using System.Linq; using MediaBrowser.Model.Services; namespace MediaBrowser.Api diff --git a/MediaBrowser.Api/Movies/CollectionService.cs b/MediaBrowser.Api/Movies/CollectionService.cs index 6511d3127..c63712f4c 100644 --- a/MediaBrowser.Api/Movies/CollectionService.cs +++ b/MediaBrowser.Api/Movies/CollectionService.cs @@ -4,7 +4,6 @@ using MediaBrowser.Controller.Net; using MediaBrowser.Model.Collections; using System; using System.Collections.Generic; -using System.Linq; using System.Threading.Tasks; using MediaBrowser.Model.Services; diff --git a/MediaBrowser.Api/Movies/MoviesService.cs b/MediaBrowser.Api/Movies/MoviesService.cs index 7873c1cd3..3e42026b1 100644 --- a/MediaBrowser.Api/Movies/MoviesService.cs +++ b/MediaBrowser.Api/Movies/MoviesService.cs @@ -426,7 +426,7 @@ namespace MediaBrowser.Api.Movies { var people = _libraryManager.GetPeople(new InternalPeopleQuery { - PersonTypes = new List<string> + PersonTypes = new string[] { PersonType.Director } diff --git a/MediaBrowser.Api/PlaylistService.cs b/MediaBrowser.Api/PlaylistService.cs index 07a976f39..54c995d3d 100644 --- a/MediaBrowser.Api/PlaylistService.cs +++ b/MediaBrowser.Api/PlaylistService.cs @@ -1,11 +1,11 @@ -using MediaBrowser.Controller.Dto; +using System.Linq; +using MediaBrowser.Controller.Dto; using MediaBrowser.Controller.Library; using MediaBrowser.Controller.Net; using MediaBrowser.Controller.Playlists; using MediaBrowser.Model.Dto; using MediaBrowser.Model.Playlists; using MediaBrowser.Model.Querying; -using System.Linq; using System.Threading.Tasks; using MediaBrowser.Model.Services; using MediaBrowser.Model.Extensions; diff --git a/MediaBrowser.Api/Reports/Data/ReportBuilder.cs b/MediaBrowser.Api/Reports/Data/ReportBuilder.cs index 6b10fcb05..6a1502c7e 100644 --- a/MediaBrowser.Api/Reports/Data/ReportBuilder.cs +++ b/MediaBrowser.Api/Reports/Data/ReportBuilder.cs @@ -533,7 +533,7 @@ namespace MediaBrowser.Api.Reports break; case HeaderMetadata.Tracks: - option.Column = (i, r) => this.GetObject<MusicAlbum, List<Audio>>(i, (x) => x.Tracks.ToList(), new List<Audio>()).Count(); + option.Column = (i, r) => this.GetObject<MusicAlbum, List<Audio>>(i, (x) => x.Tracks.Cast<Audio>().ToList(), new List<Audio>()).Count(); break; case HeaderMetadata.Audio: diff --git a/MediaBrowser.Api/SearchService.cs b/MediaBrowser.Api/SearchService.cs index 77e29d6cc..ad79ea57b 100644 --- a/MediaBrowser.Api/SearchService.cs +++ b/MediaBrowser.Api/SearchService.cs @@ -1,4 +1,5 @@ -using MediaBrowser.Controller.Drawing; +using System.Linq; +using MediaBrowser.Controller.Drawing; using MediaBrowser.Controller.Dto; using MediaBrowser.Controller.Entities; using MediaBrowser.Controller.Entities.Audio; @@ -7,7 +8,6 @@ using MediaBrowser.Controller.Library; using MediaBrowser.Controller.Net; using MediaBrowser.Model.Entities; using MediaBrowser.Model.Search; -using System.Linq; using System.Threading.Tasks; using MediaBrowser.Controller.LiveTv; using MediaBrowser.Model.Services; @@ -240,7 +240,7 @@ namespace MediaBrowser.Api if (album != null) { - result.Artists = album.Artists.ToArray(); + result.Artists = album.Artists; result.AlbumArtist = album.AlbumArtist; } @@ -250,7 +250,7 @@ namespace MediaBrowser.Api { result.Album = song.Album; result.AlbumArtist = song.AlbumArtists.FirstOrDefault(); - result.Artists = song.Artists.ToArray(); + result.Artists = song.Artists; } if (!string.IsNullOrWhiteSpace(item.ChannelId)) diff --git a/MediaBrowser.Api/SuggestionsService.cs b/MediaBrowser.Api/SuggestionsService.cs index 22432bf51..931772e6a 100644 --- a/MediaBrowser.Api/SuggestionsService.cs +++ b/MediaBrowser.Api/SuggestionsService.cs @@ -5,7 +5,6 @@ using MediaBrowser.Model.Dto; using MediaBrowser.Model.Querying; using MediaBrowser.Model.Services; using System; -using System.Linq; using System.Threading.Tasks; using MediaBrowser.Controller.Library; using MediaBrowser.Model.Extensions; diff --git a/MediaBrowser.Api/TvShowsService.cs b/MediaBrowser.Api/TvShowsService.cs index cd0c5d9e5..4b1e69c5d 100644 --- a/MediaBrowser.Api/TvShowsService.cs +++ b/MediaBrowser.Api/TvShowsService.cs @@ -14,7 +14,6 @@ using System.Linq; using System.Threading.Tasks; using MediaBrowser.Model.Dto; using MediaBrowser.Model.Services; -using MediaBrowser.Model.Extensions; namespace MediaBrowser.Api { diff --git a/MediaBrowser.Api/UserLibrary/ArtistsService.cs b/MediaBrowser.Api/UserLibrary/ArtistsService.cs index 7c1519e9f..4018759d9 100644 --- a/MediaBrowser.Api/UserLibrary/ArtistsService.cs +++ b/MediaBrowser.Api/UserLibrary/ArtistsService.cs @@ -132,7 +132,7 @@ namespace MediaBrowser.Api.UserLibrary /// <param name="request">The request.</param> /// <param name="items">The items.</param> /// <returns>IEnumerable{Tuple{System.StringFunc{System.Int32}}}.</returns> - protected override IEnumerable<BaseItem> GetAllItems(GetItemsByName request, IEnumerable<BaseItem> items) + protected override IEnumerable<BaseItem> GetAllItems(GetItemsByName request, IList<BaseItem> items) { throw new NotImplementedException(); } diff --git a/MediaBrowser.Api/UserLibrary/BaseItemsByNameService.cs b/MediaBrowser.Api/UserLibrary/BaseItemsByNameService.cs index 1d0065c7c..fca842289 100644 --- a/MediaBrowser.Api/UserLibrary/BaseItemsByNameService.cs +++ b/MediaBrowser.Api/UserLibrary/BaseItemsByNameService.cs @@ -257,7 +257,7 @@ namespace MediaBrowser.Api.UserLibrary parentItem = string.IsNullOrEmpty(request.ParentId) ? LibraryManager.RootFolder : LibraryManager.GetItemById(request.ParentId); } - IEnumerable<BaseItem> items; + IList<BaseItem> items; var excludeItemTypes = request.GetExcludeItemTypes(); var includeItemTypes = request.GetIncludeItemTypes(); @@ -280,19 +280,19 @@ namespace MediaBrowser.Api.UserLibrary if (!string.IsNullOrWhiteSpace(request.UserId)) { items = request.Recursive ? - folder.GetRecursiveChildren(user, query) : - folder.GetChildren(user, true).Where(filter); + folder.GetRecursiveChildren(user, query).ToList() : + folder.GetChildren(user, true).Where(filter).ToList(); } else { items = request.Recursive ? folder.GetRecursiveChildren(filter) : - folder.Children.Where(filter); + folder.Children.Where(filter).ToList(); } } else { - items = new[] { parentItem }.Where(filter); + items = new[] { parentItem }.Where(filter).ToList(); } var extractedItems = GetAllItems(request, items); @@ -500,7 +500,7 @@ namespace MediaBrowser.Api.UserLibrary /// <param name="request">The request.</param> /// <param name="items">The items.</param> /// <returns>IEnumerable{Task{`0}}.</returns> - protected abstract IEnumerable<BaseItem> GetAllItems(GetItemsByName request, IEnumerable<BaseItem> items); + protected abstract IEnumerable<BaseItem> GetAllItems(GetItemsByName request, IList<BaseItem> items); } /// <summary> diff --git a/MediaBrowser.Api/UserLibrary/GameGenresService.cs b/MediaBrowser.Api/UserLibrary/GameGenresService.cs index 56730c1b2..0b2ca4daf 100644 --- a/MediaBrowser.Api/UserLibrary/GameGenresService.cs +++ b/MediaBrowser.Api/UserLibrary/GameGenresService.cs @@ -93,7 +93,7 @@ namespace MediaBrowser.Api.UserLibrary /// <param name="request">The request.</param> /// <param name="items">The items.</param> /// <returns>IEnumerable{Tuple{System.StringFunc{System.Int32}}}.</returns> - protected override IEnumerable<BaseItem> GetAllItems(GetItemsByName request, IEnumerable<BaseItem> items) + protected override IEnumerable<BaseItem> GetAllItems(GetItemsByName request, IList<BaseItem> items) { throw new NotImplementedException(); } diff --git a/MediaBrowser.Api/UserLibrary/GenresService.cs b/MediaBrowser.Api/UserLibrary/GenresService.cs index fc387e5e3..d913f52d9 100644 --- a/MediaBrowser.Api/UserLibrary/GenresService.cs +++ b/MediaBrowser.Api/UserLibrary/GenresService.cs @@ -115,7 +115,7 @@ namespace MediaBrowser.Api.UserLibrary /// <param name="request">The request.</param> /// <param name="items">The items.</param> /// <returns>IEnumerable{Tuple{System.StringFunc{System.Int32}}}.</returns> - protected override IEnumerable<BaseItem> GetAllItems(GetItemsByName request, IEnumerable<BaseItem> items) + protected override IEnumerable<BaseItem> GetAllItems(GetItemsByName request, IList<BaseItem> items) { throw new NotImplementedException(); } diff --git a/MediaBrowser.Api/UserLibrary/MusicGenresService.cs b/MediaBrowser.Api/UserLibrary/MusicGenresService.cs index d1d4aa634..36dc773d4 100644 --- a/MediaBrowser.Api/UserLibrary/MusicGenresService.cs +++ b/MediaBrowser.Api/UserLibrary/MusicGenresService.cs @@ -94,7 +94,7 @@ namespace MediaBrowser.Api.UserLibrary /// <param name="request">The request.</param> /// <param name="items">The items.</param> /// <returns>IEnumerable{Tuple{System.StringFunc{System.Int32}}}.</returns> - protected override IEnumerable<BaseItem> GetAllItems(GetItemsByName request, IEnumerable<BaseItem> items) + protected override IEnumerable<BaseItem> GetAllItems(GetItemsByName request, IList<BaseItem> items) { throw new NotImplementedException(); } diff --git a/MediaBrowser.Api/UserLibrary/PersonsService.cs b/MediaBrowser.Api/UserLibrary/PersonsService.cs index 21f416025..9417447d8 100644 --- a/MediaBrowser.Api/UserLibrary/PersonsService.cs +++ b/MediaBrowser.Api/UserLibrary/PersonsService.cs @@ -96,15 +96,13 @@ namespace MediaBrowser.Api.UserLibrary /// <param name="request">The request.</param> /// <param name="items">The items.</param> /// <returns>IEnumerable{Tuple{System.StringFunc{System.Int32}}}.</returns> - protected override IEnumerable<BaseItem> GetAllItems(GetItemsByName request, IEnumerable<BaseItem> items) + protected override IEnumerable<BaseItem> GetAllItems(GetItemsByName request, IList<BaseItem> items) { var inputPersonTypes = ((GetPersons)request).PersonTypes; var personTypes = string.IsNullOrEmpty(inputPersonTypes) ? new string[] { } : inputPersonTypes.Split(','); - var itemsList = items.ToList(); - // Either get all people, or all people filtered by a specific person type - var allPeople = GetAllPeople(itemsList, personTypes); + var allPeople = GetAllPeople(items, personTypes); return allPeople .Select(i => i.Name) @@ -132,13 +130,13 @@ namespace MediaBrowser.Api.UserLibrary /// <param name="itemsList">The items list.</param> /// <param name="personTypes">The person types.</param> /// <returns>IEnumerable{PersonInfo}.</returns> - private IEnumerable<PersonInfo> GetAllPeople(IEnumerable<BaseItem> itemsList, IEnumerable<string> personTypes) + private IEnumerable<PersonInfo> GetAllPeople(IList<BaseItem> itemsList, string[] personTypes) { - var allIds = itemsList.Select(i => i.Id).ToList(); + var allIds = itemsList.Select(i => i.Id).ToArray(); var allPeople = LibraryManager.GetPeople(new InternalPeopleQuery { - PersonTypes = personTypes.ToList() + PersonTypes = personTypes }); return allPeople.Where(i => allIds.Contains(i.ItemId)).OrderBy(p => p.SortOrder ?? int.MaxValue).ThenBy(p => p.Type); diff --git a/MediaBrowser.Api/UserLibrary/StudiosService.cs b/MediaBrowser.Api/UserLibrary/StudiosService.cs index 7ac1264e8..f10cccbb1 100644 --- a/MediaBrowser.Api/UserLibrary/StudiosService.cs +++ b/MediaBrowser.Api/UserLibrary/StudiosService.cs @@ -103,11 +103,9 @@ namespace MediaBrowser.Api.UserLibrary /// <param name="request">The request.</param> /// <param name="items">The items.</param> /// <returns>IEnumerable{Tuple{System.StringFunc{System.Int32}}}.</returns> - protected override IEnumerable<BaseItem> GetAllItems(GetItemsByName request, IEnumerable<BaseItem> items) + protected override IEnumerable<BaseItem> GetAllItems(GetItemsByName request, IList<BaseItem> items) { - var itemsList = items.Where(i => i.Studios != null).ToList(); - - return itemsList + return items .SelectMany(i => i.Studios) .DistinctNames() .Select(name => LibraryManager.GetStudio(name)); diff --git a/MediaBrowser.Api/UserLibrary/YearsService.cs b/MediaBrowser.Api/UserLibrary/YearsService.cs index 1059b72cb..db622a9b3 100644 --- a/MediaBrowser.Api/UserLibrary/YearsService.cs +++ b/MediaBrowser.Api/UserLibrary/YearsService.cs @@ -96,11 +96,9 @@ namespace MediaBrowser.Api.UserLibrary /// <param name="request">The request.</param> /// <param name="items">The items.</param> /// <returns>IEnumerable{Tuple{System.StringFunc{System.Int32}}}.</returns> - protected override IEnumerable<BaseItem> GetAllItems(GetItemsByName request, IEnumerable<BaseItem> items) + protected override IEnumerable<BaseItem> GetAllItems(GetItemsByName request, IList<BaseItem> items) { - var itemsList = items.Where(i => i.ProductionYear != null).ToList(); - - return itemsList + return items .Select(i => i.ProductionYear ?? 0) .Where(i => i > 0) .Distinct() diff --git a/MediaBrowser.Api/VideosService.cs b/MediaBrowser.Api/VideosService.cs index dc7d09863..3bd0497f7 100644 --- a/MediaBrowser.Api/VideosService.cs +++ b/MediaBrowser.Api/VideosService.cs @@ -140,7 +140,6 @@ namespace MediaBrowser.Api public async Task PostAsync(MergeVersions request) { var items = request.Ids.Split(',') - .Select(i => new Guid(i)) .Select(i => _libraryManager.GetItemById(i)) .OfType<Video>() .ToList(); diff --git a/MediaBrowser.Common/Updates/IInstallationManager.cs b/MediaBrowser.Common/Updates/IInstallationManager.cs index ecc272605..dab38b27c 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<PackageInfo[]> GetAvailablePackages(CancellationToken cancellationToken, + Task<List<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<PackageInfo[]> GetAvailablePackagesWithoutRegistrationInfo(CancellationToken cancellationToken); + Task<List<PackageInfo>> GetAvailablePackagesWithoutRegistrationInfo(CancellationToken cancellationToken); /// <summary> /// Gets the package. diff --git a/MediaBrowser.Controller/Drawing/IImageProcessor.cs b/MediaBrowser.Controller/Drawing/IImageProcessor.cs index 29363f492..113f823f5 100644 --- a/MediaBrowser.Controller/Drawing/IImageProcessor.cs +++ b/MediaBrowser.Controller/Drawing/IImageProcessor.cs @@ -24,7 +24,7 @@ namespace MediaBrowser.Controller.Drawing /// Gets the image enhancers. /// </summary> /// <value>The image enhancers.</value> - IEnumerable<IImageEnhancer> ImageEnhancers { get; } + IImageEnhancer[] ImageEnhancers { get; } /// <summary> /// Gets the size of the image. @@ -54,7 +54,7 @@ namespace MediaBrowser.Controller.Drawing /// <param name="item">The item.</param> /// <param name="imageType">Type of the image.</param> /// <returns>IEnumerable{IImageEnhancer}.</returns> - IEnumerable<IImageEnhancer> GetSupportedEnhancers(IHasMetadata item, ImageType imageType); + List<IImageEnhancer> GetSupportedEnhancers(IHasMetadata item, ImageType imageType); /// <summary> /// Gets the image cache tag. diff --git a/MediaBrowser.Controller/Entities/AggregateFolder.cs b/MediaBrowser.Controller/Entities/AggregateFolder.cs index db84d6e2f..2105ef907 100644 --- a/MediaBrowser.Controller/Entities/AggregateFolder.cs +++ b/MediaBrowser.Controller/Entities/AggregateFolder.cs @@ -20,7 +20,7 @@ namespace MediaBrowser.Controller.Entities { public AggregateFolder() { - PhysicalLocationsList = new List<string>(); + PhysicalLocationsList = EmptyStringArray; } [IgnoreDataMember] @@ -58,7 +58,7 @@ namespace MediaBrowser.Controller.Entities } [IgnoreDataMember] - public override IEnumerable<string> PhysicalLocations + public override string[] PhysicalLocations { get { @@ -66,23 +66,23 @@ namespace MediaBrowser.Controller.Entities } } - public List<string> PhysicalLocationsList { get; set; } + public string[] PhysicalLocationsList { get; set; } protected override FileSystemMetadata[] GetFileSystemChildren(IDirectoryService directoryService) { - return CreateResolveArgs(directoryService, true).FileSystemChildren.ToArray(); + return CreateResolveArgs(directoryService, true).FileSystemChildren; } - private List<Guid> _childrenIds = null; + private Guid[] _childrenIds = null; private readonly object _childIdsLock = new object(); protected override List<BaseItem> LoadChildren() { lock (_childIdsLock) { - if (_childrenIds == null || _childrenIds.Count == 0) + if (_childrenIds == null || _childrenIds.Length == 0) { - var list = base.LoadChildren().ToList(); - _childrenIds = list.Select(i => i.Id).ToList(); + var list = base.LoadChildren(); + _childrenIds = list.Select(i => i.Id).ToArray(); return list; } @@ -105,9 +105,9 @@ namespace MediaBrowser.Controller.Entities if (!changed) { - var locations = PhysicalLocations.ToList(); + var locations = PhysicalLocations; - var newLocations = CreateResolveArgs(new DirectoryService(Logger, FileSystem), false).PhysicalLocations.ToList(); + var newLocations = CreateResolveArgs(new DirectoryService(Logger, FileSystem), false).PhysicalLocations; if (!locations.SequenceEqual(newLocations)) { @@ -163,7 +163,7 @@ namespace MediaBrowser.Controller.Entities _requiresRefresh = _requiresRefresh || !args.PhysicalLocations.SequenceEqual(PhysicalLocations); if (setPhysicalLocations) { - PhysicalLocationsList = args.PhysicalLocations.ToList(); + PhysicalLocationsList = args.PhysicalLocations; } return args; @@ -212,7 +212,14 @@ namespace MediaBrowser.Controller.Entities throw new ArgumentNullException("id"); } - return _virtualChildren.FirstOrDefault(i => i.Id == id); + foreach (var child in _virtualChildren) + { + if (child.Id == id) + { + return child; + } + } + return null; } } } diff --git a/MediaBrowser.Controller/Entities/Audio/Audio.cs b/MediaBrowser.Controller/Entities/Audio/Audio.cs index 0781dc35b..e029a447e 100644 --- a/MediaBrowser.Controller/Entities/Audio/Audio.cs +++ b/MediaBrowser.Controller/Entities/Audio/Audio.cs @@ -29,7 +29,7 @@ namespace MediaBrowser.Controller.Entities.Audio /// </summary> /// <value>The artist.</value> [IgnoreDataMember] - public List<string> Artists { get; set; } + public string[] Artists { get; set; } [IgnoreDataMember] public string[] AlbumArtists { get; set; } @@ -42,7 +42,7 @@ namespace MediaBrowser.Controller.Entities.Audio public Audio() { - Artists = new List<string>(); + Artists = EmptyStringArray; AlbumArtists = EmptyStringArray; } @@ -98,13 +98,23 @@ namespace MediaBrowser.Controller.Entities.Audio } [IgnoreDataMember] - public List<string> AllArtists + public string[] AllArtists { get { - var list = AlbumArtists.ToList(); + var list = new string[AlbumArtists.Length + Artists.Length]; - list.AddRange(Artists); + var index = 0; + foreach (var artist in AlbumArtists) + { + list[index] = artist; + index++; + } + foreach (var artist in AlbumArtists) + { + list[index] = artist; + index++; + } return list; @@ -160,7 +170,7 @@ namespace MediaBrowser.Controller.Entities.Audio songKey = Album + "-" + songKey; } - var albumArtist = AlbumArtists.FirstOrDefault(); + var albumArtist = AlbumArtists.Length == 0 ? null : AlbumArtists[0]; if (!string.IsNullOrWhiteSpace(albumArtist)) { songKey = albumArtist + "-" + songKey; diff --git a/MediaBrowser.Controller/Entities/Audio/IHasAlbumArtist.cs b/MediaBrowser.Controller/Entities/Audio/IHasAlbumArtist.cs index 6900699e5..b2dedada4 100644 --- a/MediaBrowser.Controller/Entities/Audio/IHasAlbumArtist.cs +++ b/MediaBrowser.Controller/Entities/Audio/IHasAlbumArtist.cs @@ -1,6 +1,4 @@ -using MediaBrowser.Controller.Library; -using System.Collections.Generic; - + namespace MediaBrowser.Controller.Entities.Audio { public interface IHasAlbumArtist @@ -10,16 +8,8 @@ namespace MediaBrowser.Controller.Entities.Audio public interface IHasArtist { - List<string> AllArtists { get; } - - List<string> Artists { get; set; } - } + string[] AllArtists { get; } - public static class HasArtistExtensions - { - public static bool HasAnyArtist(this IHasArtist hasArtist, string artist) - { - return NameExtensions.EqualsAny(hasArtist.AllArtists, artist); - } + string[] Artists { get; set; } } } diff --git a/MediaBrowser.Controller/Entities/Audio/MusicAlbum.cs b/MediaBrowser.Controller/Entities/Audio/MusicAlbum.cs index c35e81826..82f880b3f 100644 --- a/MediaBrowser.Controller/Entities/Audio/MusicAlbum.cs +++ b/MediaBrowser.Controller/Entities/Audio/MusicAlbum.cs @@ -10,7 +10,6 @@ using System.Threading; using System.Threading.Tasks; using MediaBrowser.Controller.Dto; using MediaBrowser.Controller.Library; -using MediaBrowser.Model.Dto; namespace MediaBrowser.Controller.Entities.Audio { @@ -20,11 +19,11 @@ namespace MediaBrowser.Controller.Entities.Audio public class MusicAlbum : Folder, IHasAlbumArtist, IHasArtist, IHasMusicGenres, IHasLookupInfo<AlbumInfo>, IMetadataContainer { public string[] AlbumArtists { get; set; } - public List<string> Artists { get; set; } + public string[] Artists { get; set; } public MusicAlbum() { - Artists = new List<string>(); + Artists = EmptyStringArray; AlbumArtists = EmptyStringArray; } @@ -48,17 +47,22 @@ namespace MediaBrowser.Controller.Entities.Audio public MusicArtist GetMusicArtist(DtoOptions options) { - var artist = GetParents().OfType<MusicArtist>().FirstOrDefault(); - - if (artist == null) + var parents = GetParents(); + foreach (var parent in parents) { - var name = AlbumArtist; - if (!string.IsNullOrWhiteSpace(name)) + var artist = parent as MusicArtist; + if (artist != null) { - artist = LibraryManager.GetArtist(name, options); + return artist; } } - return artist; + + var name = AlbumArtist; + if (!string.IsNullOrWhiteSpace(name)) + { + return LibraryManager.GetArtist(name, options); + } + return null; } [IgnoreDataMember] @@ -80,23 +84,32 @@ namespace MediaBrowser.Controller.Entities.Audio } [IgnoreDataMember] - public List<string> AllArtists + public string[] AllArtists { get { - var list = AlbumArtists.ToList(); + var list = new string[AlbumArtists.Length + Artists.Length]; - list.AddRange(Artists); + var index = 0; + foreach (var artist in AlbumArtists) + { + list[index] = artist; + index++; + } + foreach (var artist in AlbumArtists) + { + list[index] = artist; + index++; + } return list; - } } [IgnoreDataMember] public string AlbumArtist { - get { return AlbumArtists.FirstOrDefault(); } + get { return AlbumArtists.Length == 0 ? null : AlbumArtists[0]; } } [IgnoreDataMember] @@ -110,11 +123,11 @@ namespace MediaBrowser.Controller.Entities.Audio /// </summary> /// <value>The tracks.</value> [IgnoreDataMember] - public IEnumerable<Audio> Tracks + public IEnumerable<BaseItem> Tracks { get { - return GetRecursiveChildren(i => i is Audio).Cast<Audio>(); + return GetRecursiveChildren(i => i is Audio); } } @@ -200,7 +213,7 @@ namespace MediaBrowser.Controller.Entities.Audio public async Task RefreshAllMetadata(MetadataRefreshOptions refreshOptions, IProgress<double> progress, CancellationToken cancellationToken) { - var items = GetRecursiveChildren().ToList(); + var items = GetRecursiveChildren(); var totalItems = items.Count; var numComplete = 0; @@ -239,27 +252,22 @@ namespace MediaBrowser.Controller.Entities.Audio private async Task RefreshArtists(MetadataRefreshOptions refreshOptions, CancellationToken cancellationToken) { - var artists = AllArtists.Select(i => + var all = AllArtists; + foreach (var i in all) { // This should not be necessary but we're seeing some cases of it if (string.IsNullOrWhiteSpace(i)) { - return null; + continue; } var artist = LibraryManager.GetArtist(i); if (!artist.IsAccessedByName) { - return null; + continue; } - return artist; - - }).Where(i => i != null).ToList(); - - foreach (var artist in artists) - { await artist.RefreshMetadata(refreshOptions, cancellationToken).ConfigureAwait(false); } } diff --git a/MediaBrowser.Controller/Entities/Audio/MusicArtist.cs b/MediaBrowser.Controller/Entities/Audio/MusicArtist.cs index 559806ac4..19fe68e25 100644 --- a/MediaBrowser.Controller/Entities/Audio/MusicArtist.cs +++ b/MediaBrowser.Controller/Entities/Audio/MusicArtist.cs @@ -214,18 +214,19 @@ namespace MediaBrowser.Controller.Entities.Audio { var items = GetRecursiveChildren(); - var songs = items.OfType<Audio>().ToList(); - - var others = items.Except(songs).ToList(); - - var totalItems = songs.Count + others.Count; + var totalItems = items.Count; var numComplete = 0; var childUpdateType = ItemUpdateType.None; // Refresh songs - foreach (var item in songs) + foreach (var item in items) { + if (!(item is Audio)) + { + continue; + } + cancellationToken.ThrowIfCancellationRequested(); var updateType = await item.RefreshMetadata(refreshOptions, cancellationToken).ConfigureAwait(false); @@ -248,8 +249,13 @@ namespace MediaBrowser.Controller.Entities.Audio await RefreshMetadata(parentRefreshOptions, cancellationToken).ConfigureAwait(false); // Refresh all non-songs - foreach (var item in others) + foreach (var item in items) { + if (item is Audio) + { + continue; + } + cancellationToken.ThrowIfCancellationRequested(); var updateType = await item.RefreshMetadata(parentRefreshOptions, cancellationToken).ConfigureAwait(false); diff --git a/MediaBrowser.Controller/Entities/Audio/MusicGenre.cs b/MediaBrowser.Controller/Entities/Audio/MusicGenre.cs index d4a85b4d0..02e652048 100644 --- a/MediaBrowser.Controller/Entities/Audio/MusicGenre.cs +++ b/MediaBrowser.Controller/Entities/Audio/MusicGenre.cs @@ -1,6 +1,5 @@ using System; using System.Collections.Generic; -using System.Linq; using MediaBrowser.Model.Serialization; using MediaBrowser.Common.Extensions; using MediaBrowser.Controller.Extensions; diff --git a/MediaBrowser.Controller/Entities/BaseItem.cs b/MediaBrowser.Controller/Entities/BaseItem.cs index c158378a6..24fa80ef6 100644 --- a/MediaBrowser.Controller/Entities/BaseItem.cs +++ b/MediaBrowser.Controller/Entities/BaseItem.cs @@ -570,7 +570,7 @@ namespace MediaBrowser.Controller.Entities } [IgnoreDataMember] - public virtual IEnumerable<string> PhysicalLocations + public virtual string[] PhysicalLocations { get { diff --git a/MediaBrowser.Controller/Entities/Book.cs b/MediaBrowser.Controller/Entities/Book.cs index 7cb242589..9b1a52f83 100644 --- a/MediaBrowser.Controller/Entities/Book.cs +++ b/MediaBrowser.Controller/Entities/Book.cs @@ -1,7 +1,7 @@ using System; +using System.Linq; using MediaBrowser.Controller.Providers; using MediaBrowser.Model.Configuration; -using System.Linq; using MediaBrowser.Model.Serialization; using MediaBrowser.Model.Entities; diff --git a/MediaBrowser.Controller/Entities/CollectionFolder.cs b/MediaBrowser.Controller/Entities/CollectionFolder.cs index 3e2c501b4..537beb26b 100644 --- a/MediaBrowser.Controller/Entities/CollectionFolder.cs +++ b/MediaBrowser.Controller/Entities/CollectionFolder.cs @@ -27,8 +27,8 @@ namespace MediaBrowser.Controller.Entities public CollectionFolder() { - PhysicalLocationsList = new List<string>(); - PhysicalFolderIds = new List<Guid>(); + PhysicalLocationsList = EmptyStringArray; + PhysicalFolderIds = EmptyGuidArray; } [IgnoreDataMember] @@ -140,7 +140,7 @@ namespace MediaBrowser.Controller.Entities } [IgnoreDataMember] - public override IEnumerable<string> PhysicalLocations + public override string[] PhysicalLocations { get { @@ -153,12 +153,12 @@ namespace MediaBrowser.Controller.Entities return true; } - public List<string> PhysicalLocationsList { get; set; } - public List<Guid> PhysicalFolderIds { get; set; } + public string[] PhysicalLocationsList { get; set; } + public Guid[] PhysicalFolderIds { get; set; } protected override FileSystemMetadata[] GetFileSystemChildren(IDirectoryService directoryService) { - return CreateResolveArgs(directoryService, true).FileSystemChildren.ToArray(); + return CreateResolveArgs(directoryService, true).FileSystemChildren; } private bool _requiresRefresh; @@ -168,9 +168,9 @@ namespace MediaBrowser.Controller.Entities if (!changed) { - var locations = PhysicalLocations.ToList(); + var locations = PhysicalLocations; - var newLocations = CreateResolveArgs(new DirectoryService(Logger, FileSystem), false).PhysicalLocations.ToList(); + var newLocations = CreateResolveArgs(new DirectoryService(Logger, FileSystem), false).PhysicalLocations; if (!locations.SequenceEqual(newLocations)) { @@ -180,7 +180,7 @@ namespace MediaBrowser.Controller.Entities if (!changed) { - var folderIds = PhysicalFolderIds.ToList(); + var folderIds = PhysicalFolderIds; var newFolderIds = GetPhysicalFolders(false).Select(i => i.Id).ToList(); @@ -242,15 +242,15 @@ namespace MediaBrowser.Controller.Entities LinkedChildren = linkedChildren.ToArray(linkedChildren.Count); - var folderIds = PhysicalFolderIds.ToList(); - var newFolderIds = physicalFolders.Select(i => i.Id).ToList(); + var folderIds = PhysicalFolderIds; + var newFolderIds = physicalFolders.Select(i => i.Id).ToArray(); if (!folderIds.SequenceEqual(newFolderIds)) { changed = true; if (setFolders) { - PhysicalFolderIds = newFolderIds.ToList(); + PhysicalFolderIds = newFolderIds; } } @@ -307,7 +307,7 @@ namespace MediaBrowser.Controller.Entities _requiresRefresh = _requiresRefresh || !args.PhysicalLocations.SequenceEqual(PhysicalLocations); if (setPhysicalLocations) { - PhysicalLocationsList = args.PhysicalLocations.ToList(); + PhysicalLocationsList = args.PhysicalLocations; } return args; diff --git a/MediaBrowser.Controller/Entities/Game.cs b/MediaBrowser.Controller/Entities/Game.cs index eb2638ee4..a99058925 100644 --- a/MediaBrowser.Controller/Entities/Game.cs +++ b/MediaBrowser.Controller/Entities/Game.cs @@ -3,7 +3,6 @@ using MediaBrowser.Model.Configuration; using MediaBrowser.Model.Entities; using System; using System.Collections.Generic; -using System.Linq; using MediaBrowser.Model.IO; using MediaBrowser.Model.Serialization; diff --git a/MediaBrowser.Controller/Entities/GameGenre.cs b/MediaBrowser.Controller/Entities/GameGenre.cs index 836020d88..4e78a7fa5 100644 --- a/MediaBrowser.Controller/Entities/GameGenre.cs +++ b/MediaBrowser.Controller/Entities/GameGenre.cs @@ -1,6 +1,5 @@ using System; using System.Collections.Generic; -using System.Linq; using MediaBrowser.Model.Serialization; using MediaBrowser.Common.Extensions; using MediaBrowser.Controller.Extensions; diff --git a/MediaBrowser.Controller/Entities/Genre.cs b/MediaBrowser.Controller/Entities/Genre.cs index 4b70eae58..790f8938e 100644 --- a/MediaBrowser.Controller/Entities/Genre.cs +++ b/MediaBrowser.Controller/Entities/Genre.cs @@ -2,7 +2,6 @@ using MediaBrowser.Controller.Entities.Audio; using System; using System.Collections.Generic; -using System.Linq; using MediaBrowser.Common.Extensions; using MediaBrowser.Controller.Extensions; using MediaBrowser.Model.Extensions; diff --git a/MediaBrowser.Controller/Entities/ICollectionFolder.cs b/MediaBrowser.Controller/Entities/ICollectionFolder.cs index d8b02034c..b70ad322d 100644 --- a/MediaBrowser.Controller/Entities/ICollectionFolder.cs +++ b/MediaBrowser.Controller/Entities/ICollectionFolder.cs @@ -13,7 +13,7 @@ namespace MediaBrowser.Controller.Entities string Path { get; } string Name { get; } Guid Id { get; } - IEnumerable<string> PhysicalLocations { get; } + string[] PhysicalLocations { get; } } public interface ISupportsUserSpecificView diff --git a/MediaBrowser.Controller/Entities/InternalPeopleQuery.cs b/MediaBrowser.Controller/Entities/InternalPeopleQuery.cs index 05d23d986..9e0e9c208 100644 --- a/MediaBrowser.Controller/Entities/InternalPeopleQuery.cs +++ b/MediaBrowser.Controller/Entities/InternalPeopleQuery.cs @@ -6,7 +6,7 @@ namespace MediaBrowser.Controller.Entities public class InternalPeopleQuery { public Guid ItemId { get; set; } - public List<string> PersonTypes { get; set; } + public string[] PersonTypes { get; set; } public List<string> ExcludePersonTypes { get; set; } public int? MaxListOrder { get; set; } public Guid AppearsInItemId { get; set; } @@ -14,7 +14,7 @@ namespace MediaBrowser.Controller.Entities public InternalPeopleQuery() { - PersonTypes = new List<string>(); + PersonTypes = new string[] {}; ExcludePersonTypes = new List<string>(); } } diff --git a/MediaBrowser.Controller/Entities/Movies/BoxSet.cs b/MediaBrowser.Controller/Entities/Movies/BoxSet.cs index 2768d8465..900e8a664 100644 --- a/MediaBrowser.Controller/Entities/Movies/BoxSet.cs +++ b/MediaBrowser.Controller/Entities/Movies/BoxSet.cs @@ -1,5 +1,4 @@ -using MediaBrowser.Controller.Entities.TV; -using MediaBrowser.Controller.Providers; +using MediaBrowser.Controller.Providers; using MediaBrowser.Model.Configuration; using MediaBrowser.Model.Entities; using MediaBrowser.Model.Querying; @@ -169,7 +168,7 @@ namespace MediaBrowser.Controller.Entities.Movies if (base.IsVisible(user)) { - return base.GetChildren(user, true).Any(); + return base.GetChildren(user, true).Count > 0; } return false; diff --git a/MediaBrowser.Controller/Entities/MusicVideo.cs b/MediaBrowser.Controller/Entities/MusicVideo.cs index 2028c1c3b..b7470d679 100644 --- a/MediaBrowser.Controller/Entities/MusicVideo.cs +++ b/MediaBrowser.Controller/Entities/MusicVideo.cs @@ -9,15 +9,15 @@ namespace MediaBrowser.Controller.Entities public class MusicVideo : Video, IHasArtist, IHasMusicGenres, IHasLookupInfo<MusicVideoInfo> { [IgnoreDataMember] - public List<string> Artists { get; set; } + public string[] Artists { get; set; } public MusicVideo() { - Artists = new List<string>(); + Artists = EmptyStringArray; } [IgnoreDataMember] - public List<string> AllArtists + public string[] AllArtists { get { diff --git a/MediaBrowser.Controller/Entities/PeopleHelper.cs b/MediaBrowser.Controller/Entities/PeopleHelper.cs index 40a93d9e6..412eb9499 100644 --- a/MediaBrowser.Controller/Entities/PeopleHelper.cs +++ b/MediaBrowser.Controller/Entities/PeopleHelper.cs @@ -105,7 +105,15 @@ namespace MediaBrowser.Controller.Entities { throw new ArgumentNullException("name"); } - return people.Any(i => string.Equals(i.Name, name, StringComparison.OrdinalIgnoreCase)); + + foreach (var i in people) + { + if (string.Equals(i.Name, name, StringComparison.OrdinalIgnoreCase)) + { + return true; + } + } + return false; } } } diff --git a/MediaBrowser.Controller/Entities/Person.cs b/MediaBrowser.Controller/Entities/Person.cs index 20d9c7999..b3a91f944 100644 --- a/MediaBrowser.Controller/Entities/Person.cs +++ b/MediaBrowser.Controller/Entities/Person.cs @@ -1,7 +1,6 @@ using MediaBrowser.Controller.Providers; using System; using System.Collections.Generic; -using System.Linq; using MediaBrowser.Common.Extensions; using MediaBrowser.Controller.Extensions; using MediaBrowser.Model.Entities; diff --git a/MediaBrowser.Controller/Entities/Photo.cs b/MediaBrowser.Controller/Entities/Photo.cs index e95ceee52..8e9eac50c 100644 --- a/MediaBrowser.Controller/Entities/Photo.cs +++ b/MediaBrowser.Controller/Entities/Photo.cs @@ -1,5 +1,4 @@ using MediaBrowser.Model.Drawing; -using System.Linq; using MediaBrowser.Model.Serialization; namespace MediaBrowser.Controller.Entities @@ -39,7 +38,16 @@ namespace MediaBrowser.Controller.Entities { get { - return GetParents().OfType<PhotoAlbum>().FirstOrDefault(); + var parents = GetParents(); + foreach (var parent in parents) + { + var photoAlbum = parent as PhotoAlbum; + if (photoAlbum != null) + { + return photoAlbum; + } + } + return null; } } diff --git a/MediaBrowser.Controller/Entities/Studio.cs b/MediaBrowser.Controller/Entities/Studio.cs index 8cb65c60a..a6a72d994 100644 --- a/MediaBrowser.Controller/Entities/Studio.cs +++ b/MediaBrowser.Controller/Entities/Studio.cs @@ -1,6 +1,5 @@ using System; using System.Collections.Generic; -using System.Linq; using MediaBrowser.Model.Serialization; using MediaBrowser.Common.Extensions; using MediaBrowser.Controller.Extensions; diff --git a/MediaBrowser.Controller/Entities/TV/Season.cs b/MediaBrowser.Controller/Entities/TV/Season.cs index 8b934bc47..bf6dc5678 100644 --- a/MediaBrowser.Controller/Entities/TV/Season.cs +++ b/MediaBrowser.Controller/Entities/TV/Season.cs @@ -81,7 +81,7 @@ namespace MediaBrowser.Controller.Entities.TV public override int GetChildCount(User user) { - var result = GetChildren(user, true).Count(); + var result = GetChildren(user, true).Count; return result; } diff --git a/MediaBrowser.Controller/Entities/TV/Series.cs b/MediaBrowser.Controller/Entities/TV/Series.cs index 545e8518a..6514d31d2 100644 --- a/MediaBrowser.Controller/Entities/TV/Series.cs +++ b/MediaBrowser.Controller/Entities/TV/Series.cs @@ -214,7 +214,15 @@ namespace MediaBrowser.Controller.Entities.TV { get { - return Children.OfType<Video>().Any(); + var children = Children; + foreach (var child in children) + { + if (child is Video) + { + return true; + } + } + return false; } } diff --git a/MediaBrowser.Controller/Entities/User.cs b/MediaBrowser.Controller/Entities/User.cs index d5d229bb3..851686ea8 100644 --- a/MediaBrowser.Controller/Entities/User.cs +++ b/MediaBrowser.Controller/Entities/User.cs @@ -5,7 +5,6 @@ using MediaBrowser.Model.Connect; using MediaBrowser.Model.Serialization; using MediaBrowser.Model.Users; using System; -using System.Linq; using System.Threading; using System.Threading.Tasks; @@ -279,7 +278,14 @@ namespace MediaBrowser.Controller.Entities return true; } - return schedules.Any(i => IsParentalScheduleAllowed(i, date)); + foreach (var i in schedules) + { + if (IsParentalScheduleAllowed(i, date)) + { + return true; + } + } + return false; } private bool IsParentalScheduleAllowed(AccessSchedule schedule, DateTime date) @@ -304,7 +310,14 @@ namespace MediaBrowser.Controller.Entities public bool IsFolderGrouped(Guid id) { - return Configuration.GroupedFolders.Select(i => new Guid(i)).Contains(id); + foreach (var i in Configuration.GroupedFolders) + { + if (new Guid(i) == id) + { + return true; + } + } + return false; } [IgnoreDataMember] diff --git a/MediaBrowser.Controller/Entities/UserRootFolder.cs b/MediaBrowser.Controller/Entities/UserRootFolder.cs index dd70277a7..2ed3bf20f 100644 --- a/MediaBrowser.Controller/Entities/UserRootFolder.cs +++ b/MediaBrowser.Controller/Entities/UserRootFolder.cs @@ -24,7 +24,7 @@ namespace MediaBrowser.Controller.Entities { if (_childrenIds == null) { - var list = base.LoadChildren().ToList(); + var list = base.LoadChildren(); _childrenIds = list.Select(i => i.Id).ToList(); return list; } diff --git a/MediaBrowser.Controller/Entities/UserView.cs b/MediaBrowser.Controller/Entities/UserView.cs index 7ab4e98fc..66174034d 100644 --- a/MediaBrowser.Controller/Entities/UserView.cs +++ b/MediaBrowser.Controller/Entities/UserView.cs @@ -4,9 +4,9 @@ using MediaBrowser.Model.Entities; using MediaBrowser.Model.Querying; using System; using System.Collections.Generic; +using System.Linq; using MediaBrowser.Model.Serialization; using System.Threading.Tasks; -using System.Linq; using MediaBrowser.Controller.Dto; namespace MediaBrowser.Controller.Entities @@ -60,7 +60,7 @@ namespace MediaBrowser.Controller.Entities public override int GetChildCount(User user) { - return GetChildren(user, true).Count(); + return GetChildren(user, true).Count; } protected override QueryResult<BaseItem> GetItemsInternal(InternalItemsQuery query) diff --git a/MediaBrowser.Controller/Entities/Year.cs b/MediaBrowser.Controller/Entities/Year.cs index 61b1a3b1a..7d820b007 100644 --- a/MediaBrowser.Controller/Entities/Year.cs +++ b/MediaBrowser.Controller/Entities/Year.cs @@ -1,7 +1,6 @@ using System; using System.Collections.Generic; using System.Globalization; -using System.Linq; using MediaBrowser.Model.Serialization; namespace MediaBrowser.Controller.Entities diff --git a/MediaBrowser.Controller/IO/FileData.cs b/MediaBrowser.Controller/IO/FileData.cs index 27af60700..880b3a0ce 100644 --- a/MediaBrowser.Controller/IO/FileData.cs +++ b/MediaBrowser.Controller/IO/FileData.cs @@ -3,7 +3,6 @@ using MediaBrowser.Controller.Providers; using MediaBrowser.Model.Logging; using System; using System.Collections.Generic; -using System.Linq; using MediaBrowser.Model.IO; namespace MediaBrowser.Controller.IO @@ -107,7 +106,15 @@ namespace MediaBrowser.Controller.IO } } - return dict.Values.ToArray(); + var returnResult = new FileSystemMetadata[dict.Count]; + var index = 0; + var values = dict.Values; + foreach (var value in values) + { + returnResult[index] = value; + index++; + } + return returnResult; } } diff --git a/MediaBrowser.Controller/Library/ItemResolveArgs.cs b/MediaBrowser.Controller/Library/ItemResolveArgs.cs index 963e4b71b..56392eee7 100644 --- a/MediaBrowser.Controller/Library/ItemResolveArgs.cs +++ b/MediaBrowser.Controller/Library/ItemResolveArgs.cs @@ -4,7 +4,6 @@ using System; using System.Collections.Generic; using System.IO; using System.Linq; - using MediaBrowser.Controller.Configuration; using MediaBrowser.Controller.IO; using MediaBrowser.Model.Configuration; @@ -134,7 +133,14 @@ namespace MediaBrowser.Controller.Library // Not officially supported but in some cases we can handle it. if (item == null) { - item = parent.GetParents().OfType<T>().FirstOrDefault(); + var parents = parent.GetParents(); + foreach (var currentParent in parents) + { + if (currentParent is T) + { + return true; + } + } } return item != null; @@ -167,12 +173,12 @@ namespace MediaBrowser.Controller.Library /// Gets the physical locations. /// </summary> /// <value>The physical locations.</value> - public IEnumerable<string> PhysicalLocations + public string[] PhysicalLocations { get { var paths = string.IsNullOrWhiteSpace(Path) ? new string[] { } : new[] { Path }; - return AdditionalLocations == null ? paths : paths.Concat(AdditionalLocations); + return AdditionalLocations == null ? paths : paths.Concat(AdditionalLocations).ToArray(); } } diff --git a/MediaBrowser.Controller/Library/NameExtensions.cs b/MediaBrowser.Controller/Library/NameExtensions.cs index 693b7b221..bab334a6d 100644 --- a/MediaBrowser.Controller/Library/NameExtensions.cs +++ b/MediaBrowser.Controller/Library/NameExtensions.cs @@ -1,7 +1,5 @@ using System; using System.Collections.Generic; -using System.Globalization; -using System.Linq; using MediaBrowser.Controller.Extensions; using MediaBrowser.Model.Extensions; @@ -9,25 +7,6 @@ namespace MediaBrowser.Controller.Library { public static class NameExtensions { - public static bool EqualsAny(IEnumerable<string> names, string x) - { - x = NormalizeForComparison(x); - - return names.Any(y => string.Compare(x, y, StringComparison.OrdinalIgnoreCase) == 0); - //return names.Any(y => string.Compare(x, y, CultureInfo.InvariantCulture, CompareOptions.IgnoreCase | CompareOptions.IgnoreNonSpace) == 0); - } - - private static string NormalizeForComparison(string name) - { - if (name == null) - { - return string.Empty; - } - - return name; - //return name.RemoveDiacritics(); - } - private static string RemoveDiacritics(string name) { if (name == null) @@ -44,27 +23,4 @@ namespace MediaBrowser.Controller.Library return names.DistinctBy(RemoveDiacritics, StringComparer.OrdinalIgnoreCase); } } - - public class DistinctNameComparer : IComparer<string>, IEqualityComparer<string> - { - public int Compare(string x, string y) - { - if (string.IsNullOrWhiteSpace(x) && string.IsNullOrWhiteSpace(y)) - { - return 0; - } - - return string.Compare(x.RemoveDiacritics(), y.RemoveDiacritics(), StringComparison.OrdinalIgnoreCase); - } - - public bool Equals(string x, string y) - { - return Compare(x, y) == 0; - } - - public int GetHashCode(string obj) - { - return (obj ?? string.Empty).GetHashCode(); - } - } } diff --git a/MediaBrowser.Controller/LiveTv/LiveTvAudioRecording.cs b/MediaBrowser.Controller/LiveTv/LiveTvAudioRecording.cs index 25bc10dec..c29d73253 100644 --- a/MediaBrowser.Controller/LiveTv/LiveTvAudioRecording.cs +++ b/MediaBrowser.Controller/LiveTv/LiveTvAudioRecording.cs @@ -6,7 +6,6 @@ using MediaBrowser.Model.Entities; using MediaBrowser.Model.LiveTv; using System; using System.Collections.Generic; -using System.Linq; using MediaBrowser.Model.Serialization; using System.Threading.Tasks; using MediaBrowser.Controller.Library; diff --git a/MediaBrowser.Controller/LiveTv/LiveTvProgram.cs b/MediaBrowser.Controller/LiveTv/LiveTvProgram.cs index 3efbc41f1..1607dbcba 100644 --- a/MediaBrowser.Controller/LiveTv/LiveTvProgram.cs +++ b/MediaBrowser.Controller/LiveTv/LiveTvProgram.cs @@ -9,7 +9,6 @@ using MediaBrowser.Common.Configuration; using MediaBrowser.Model.Entities; using MediaBrowser.Model.Providers; using MediaBrowser.Model.Serialization; -using MediaBrowser.Model.Extensions; namespace MediaBrowser.Controller.LiveTv { diff --git a/MediaBrowser.Controller/LiveTv/LiveTvVideoRecording.cs b/MediaBrowser.Controller/LiveTv/LiveTvVideoRecording.cs index 2c26d3556..950949f37 100644 --- a/MediaBrowser.Controller/LiveTv/LiveTvVideoRecording.cs +++ b/MediaBrowser.Controller/LiveTv/LiveTvVideoRecording.cs @@ -5,7 +5,6 @@ using MediaBrowser.Model.Entities; using MediaBrowser.Model.LiveTv; using System; using System.Collections.Generic; -using System.Linq; using MediaBrowser.Model.Serialization; using System.Threading.Tasks; using MediaBrowser.Controller.Library; diff --git a/MediaBrowser.Controller/Providers/DirectoryService.cs b/MediaBrowser.Controller/Providers/DirectoryService.cs index 337bb23a4..d957470d3 100644 --- a/MediaBrowser.Controller/Providers/DirectoryService.cs +++ b/MediaBrowser.Controller/Providers/DirectoryService.cs @@ -4,7 +4,6 @@ using System.Collections.Concurrent; using System.Collections.Generic; using System.IO; using System.Linq; - using MediaBrowser.Controller.IO; using MediaBrowser.Model.IO; @@ -73,14 +72,23 @@ namespace MediaBrowser.Controller.Providers return entries; } - public IEnumerable<FileSystemMetadata> GetFiles(string path) + public List<FileSystemMetadata> GetFiles(string path) { return GetFiles(path, false); } - public IEnumerable<FileSystemMetadata> GetFiles(string path, bool clearCache) + public List<FileSystemMetadata> GetFiles(string path, bool clearCache) { - return GetFileSystemEntries(path, clearCache).Where(i => !i.IsDirectory); + var list = new List<FileSystemMetadata>(); + var items = GetFileSystemEntries(path, clearCache); + foreach (var item in items) + { + if (!item.IsDirectory) + { + list.Add(item); + } + } + return list; } public FileSystemMetadata GetFile(string path) diff --git a/MediaBrowser.Controller/Providers/IDirectoryService.cs b/MediaBrowser.Controller/Providers/IDirectoryService.cs index 374703948..6f864f4be 100644 --- a/MediaBrowser.Controller/Providers/IDirectoryService.cs +++ b/MediaBrowser.Controller/Providers/IDirectoryService.cs @@ -6,7 +6,7 @@ namespace MediaBrowser.Controller.Providers public interface IDirectoryService { FileSystemMetadata[] GetFileSystemEntries(string path); - IEnumerable<FileSystemMetadata> GetFiles(string path); + List<FileSystemMetadata> GetFiles(string path); FileSystemMetadata GetFile(string path); } }
\ No newline at end of file diff --git a/MediaBrowser.Controller/Providers/MetadataResult.cs b/MediaBrowser.Controller/Providers/MetadataResult.cs index 99402a969..5ed55ea16 100644 --- a/MediaBrowser.Controller/Providers/MetadataResult.cs +++ b/MediaBrowser.Controller/Providers/MetadataResult.cs @@ -1,7 +1,6 @@ using MediaBrowser.Controller.Entities; using System; using System.Collections.Generic; -using System.Linq; namespace MediaBrowser.Controller.Providers { @@ -51,7 +50,15 @@ namespace MediaBrowser.Controller.Providers UserDataList = new List<UserItemData>(); } - var userData = UserDataList.FirstOrDefault(i => string.Equals(userId, i.UserId.ToString("N"), StringComparison.OrdinalIgnoreCase)); + UserItemData userData = null; + + foreach (var i in UserDataList) + { + if (string.Equals(userId, i.UserId.ToString("N"), StringComparison.OrdinalIgnoreCase)) + { + userData = i; + } + } if (userData == null) { diff --git a/MediaBrowser.Controller/Providers/SongInfo.cs b/MediaBrowser.Controller/Providers/SongInfo.cs index 988e931cd..e3a6f5d37 100644 --- a/MediaBrowser.Controller/Providers/SongInfo.cs +++ b/MediaBrowser.Controller/Providers/SongInfo.cs @@ -1,4 +1,3 @@ -using System.Collections.Generic; namespace MediaBrowser.Controller.Providers { @@ -6,11 +5,11 @@ namespace MediaBrowser.Controller.Providers { public string[] AlbumArtists { get; set; } public string Album { get; set; } - public List<string> Artists { get; set; } + public string[] Artists { get; set; } public SongInfo() { - Artists = new List<string>(); + Artists = EmptyStringArray; AlbumArtists = EmptyStringArray; } } diff --git a/MediaBrowser.Controller/Session/SessionInfo.cs b/MediaBrowser.Controller/Session/SessionInfo.cs index 265f4f544..90c1de2f2 100644 --- a/MediaBrowser.Controller/Session/SessionInfo.cs +++ b/MediaBrowser.Controller/Session/SessionInfo.cs @@ -2,7 +2,6 @@ using MediaBrowser.Model.Session; using System; using System.Collections.Generic; -using System.Linq; using MediaBrowser.Controller.Entities; using MediaBrowser.Model.Logging; using MediaBrowser.Model.Threading; @@ -194,7 +193,19 @@ namespace MediaBrowser.Controller.Session public bool ContainsUser(Guid userId) { - return (UserId ?? Guid.Empty) == userId || AdditionalUsers.Any(i => userId == new Guid(i.UserId)); + if ((UserId ?? Guid.Empty) == userId) + { + return true; + } + + foreach (var additionalUser in AdditionalUsers) + { + if (userId == new Guid(additionalUser.UserId)) + { + return true; + } + } + return false; } private readonly object _progressLock = new object(); diff --git a/MediaBrowser.LocalMetadata/Images/EpisodeLocalImageProvider.cs b/MediaBrowser.LocalMetadata/Images/EpisodeLocalImageProvider.cs index 881d2a85a..9195a9cd4 100644 --- a/MediaBrowser.LocalMetadata/Images/EpisodeLocalImageProvider.cs +++ b/MediaBrowser.LocalMetadata/Images/EpisodeLocalImageProvider.cs @@ -4,10 +4,8 @@ using MediaBrowser.Controller.Providers; using MediaBrowser.Model.Entities; using System; using System.Collections.Generic; -using System.IO; using System.Linq; -using MediaBrowser.Controller.IO; using MediaBrowser.Model.IO; namespace MediaBrowser.LocalMetadata.Images @@ -40,49 +38,50 @@ namespace MediaBrowser.LocalMetadata.Images { var parentPath = _fileSystem.GetDirectoryName(item.Path); - var parentPathFiles = directoryService.GetFiles(parentPath) - .ToList(); + var parentPathFiles = directoryService.GetFiles(parentPath); var nameWithoutExtension = _fileSystem.GetFileNameWithoutExtension(item.Path); return GetFilesFromParentFolder(nameWithoutExtension, parentPathFiles); } - private List<LocalImageInfo> GetFilesFromParentFolder(string filenameWithoutExtension, IEnumerable<FileSystemMetadata> parentPathFiles) + private List<LocalImageInfo> GetFilesFromParentFolder(string filenameWithoutExtension, List<FileSystemMetadata> parentPathFiles) { var thumbName = filenameWithoutExtension + "-thumb"; - return parentPathFiles - .Where(i => - { - if (i.IsDirectory) - { - return false; - } - - if (BaseItem.SupportedImageExtensions.Contains(i.Extension, StringComparer.OrdinalIgnoreCase)) - { - var currentNameWithoutExtension = _fileSystem.GetFileNameWithoutExtension(i); - - if (string.Equals(filenameWithoutExtension, currentNameWithoutExtension, StringComparison.OrdinalIgnoreCase)) - { - return true; - } - - if (string.Equals(thumbName, currentNameWithoutExtension, StringComparison.OrdinalIgnoreCase)) - { - return true; - } - } - - return false; - }) - .Select(i => new LocalImageInfo - { - FileInfo = i, - Type = ImageType.Primary - }) - .ToList(); + var list = new List<LocalImageInfo>(1); + + foreach (var i in parentPathFiles) + { + if (i.IsDirectory) + { + continue; + } + + if (BaseItem.SupportedImageExtensions.Contains(i.Extension, StringComparer.OrdinalIgnoreCase)) + { + var currentNameWithoutExtension = _fileSystem.GetFileNameWithoutExtension(i); + + if (string.Equals(filenameWithoutExtension, currentNameWithoutExtension, StringComparison.OrdinalIgnoreCase)) + { + list.Add(new LocalImageInfo + { + FileInfo = i, + Type = ImageType.Primary + }); + } + + else if (string.Equals(thumbName, currentNameWithoutExtension, StringComparison.OrdinalIgnoreCase)) + { + list.Add(new LocalImageInfo + { + FileInfo = i, + Type = ImageType.Primary + }); + } + } + } + return list; } } } diff --git a/MediaBrowser.LocalMetadata/Images/LocalImageProvider.cs b/MediaBrowser.LocalMetadata/Images/LocalImageProvider.cs index ddfb70321..56a2c271f 100644 --- a/MediaBrowser.LocalMetadata/Images/LocalImageProvider.cs +++ b/MediaBrowser.LocalMetadata/Images/LocalImageProvider.cs @@ -7,7 +7,6 @@ using System; using System.Collections.Generic; using System.Globalization; using System.Linq; - using MediaBrowser.Controller.IO; using MediaBrowser.Model.IO; diff --git a/MediaBrowser.Model/Dto/BaseItemDto.cs b/MediaBrowser.Model/Dto/BaseItemDto.cs index 8da20c9f5..8bad650b5 100644 --- a/MediaBrowser.Model/Dto/BaseItemDto.cs +++ b/MediaBrowser.Model/Dto/BaseItemDto.cs @@ -432,7 +432,7 @@ namespace MediaBrowser.Model.Dto /// 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 artist items. diff --git a/MediaBrowser.Model/Dto/MediaSourceInfo.cs b/MediaBrowser.Model/Dto/MediaSourceInfo.cs index 8f3f0648d..27920bdf3 100644 --- a/MediaBrowser.Model/Dto/MediaSourceInfo.cs +++ b/MediaBrowser.Model/Dto/MediaSourceInfo.cs @@ -2,7 +2,6 @@ using MediaBrowser.Model.Extensions; using MediaBrowser.Model.MediaInfo; using System.Collections.Generic; -using System.Linq; using MediaBrowser.Model.Serialization; using MediaBrowser.Model.Session; @@ -91,19 +90,15 @@ namespace MediaBrowser.Model.Dto return; } - var internalStreams = MediaStreams - .Where(i => !i.IsExternal) - .ToList(); - - if (internalStreams.Count == 0) + var bitrate = 0; + foreach (var stream in MediaStreams) { - return; + if (!stream.IsExternal) + { + bitrate += stream.BitRate ?? 0; + } } - var bitrate = internalStreams - .Select(m => m.BitRate ?? 0) - .Sum(); - if (bitrate > 0) { Bitrate = bitrate; diff --git a/MediaBrowser.Model/Extensions/ListHelper.cs b/MediaBrowser.Model/Extensions/ListHelper.cs index cfcb229c8..6fe1793db 100644 --- a/MediaBrowser.Model/Extensions/ListHelper.cs +++ b/MediaBrowser.Model/Extensions/ListHelper.cs @@ -1,6 +1,4 @@ using System; -using System.Collections.Generic; -using System.Linq; namespace MediaBrowser.Model.Extensions { @@ -13,7 +11,14 @@ namespace MediaBrowser.Model.Extensions throw new ArgumentNullException("value"); } - return list.Contains(value, StringComparer.OrdinalIgnoreCase); + foreach (var item in list) + { + if (string.Equals(item, value, StringComparison.OrdinalIgnoreCase)) + { + return true; + } + } + return false; } public static bool ContainsAnyIgnoreCase(string[] list, string[] values) diff --git a/MediaBrowser.Model/Services/QueryParamCollection.cs b/MediaBrowser.Model/Services/QueryParamCollection.cs index a3e00f587..e13e5feca 100644 --- a/MediaBrowser.Model/Services/QueryParamCollection.cs +++ b/MediaBrowser.Model/Services/QueryParamCollection.cs @@ -58,9 +58,7 @@ namespace MediaBrowser.Model.Services { if (string.IsNullOrWhiteSpace(value)) { - var stringComparison = GetStringComparison(); - - var parameters = this.Where(p => string.Equals(key, p.Name, stringComparison)).ToArray(); + var parameters = GetItems(key); foreach (var p in parameters) { @@ -85,14 +83,6 @@ namespace MediaBrowser.Model.Services } /// <summary> - /// True if the collection contains a query parameter with the given name. - /// </summary> - public bool ContainsKey(string name) - { - return this.Any(p => p.Name == name); - } - - /// <summary> /// Removes all parameters of the given name. /// </summary> /// <returns>The number of parameters that were removed</returns> @@ -106,16 +96,49 @@ namespace MediaBrowser.Model.Services { var stringComparison = GetStringComparison(); - return this.Where(p => string.Equals(p.Name, name, stringComparison)) - .Select(p => p.Value) - .FirstOrDefault(); + foreach (var pair in this) + { + if (string.Equals(pair.Name, name, stringComparison)) + { + return pair.Value; + } + } + + return null; + } + + public virtual List<NameValuePair> GetItems(string name) + { + var stringComparison = GetStringComparison(); + + var list = new List<NameValuePair>(); + + foreach (var pair in this) + { + if (string.Equals(pair.Name, name, stringComparison)) + { + list.Add(pair); + } + } + + return list; } - public virtual string[] GetValues(string name) + public virtual List<string> GetValues(string name) { var stringComparison = GetStringComparison(); - return this.Where(p => string.Equals(p.Name, name, stringComparison)).Select(p => p.Value).ToArray(); + var list = new List<string>(); + + foreach (var pair in this) + { + if (string.Equals(pair.Name, name, stringComparison)) + { + list.Add(pair.Value); + } + } + + return list; } public Dictionary<string, string> ToDictionary() @@ -134,7 +157,17 @@ namespace MediaBrowser.Model.Services public IEnumerable<string> Keys { - get { return this.Select(i => i.Name); } + get + { + var keys = new string[this.Count]; + + for (var i = 0; i < keys.Length; i++) + { + keys[i] = this[i].Name; + } + + return keys; + } } /// <summary> diff --git a/MediaBrowser.Model/Updates/PackageVersionInfo.cs b/MediaBrowser.Model/Updates/PackageVersionInfo.cs index 5e0631b3b..3ac518187 100644 --- a/MediaBrowser.Model/Updates/PackageVersionInfo.cs +++ b/MediaBrowser.Model/Updates/PackageVersionInfo.cs @@ -89,5 +89,7 @@ namespace MediaBrowser.Model.Updates public string targetFilename { get; set; } public string infoUrl { get; set; } + + public string runtimes { get; set; } } }
\ No newline at end of file diff --git a/MediaBrowser.Providers/Books/AudioBookMetadataService.cs b/MediaBrowser.Providers/Books/AudioBookMetadataService.cs index b9e265d22..834ec6cd3 100644 --- a/MediaBrowser.Providers/Books/AudioBookMetadataService.cs +++ b/MediaBrowser.Providers/Books/AudioBookMetadataService.cs @@ -23,9 +23,9 @@ namespace MediaBrowser.Providers.Books var sourceItem = source.Item; var targetItem = target.Item; - if (replaceData || targetItem.Artists.Count == 0) + if (replaceData || targetItem.Artists.Length == 0) { - targetItem.Artists = sourceItem.Artists.ToList(); + targetItem.Artists = sourceItem.Artists; } if (replaceData || string.IsNullOrEmpty(targetItem.Album)) diff --git a/MediaBrowser.Providers/Books/AudioPodcastMetadataService.cs b/MediaBrowser.Providers/Books/AudioPodcastMetadataService.cs index 2ea0a7ee9..09546e4b6 100644 --- a/MediaBrowser.Providers/Books/AudioPodcastMetadataService.cs +++ b/MediaBrowser.Providers/Books/AudioPodcastMetadataService.cs @@ -23,9 +23,9 @@ namespace MediaBrowser.Providers.Books var sourceItem = source.Item; var targetItem = target.Item; - if (replaceData || targetItem.Artists.Count == 0) + if (replaceData || targetItem.Artists.Length == 0) { - targetItem.Artists = sourceItem.Artists.ToList(); + targetItem.Artists = sourceItem.Artists; } if (replaceData || string.IsNullOrEmpty(targetItem.Album)) diff --git a/MediaBrowser.Providers/BoxSets/BoxSetMetadataService.cs b/MediaBrowser.Providers/BoxSets/BoxSetMetadataService.cs index 81cd41605..12748a8a7 100644 --- a/MediaBrowser.Providers/BoxSets/BoxSetMetadataService.cs +++ b/MediaBrowser.Providers/BoxSets/BoxSetMetadataService.cs @@ -41,11 +41,7 @@ namespace MediaBrowser.Providers.BoxSets if (mergeMetadataSettings) { - // Retain shortcut children - var linkedChildren = sourceItem.LinkedChildren.ToList(); - linkedChildren.AddRange(sourceItem.LinkedChildren.Where(i => i.Type == LinkedChildType.Shortcut)); - - targetItem.LinkedChildren = linkedChildren.ToArray(linkedChildren.Count); + targetItem.LinkedChildren = sourceItem.LinkedChildren; targetItem.Shares = sourceItem.Shares; } } diff --git a/MediaBrowser.Providers/Chapters/ChapterManager.cs b/MediaBrowser.Providers/Chapters/ChapterManager.cs index 3973d3de7..d3e9efd82 100644 --- a/MediaBrowser.Providers/Chapters/ChapterManager.cs +++ b/MediaBrowser.Providers/Chapters/ChapterManager.cs @@ -13,7 +13,6 @@ using MediaBrowser.Model.Entities; using MediaBrowser.Model.Logging; using System; using System.Collections.Generic; -using System.Linq; using System.Threading; using System.Threading.Tasks; diff --git a/MediaBrowser.Providers/Manager/GenericPriorityQueue.cs b/MediaBrowser.Providers/Manager/GenericPriorityQueue.cs index 03bb0f68c..e24547614 100644 --- a/MediaBrowser.Providers/Manager/GenericPriorityQueue.cs +++ b/MediaBrowser.Providers/Manager/GenericPriorityQueue.cs @@ -1,7 +1,6 @@ using System; using System.Collections; using System.Collections.Generic; -using System.Linq; using System.Text; using System.Threading.Tasks; diff --git a/MediaBrowser.Providers/Manager/GenericPriorityQueueNode.cs b/MediaBrowser.Providers/Manager/GenericPriorityQueueNode.cs index e6e93e443..ec908095f 100644 --- a/MediaBrowser.Providers/Manager/GenericPriorityQueueNode.cs +++ b/MediaBrowser.Providers/Manager/GenericPriorityQueueNode.cs @@ -1,6 +1,5 @@ using System; using System.Collections.Generic; -using System.Linq; using System.Text; using System.Threading.Tasks; diff --git a/MediaBrowser.Providers/Manager/IFixedSizePriorityQueue.cs b/MediaBrowser.Providers/Manager/IFixedSizePriorityQueue.cs index 8da88e1c6..a49d42aca 100644 --- a/MediaBrowser.Providers/Manager/IFixedSizePriorityQueue.cs +++ b/MediaBrowser.Providers/Manager/IFixedSizePriorityQueue.cs @@ -1,6 +1,5 @@ using System; using System.Collections.Generic; -using System.Linq; using System.Text; using System.Threading.Tasks; diff --git a/MediaBrowser.Providers/Manager/IPriorityQueue.cs b/MediaBrowser.Providers/Manager/IPriorityQueue.cs index 425992b18..23f08a13e 100644 --- a/MediaBrowser.Providers/Manager/IPriorityQueue.cs +++ b/MediaBrowser.Providers/Manager/IPriorityQueue.cs @@ -1,6 +1,5 @@ using System; using System.Collections.Generic; -using System.Linq; using System.Text; using System.Threading.Tasks; diff --git a/MediaBrowser.Providers/Manager/SimplePriorityQueue.cs b/MediaBrowser.Providers/Manager/SimplePriorityQueue.cs index f4c261a81..879ae1dca 100644 --- a/MediaBrowser.Providers/Manager/SimplePriorityQueue.cs +++ b/MediaBrowser.Providers/Manager/SimplePriorityQueue.cs @@ -1,7 +1,6 @@ using System; using System.Collections; using System.Collections.Generic; -using System.Linq; using System.Text; using System.Threading.Tasks; diff --git a/MediaBrowser.Providers/MediaInfo/AudioImageProvider.cs b/MediaBrowser.Providers/MediaInfo/AudioImageProvider.cs index b8b603245..a4f2053a9 100644 --- a/MediaBrowser.Providers/MediaInfo/AudioImageProvider.cs +++ b/MediaBrowser.Providers/MediaInfo/AudioImageProvider.cs @@ -93,7 +93,7 @@ namespace MediaBrowser.Providers.MediaInfo private string GetAudioImagePath(Audio item) { var filename = item.Album ?? string.Empty; - filename += string.Join(",", item.Artists.ToArray(item.Artists.Count)); + filename += string.Join(",", item.Artists); if (!string.IsNullOrWhiteSpace(item.Album)) { diff --git a/MediaBrowser.Providers/MediaInfo/FFProbeAudioInfo.cs b/MediaBrowser.Providers/MediaInfo/FFProbeAudioInfo.cs index fb1fed8b3..b0785298b 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.ToList(); + audio.Artists = data.Artists; audio.AlbumArtists = data.AlbumArtists; audio.IndexNumber = data.IndexNumber; audio.ParentIndexNumber = data.ParentIndexNumber; diff --git a/MediaBrowser.Providers/Music/AlbumMetadataService.cs b/MediaBrowser.Providers/Music/AlbumMetadataService.cs index fe39a841e..4230c517a 100644 --- a/MediaBrowser.Providers/Music/AlbumMetadataService.cs +++ b/MediaBrowser.Providers/Music/AlbumMetadataService.cs @@ -106,7 +106,7 @@ namespace MediaBrowser.Providers.Music .SelectMany(i => i.Artists) .Distinct(StringComparer.OrdinalIgnoreCase) .OrderBy(i => i) - .ToList(); + .ToArray(); if (!item.Artists.SequenceEqual(artists, StringComparer.OrdinalIgnoreCase)) { @@ -158,7 +158,7 @@ namespace MediaBrowser.Providers.Music var sourceItem = source.Item; var targetItem = target.Item; - if (replaceData || targetItem.Artists.Count == 0) + if (replaceData || targetItem.Artists.Length == 0) { targetItem.Artists = sourceItem.Artists; } diff --git a/MediaBrowser.Providers/Music/ArtistMetadataService.cs b/MediaBrowser.Providers/Music/ArtistMetadataService.cs index c8008ba1e..0ff161576 100644 --- a/MediaBrowser.Providers/Music/ArtistMetadataService.cs +++ b/MediaBrowser.Providers/Music/ArtistMetadataService.cs @@ -31,7 +31,7 @@ namespace MediaBrowser.Providers.Music }) : item.GetRecursiveChildren(i => i is IHasArtist && !i.IsFolder); - var currentList = item.Genres.ToList(); + var currentList = item.Genres; item.Genres = taggedItems.SelectMany(i => i.Genres) .DistinctNames() diff --git a/MediaBrowser.Providers/Music/AudioMetadataService.cs b/MediaBrowser.Providers/Music/AudioMetadataService.cs index 68a4fcd7c..f02eae19f 100644 --- a/MediaBrowser.Providers/Music/AudioMetadataService.cs +++ b/MediaBrowser.Providers/Music/AudioMetadataService.cs @@ -21,9 +21,9 @@ namespace MediaBrowser.Providers.Music var sourceItem = source.Item; var targetItem = target.Item; - if (replaceData || targetItem.Artists.Count == 0) + if (replaceData || targetItem.Artists.Length == 0) { - targetItem.Artists = sourceItem.Artists.ToList(); + targetItem.Artists = sourceItem.Artists; } if (replaceData || string.IsNullOrEmpty(targetItem.Album)) diff --git a/MediaBrowser.Providers/Music/MusicVideoMetadataService.cs b/MediaBrowser.Providers/Music/MusicVideoMetadataService.cs index 27c6deb74..28504dbd7 100644 --- a/MediaBrowser.Providers/Music/MusicVideoMetadataService.cs +++ b/MediaBrowser.Providers/Music/MusicVideoMetadataService.cs @@ -28,9 +28,9 @@ namespace MediaBrowser.Providers.Music targetItem.Album = sourceItem.Album; } - if (replaceData || targetItem.Artists.Count == 0) + if (replaceData || targetItem.Artists.Length == 0) { - targetItem.Artists = sourceItem.Artists.ToList(); + targetItem.Artists = sourceItem.Artists; } } diff --git a/MediaBrowser.Providers/Playlists/PlaylistMetadataService.cs b/MediaBrowser.Providers/Playlists/PlaylistMetadataService.cs index dccef3a09..d39d3baf5 100644 --- a/MediaBrowser.Providers/Playlists/PlaylistMetadataService.cs +++ b/MediaBrowser.Providers/Playlists/PlaylistMetadataService.cs @@ -42,12 +42,9 @@ namespace MediaBrowser.Providers.Playlists { if (!item.IsLocked && !item.LockedFields.Contains(MetadataFields.Genres)) { - var items = item.GetLinkedChildren() - .ToList(); - - var currentList = item.Genres.ToList(); + var currentList = item.Genres; - item.Genres = items.SelectMany(i => i.Genres) + item.Genres = item.GetLinkedChildren().SelectMany(i => i.Genres) .Distinct(StringComparer.OrdinalIgnoreCase) .ToList(); diff --git a/MediaBrowser.Server.Mono/Program.cs b/MediaBrowser.Server.Mono/Program.cs index 73a568ca9..443699b5a 100644 --- a/MediaBrowser.Server.Mono/Program.cs +++ b/MediaBrowser.Server.Mono/Program.cs @@ -261,9 +261,10 @@ namespace MediaBrowser.Server.Mono { var args = Environment.GetCommandLineArgs() .Skip(1) - .Select(NormalizeCommandLineArgument); + .Select(NormalizeCommandLineArgument) + .ToArray(); - commandLineArgsString = string.Join(" ", args.ToArray()); + commandLineArgsString = string.Join(" ", args); } _logger.Info("Executable: {0}", module); diff --git a/MediaBrowser.ServerApplication/Native/LoopUtil.cs b/MediaBrowser.ServerApplication/Native/LoopUtil.cs index 7c7471231..0efdba389 100644 --- a/MediaBrowser.ServerApplication/Native/LoopUtil.cs +++ b/MediaBrowser.ServerApplication/Native/LoopUtil.cs @@ -1,6 +1,5 @@ using System; using System.Collections.Generic; -using System.Linq; using System.Runtime.InteropServices; using System.Text; using System.Threading.Tasks; diff --git a/MediaBrowser.XbmcMetadata/EntryPoint.cs b/MediaBrowser.XbmcMetadata/EntryPoint.cs index ac5313a29..b1c687a6e 100644 --- a/MediaBrowser.XbmcMetadata/EntryPoint.cs +++ b/MediaBrowser.XbmcMetadata/EntryPoint.cs @@ -8,7 +8,6 @@ using MediaBrowser.Model.Logging; using MediaBrowser.XbmcMetadata.Configuration; using MediaBrowser.XbmcMetadata.Savers; using System; -using System.Linq; using MediaBrowser.Controller.Dto; namespace MediaBrowser.XbmcMetadata diff --git a/MediaBrowser.XbmcMetadata/Parsers/MovieNfoParser.cs b/MediaBrowser.XbmcMetadata/Parsers/MovieNfoParser.cs index f9ca238c7..85f9f92ba 100644 --- a/MediaBrowser.XbmcMetadata/Parsers/MovieNfoParser.cs +++ b/MediaBrowser.XbmcMetadata/Parsers/MovieNfoParser.cs @@ -1,4 +1,5 @@ -using MediaBrowser.Common.Configuration; +using System.Linq; +using MediaBrowser.Common.Configuration; using MediaBrowser.Controller.Entities; using MediaBrowser.Controller.Entities.Movies; using MediaBrowser.Controller.Providers; @@ -81,7 +82,9 @@ namespace MediaBrowser.XbmcMetadata.Parsers if (!string.IsNullOrWhiteSpace(val) && movie != null) { - movie.Artists.Add(val); + var list = movie.Artists.ToList(); + list.Add(val); + movie.Artists = list.ToArray(); } break; diff --git a/MediaBrowser.XbmcMetadata/Savers/AlbumNfoSaver.cs b/MediaBrowser.XbmcMetadata/Savers/AlbumNfoSaver.cs index ec53b3bc4..f9f9c9b98 100644 --- a/MediaBrowser.XbmcMetadata/Savers/AlbumNfoSaver.cs +++ b/MediaBrowser.XbmcMetadata/Savers/AlbumNfoSaver.cs @@ -57,10 +57,9 @@ namespace MediaBrowser.XbmcMetadata.Savers private static readonly CultureInfo UsCulture = new CultureInfo("en-US"); - private void AddTracks(IEnumerable<Audio> tracks, XmlWriter writer) + private void AddTracks(IEnumerable<BaseItem> tracks, XmlWriter writer) { - foreach (var track in tracks.OrderBy(i => i.ParentIndexNumber ?? 0) - .ThenBy(i => i.IndexNumber ?? 0)) + foreach (var track in tracks.OrderBy(i => i.ParentIndexNumber ?? 0).ThenBy(i => i.IndexNumber ?? 0)) { writer.WriteStartElement("track"); diff --git a/MediaBrowser.XbmcMetadata/Savers/ArtistNfoSaver.cs b/MediaBrowser.XbmcMetadata/Savers/ArtistNfoSaver.cs index 413738ade..a7f4e56a6 100644 --- a/MediaBrowser.XbmcMetadata/Savers/ArtistNfoSaver.cs +++ b/MediaBrowser.XbmcMetadata/Savers/ArtistNfoSaver.cs @@ -7,7 +7,6 @@ using MediaBrowser.XbmcMetadata.Configuration; using System.Collections.Generic; using System.Globalization; using System.IO; -using System.Linq; using System.Xml; using MediaBrowser.Controller.IO; @@ -50,16 +49,14 @@ namespace MediaBrowser.XbmcMetadata.Savers } var albums = artist - .GetRecursiveChildren(i => i is MusicAlbum) - .Cast<MusicAlbum>() - .ToList(); + .GetRecursiveChildren(i => i is MusicAlbum); AddAlbums(albums, writer); } private static readonly CultureInfo UsCulture = new CultureInfo("en-US"); - private void AddAlbums(IEnumerable<MusicAlbum> albums, XmlWriter writer) + private void AddAlbums(IList<BaseItem> albums, XmlWriter writer) { foreach (var album in albums) { diff --git a/MediaBrowser.XbmcMetadata/Savers/MovieNfoSaver.cs b/MediaBrowser.XbmcMetadata/Savers/MovieNfoSaver.cs index 70fb4e5fa..1989a2c28 100644 --- a/MediaBrowser.XbmcMetadata/Savers/MovieNfoSaver.cs +++ b/MediaBrowser.XbmcMetadata/Savers/MovieNfoSaver.cs @@ -8,7 +8,6 @@ using MediaBrowser.Model.Entities; using MediaBrowser.Model.Logging; using System.Collections.Generic; using System.IO; -using System.Linq; using System.Xml; using MediaBrowser.Controller.IO; @@ -21,7 +20,8 @@ namespace MediaBrowser.XbmcMetadata.Savers { protected override string GetLocalSavePath(IHasMetadata item) { - return GetMovieSavePaths(new ItemInfo(item), FileSystem).FirstOrDefault(); + var paths = GetMovieSavePaths(new ItemInfo(item), FileSystem); + return paths.Count == 0 ? null : paths[0]; } public static List<string> GetMovieSavePaths(ItemInfo item, IFileSystem fileSystem) diff --git a/Mono.Nat/NatUtility.cs b/Mono.Nat/NatUtility.cs index c1983658d..b9efd9bbd 100644 --- a/Mono.Nat/NatUtility.cs +++ b/Mono.Nat/NatUtility.cs @@ -30,7 +30,6 @@ using System; using System.Net; using System.Net.Sockets; using System.Threading; -using System.Linq; using System.Collections.Generic; using System.IO; using System.Net.NetworkInformation; diff --git a/Mono.Nat/Pmp/Searchers/PmpSearcher.cs b/Mono.Nat/Pmp/Searchers/PmpSearcher.cs index 4a8a90412..def50fb72 100644 --- a/Mono.Nat/Pmp/Searchers/PmpSearcher.cs +++ b/Mono.Nat/Pmp/Searchers/PmpSearcher.cs @@ -36,7 +36,6 @@ using System.Net; using Mono.Nat.Pmp; using System.Net.NetworkInformation; using System.Net.Sockets; -using System.Linq; using System.Threading.Tasks; namespace Mono.Nat diff --git a/Mono.Nat/Upnp/Upnp.cs b/Mono.Nat/Upnp/Upnp.cs index 38d949250..e9321f874 100644 --- a/Mono.Nat/Upnp/Upnp.cs +++ b/Mono.Nat/Upnp/Upnp.cs @@ -30,7 +30,6 @@ using System; using System.Collections.Generic; -using System.Linq; using System.Net; using System.Text; using System.Threading.Tasks; diff --git a/Nuget/MediaBrowser.Common.nuspec b/Nuget/MediaBrowser.Common.nuspec index eb8a55b4c..4044eaea1 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.740</version> + <version>3.0.741</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.nuspec index 5c16159c7..6f43586cd 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.740</version> + <version>3.0.741</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.740" /> + <dependency id="MediaBrowser.Common" version="3.0.741" /> </dependencies> </metadata> <files> diff --git a/RSSDP/CustomHttpHeaders.cs b/RSSDP/CustomHttpHeaders.cs index 9250d612f..f2412d2e7 100644 --- a/RSSDP/CustomHttpHeaders.cs +++ b/RSSDP/CustomHttpHeaders.cs @@ -1,7 +1,6 @@ using System; using System.Collections; using System.Collections.Generic; -using System.Linq; using System.Text; namespace Rssdp diff --git a/RSSDP/DeviceAvailableEventArgs.cs b/RSSDP/DeviceAvailableEventArgs.cs index 046c10524..d80b4b65b 100644 --- a/RSSDP/DeviceAvailableEventArgs.cs +++ b/RSSDP/DeviceAvailableEventArgs.cs @@ -1,6 +1,5 @@ using System; using System.Collections.Generic; -using System.Linq; using System.Text; using System.Threading.Tasks; using MediaBrowser.Model.Net; diff --git a/RSSDP/DeviceEventArgs.cs b/RSSDP/DeviceEventArgs.cs index e0c19c4c4..774d812ee 100644 --- a/RSSDP/DeviceEventArgs.cs +++ b/RSSDP/DeviceEventArgs.cs @@ -1,6 +1,5 @@ using System; using System.Collections.Generic; -using System.Linq; using System.Text; namespace Rssdp diff --git a/RSSDP/DeviceUnavailableEventArgs.cs b/RSSDP/DeviceUnavailableEventArgs.cs index 5b7c1437a..171a834a0 100644 --- a/RSSDP/DeviceUnavailableEventArgs.cs +++ b/RSSDP/DeviceUnavailableEventArgs.cs @@ -1,6 +1,5 @@ using System; using System.Collections.Generic; -using System.Linq; using System.Text; using System.Threading.Tasks; diff --git a/RSSDP/DiscoveredSsdpDevice.cs b/RSSDP/DiscoveredSsdpDevice.cs index 58f0acfa5..54701890c 100644 --- a/RSSDP/DiscoveredSsdpDevice.cs +++ b/RSSDP/DiscoveredSsdpDevice.cs @@ -1,6 +1,5 @@ using System; using System.Collections.Generic; -using System.Linq; using System.Net.Http; using System.Text; using System.Threading.Tasks; diff --git a/RSSDP/DisposableManagedObjectBase.cs b/RSSDP/DisposableManagedObjectBase.cs index 87f2aa71c..1288ba721 100644 --- a/RSSDP/DisposableManagedObjectBase.cs +++ b/RSSDP/DisposableManagedObjectBase.cs @@ -1,6 +1,5 @@ using System; using System.Collections.Generic; -using System.Linq; using System.Text; using System.Threading.Tasks; diff --git a/RSSDP/IUPnPDeviceValidator.cs b/RSSDP/IUPnPDeviceValidator.cs index 39b80742e..8fa48df7b 100644 --- a/RSSDP/IUPnPDeviceValidator.cs +++ b/RSSDP/IUPnPDeviceValidator.cs @@ -11,13 +11,13 @@ namespace Rssdp.Infrastructure /// Returns an enumerable set of strings, each one being a description of an invalid property on the specified root device. /// </summary> /// <param name="device">The <see cref="SsdpRootDevice"/> to validate.</param> - System.Collections.Generic.IEnumerable<string> GetValidationErrors(SsdpRootDevice device); + System.Collections.Generic.List<string> GetValidationErrors(SsdpRootDevice device); /// <summary> /// Returns an enumerable set of strings, each one being a description of an invalid property on the specified device. /// </summary> /// <param name="device">The <see cref="SsdpDevice"/> to validate.</param> - System.Collections.Generic.IEnumerable<string> GetValidationErrors(SsdpDevice device); + System.Collections.Generic.List<string> GetValidationErrors(SsdpDevice device); /// <summary> /// Validates the specified device and throws an <see cref="System.InvalidOperationException"/> if there are any validation errors. diff --git a/RSSDP/RequestReceivedEventArgs.cs b/RSSDP/RequestReceivedEventArgs.cs index 03c059634..f4e367760 100644 --- a/RSSDP/RequestReceivedEventArgs.cs +++ b/RSSDP/RequestReceivedEventArgs.cs @@ -1,6 +1,5 @@ using System; using System.Collections.Generic; -using System.Linq; using System.Net; using System.Net.Http; using System.Text; diff --git a/RSSDP/ResponseReceivedEventArgs.cs b/RSSDP/ResponseReceivedEventArgs.cs index c983fa204..f67d5da90 100644 --- a/RSSDP/ResponseReceivedEventArgs.cs +++ b/RSSDP/ResponseReceivedEventArgs.cs @@ -1,6 +1,5 @@ using System; using System.Collections.Generic; -using System.Linq; using System.Net; using System.Net.Http; using System.Text; diff --git a/RSSDP/SsdpCommunicationsServer.cs b/RSSDP/SsdpCommunicationsServer.cs index 91004b76f..a4be24ebf 100644 --- a/RSSDP/SsdpCommunicationsServer.cs +++ b/RSSDP/SsdpCommunicationsServer.cs @@ -364,7 +364,7 @@ namespace Rssdp.Infrastructure if (_enableMultiSocketBinding) { - foreach (var address in _networkManager.GetLocalIpAddresses().ToList()) + foreach (var address in _networkManager.GetLocalIpAddresses()) { try { diff --git a/RSSDP/SsdpConstants.cs b/RSSDP/SsdpConstants.cs index c839d9e0b..87f01f9e0 100644 --- a/RSSDP/SsdpConstants.cs +++ b/RSSDP/SsdpConstants.cs @@ -1,6 +1,5 @@ using System; using System.Collections.Generic; -using System.Linq; using System.Text; using System.Threading.Tasks; diff --git a/RSSDP/SsdpDevice.cs b/RSSDP/SsdpDevice.cs index a595742d0..cda11f0a4 100644 --- a/RSSDP/SsdpDevice.cs +++ b/RSSDP/SsdpDevice.cs @@ -1,7 +1,6 @@ using System; using System.Collections.Generic; using System.Collections.ObjectModel; -using System.Linq; using System.Text; using System.Threading.Tasks; using System.Xml; @@ -283,7 +282,7 @@ namespace Rssdp /// </summary> /// <seealso cref="AddDevice"/> /// <seealso cref="RemoveDevice"/> - public IEnumerable<SsdpDevice> Devices + public IList<SsdpDevice> Devices { get; private set; @@ -466,7 +465,7 @@ namespace Rssdp private static void WriteIcons(XmlWriter writer, SsdpDevice device) { - if (device.Icons.Any()) + if (device.Icons.Count > 0) { writer.WriteStartElement("iconList"); @@ -489,7 +488,7 @@ namespace Rssdp private void WriteChildDevices(XmlWriter writer, SsdpDevice parentDevice) { - if (parentDevice.Devices.Any()) + if (parentDevice.Devices.Count > 0) { writer.WriteStartElement("deviceList"); diff --git a/RSSDP/SsdpDeviceExtensions.cs b/RSSDP/SsdpDeviceExtensions.cs index 0ad710a6b..6e1b45646 100644 --- a/RSSDP/SsdpDeviceExtensions.cs +++ b/RSSDP/SsdpDeviceExtensions.cs @@ -1,6 +1,5 @@ using System; using System.Collections.Generic; -using System.Linq; using System.Text; namespace Rssdp diff --git a/RSSDP/SsdpDeviceIcon.cs b/RSSDP/SsdpDeviceIcon.cs index 4ffda58ff..3ed707c80 100644 --- a/RSSDP/SsdpDeviceIcon.cs +++ b/RSSDP/SsdpDeviceIcon.cs @@ -1,6 +1,5 @@ using System; using System.Collections.Generic; -using System.Linq; using System.Text; using System.Threading.Tasks; diff --git a/RSSDP/SsdpDeviceLocator.cs b/RSSDP/SsdpDeviceLocator.cs index 3ea17237d..8fe4d4a14 100644 --- a/RSSDP/SsdpDeviceLocator.cs +++ b/RSSDP/SsdpDeviceLocator.cs @@ -1,6 +1,5 @@ using System; using System.Collections.Generic; -using System.Linq; using System.Text; using MediaBrowser.Model.Net; using MediaBrowser.Model.Threading; diff --git a/RSSDP/SsdpDeviceLocatorBase.cs b/RSSDP/SsdpDeviceLocatorBase.cs index 1adb95cdf..d1eaef88a 100644 --- a/RSSDP/SsdpDeviceLocatorBase.cs +++ b/RSSDP/SsdpDeviceLocatorBase.cs @@ -127,7 +127,7 @@ namespace Rssdp.Infrastructure } catch (Exception ex) { - + } } @@ -543,17 +543,9 @@ namespace Rssdp.Infrastructure } } - private IEnumerable<DiscoveredSsdpDevice> GetUnexpiredDevices() - { - lock (_Devices) - { - return (from device in _Devices where !device.IsExpired() select device).ToArray(); - } - } - private bool DeviceDied(string deviceUsn, bool expired) { - IEnumerable<DiscoveredSsdpDevice> existingDevices = null; + List<DiscoveredSsdpDevice> existingDevices = null; lock (_Devices) { existingDevices = FindExistingDeviceNotifications(_Devices, deviceUsn); @@ -565,7 +557,7 @@ namespace Rssdp.Infrastructure } } - if (existingDevices != null && existingDevices.Any()) + if (existingDevices != null && existingDevices.Count > 0) { foreach (var removedDevice in existingDevices) { @@ -591,12 +583,29 @@ namespace Rssdp.Infrastructure private static DiscoveredSsdpDevice FindExistingDeviceNotification(IEnumerable<DiscoveredSsdpDevice> devices, string notificationType, string usn) { - return (from d in devices where d.NotificationType == notificationType && d.Usn == usn select d).FirstOrDefault(); + foreach (var d in devices) + { + if (d.NotificationType == notificationType && d.Usn == usn) + { + return d; + } + } + return null; } - private static IEnumerable<DiscoveredSsdpDevice> FindExistingDeviceNotifications(IList<DiscoveredSsdpDevice> devices, string usn) + private static List<DiscoveredSsdpDevice> FindExistingDeviceNotifications(IList<DiscoveredSsdpDevice> devices, string usn) { - return (from d in devices where d.Usn == usn select d).ToArray(); + var list = new List<DiscoveredSsdpDevice>(); + + foreach (var d in devices) + { + if (d.Usn == usn) + { + list.Add(d); + } + } + + return list; } #endregion diff --git a/RSSDP/SsdpDeviceProperties.cs b/RSSDP/SsdpDeviceProperties.cs index 850dfb0ba..ae5309da5 100644 --- a/RSSDP/SsdpDeviceProperties.cs +++ b/RSSDP/SsdpDeviceProperties.cs @@ -1,6 +1,5 @@ using System; using System.Collections.Generic; -using System.Linq; using System.Text; namespace Rssdp diff --git a/RSSDP/SsdpDeviceProperty.cs b/RSSDP/SsdpDeviceProperty.cs index 3a8dd2ec7..3abcfb9aa 100644 --- a/RSSDP/SsdpDeviceProperty.cs +++ b/RSSDP/SsdpDeviceProperty.cs @@ -1,6 +1,5 @@ using System; using System.Collections.Generic; -using System.Linq; using System.Text; using System.Threading.Tasks; diff --git a/RSSDP/SsdpDevicePublisher.cs b/RSSDP/SsdpDevicePublisher.cs index 1c17c7837..2aa143775 100644 --- a/RSSDP/SsdpDevicePublisher.cs +++ b/RSSDP/SsdpDevicePublisher.cs @@ -1,6 +1,5 @@ using System; using System.Collections.Generic; -using System.Linq; using System.Text; using MediaBrowser.Model.Net; using MediaBrowser.Model.Threading; diff --git a/RSSDP/SsdpEmbeddedDevice.cs b/RSSDP/SsdpEmbeddedDevice.cs index c03106b2d..28948f950 100644 --- a/RSSDP/SsdpEmbeddedDevice.cs +++ b/RSSDP/SsdpEmbeddedDevice.cs @@ -1,6 +1,5 @@ using System; using System.Collections.Generic; -using System.Linq; using System.Text; namespace Rssdp diff --git a/RSSDP/SsdpRootDevice.cs b/RSSDP/SsdpRootDevice.cs index faf851bcb..5b7d0f454 100644 --- a/RSSDP/SsdpRootDevice.cs +++ b/RSSDP/SsdpRootDevice.cs @@ -1,6 +1,5 @@ using System; using System.Collections.Generic; -using System.Linq; using System.Text; using System.Xml; using Rssdp.Infrastructure; diff --git a/RSSDP/UPnP10DeviceValidator.cs b/RSSDP/UPnP10DeviceValidator.cs index f802b7639..2a8a9ccd2 100644 --- a/RSSDP/UPnP10DeviceValidator.cs +++ b/RSSDP/UPnP10DeviceValidator.cs @@ -26,11 +26,11 @@ namespace Rssdp.Infrastructure /// <param name="device">The <see cref="SsdpRootDevice"/> to validate.</param> /// <exception cref="System.ArgumentNullException">Thrown if the <paramref name="device"/> argument is null.</exception> /// <returns>A non-null enumerable set of strings, empty if there are no validation errors, otherwise each string represents a discrete problem.</returns> - public IEnumerable<string> GetValidationErrors(SsdpRootDevice device) + public List<string> GetValidationErrors(SsdpRootDevice device) { if (device == null) throw new ArgumentNullException("device"); - var retVal = GetValidationErrors((SsdpDevice)device) as IList<string>; + var retVal = GetValidationErrors((SsdpDevice)device); if (device.Location == null) retVal.Add("Location cannot be null."); @@ -49,7 +49,7 @@ namespace Rssdp.Infrastructure /// <param name="device">The <see cref="SsdpDevice"/> to validate.</param> /// <exception cref="System.ArgumentNullException">Thrown if the <paramref name="device"/> argument is null.</exception> /// <returns>A non-null enumerable set of strings, empty if there are no validation errors, otherwise each string represents a discrete problem.</returns> - public IEnumerable<string> GetValidationErrors(SsdpDevice device) + public List<string> GetValidationErrors(SsdpDevice device) { if (device == null) throw new ArgumentNullException("device"); @@ -110,7 +110,7 @@ namespace Rssdp.Infrastructure if (String.IsNullOrEmpty(device.ModelName)) retVal.Add("ModelName is required."); - if (device.Icons.Any()) + if (device.Icons.Count > 0) ValidateIcons(device, retVal); ValidateChildDevices(device, retVal); @@ -127,7 +127,7 @@ namespace Rssdp.Infrastructure public void ThrowIfDeviceInvalid(SsdpDevice device) { var errors = this.GetValidationErrors(device); - if (errors != null && errors.Any()) throw new InvalidOperationException("Invalid device settings : " + String.Join(Environment.NewLine, errors)); + if (errors != null && errors.Count > 0) throw new InvalidOperationException("Invalid device settings : " + String.Join(Environment.NewLine, errors)); } #endregion diff --git a/SocketHttpListener/Net/BoundaryType.cs b/SocketHttpListener/Net/BoundaryType.cs index c3ac00c0f..f1e799f63 100644 --- a/SocketHttpListener/Net/BoundaryType.cs +++ b/SocketHttpListener/Net/BoundaryType.cs @@ -1,6 +1,5 @@ using System; using System.Collections.Generic; -using System.Linq; using System.Text; using System.Threading.Tasks; diff --git a/SocketHttpListener/Net/CookieHelper.cs b/SocketHttpListener/Net/CookieHelper.cs index 470507d6b..a32131956 100644 --- a/SocketHttpListener/Net/CookieHelper.cs +++ b/SocketHttpListener/Net/CookieHelper.cs @@ -1,7 +1,6 @@ using System; using System.Collections.Generic; using System.Globalization; -using System.Linq; using System.Net; using System.Text; using System.Threading.Tasks; diff --git a/SocketHttpListener/Net/EndPointManager.cs b/SocketHttpListener/Net/EndPointManager.cs index 6a00ed360..ddb110ec1 100644 --- a/SocketHttpListener/Net/EndPointManager.cs +++ b/SocketHttpListener/Net/EndPointManager.cs @@ -1,7 +1,6 @@ using System; using System.Collections; using System.Collections.Generic; -using System.Linq; using System.Net; using System.Reflection; using System.Threading.Tasks; @@ -83,7 +82,9 @@ namespace SocketHttpListener.Net { try { - addr = (await networkManager.GetHostAddressesAsync(host).ConfigureAwait(false)).FirstOrDefault() ?? + var all = (await networkManager.GetHostAddressesAsync(host).ConfigureAwait(false)); + + addr = (all.Length == 0 ? null : all[0]) ?? GetIpAnyAddress(listener); } catch diff --git a/SocketHttpListener/Net/EntitySendFormat.cs b/SocketHttpListener/Net/EntitySendFormat.cs index 6e585bdc9..9caee3e11 100644 --- a/SocketHttpListener/Net/EntitySendFormat.cs +++ b/SocketHttpListener/Net/EntitySendFormat.cs @@ -1,6 +1,5 @@ using System; using System.Collections.Generic; -using System.Linq; using System.Text; using System.Threading.Tasks; diff --git a/SocketHttpListener/Net/HttpListenerResponse.Managed.cs b/SocketHttpListener/Net/HttpListenerResponse.Managed.cs index 83fcc09ca..34953b569 100644 --- a/SocketHttpListener/Net/HttpListenerResponse.Managed.cs +++ b/SocketHttpListener/Net/HttpListenerResponse.Managed.cs @@ -2,7 +2,6 @@ using System.Collections.Generic; using System.Globalization; using System.IO; -using System.Linq; using System.Net; using System.Text; using System.Threading.Tasks; diff --git a/SocketHttpListener/Net/HttpListenerResponse.cs b/SocketHttpListener/Net/HttpListenerResponse.cs index fc57e8485..1cbd6165e 100644 --- a/SocketHttpListener/Net/HttpListenerResponse.cs +++ b/SocketHttpListener/Net/HttpListenerResponse.cs @@ -1,7 +1,6 @@ using System; using System.Collections.Generic; using System.IO; -using System.Linq; using System.Net; using System.Text; using System.Threading.Tasks; diff --git a/SocketHttpListener/Net/HttpRequestStream.Managed.cs b/SocketHttpListener/Net/HttpRequestStream.Managed.cs index 92f4bbb02..c9c148b15 100644 --- a/SocketHttpListener/Net/HttpRequestStream.Managed.cs +++ b/SocketHttpListener/Net/HttpRequestStream.Managed.cs @@ -1,7 +1,6 @@ using System; using System.Collections.Generic; using System.IO; -using System.Linq; using System.Runtime.ExceptionServices; using System.Text; using System.Threading.Tasks; diff --git a/SocketHttpListener/Net/HttpRequestStream.cs b/SocketHttpListener/Net/HttpRequestStream.cs index c54da44a1..f10c04a4f 100644 --- a/SocketHttpListener/Net/HttpRequestStream.cs +++ b/SocketHttpListener/Net/HttpRequestStream.cs @@ -1,7 +1,6 @@ using System; using System.Collections.Generic; using System.IO; -using System.Linq; using System.Text; using System.Threading; using System.Threading.Tasks; diff --git a/SocketHttpListener/Net/HttpResponseStream.Managed.cs b/SocketHttpListener/Net/HttpResponseStream.Managed.cs index 116c3280a..b700c293d 100644 --- a/SocketHttpListener/Net/HttpResponseStream.Managed.cs +++ b/SocketHttpListener/Net/HttpResponseStream.Managed.cs @@ -1,7 +1,6 @@ using System; using System.Collections.Generic; using System.IO; -using System.Linq; using System.Net; using System.Net.Sockets; using System.Runtime.ExceptionServices; diff --git a/SocketHttpListener/Net/HttpResponseStream.cs b/SocketHttpListener/Net/HttpResponseStream.cs index f7140be66..5b7fa417f 100644 --- a/SocketHttpListener/Net/HttpResponseStream.cs +++ b/SocketHttpListener/Net/HttpResponseStream.cs @@ -1,7 +1,6 @@ using System; using System.Collections.Generic; using System.IO; -using System.Linq; using System.Text; using System.Threading; using System.Threading.Tasks; diff --git a/SocketHttpListener/Net/HttpStatusDescription.cs b/SocketHttpListener/Net/HttpStatusDescription.cs index 8d490c511..9cc4a8e8c 100644 --- a/SocketHttpListener/Net/HttpStatusDescription.cs +++ b/SocketHttpListener/Net/HttpStatusDescription.cs @@ -1,6 +1,5 @@ using System; using System.Collections.Generic; -using System.Linq; using System.Text; using System.Threading.Tasks; diff --git a/SocketHttpListener/Net/UriScheme.cs b/SocketHttpListener/Net/UriScheme.cs index eb13619c9..35b01e0e5 100644 --- a/SocketHttpListener/Net/UriScheme.cs +++ b/SocketHttpListener/Net/UriScheme.cs @@ -1,6 +1,5 @@ using System; using System.Collections.Generic; -using System.Linq; using System.Text; using System.Threading.Tasks; diff --git a/SocketHttpListener/Net/WebHeaderCollection.cs b/SocketHttpListener/Net/WebHeaderCollection.cs index 66e159ccb..d82dc6816 100644 --- a/SocketHttpListener/Net/WebHeaderCollection.cs +++ b/SocketHttpListener/Net/WebHeaderCollection.cs @@ -131,13 +131,13 @@ namespace SocketHttpListener.Net base.Add(headerName, headerValue); } - internal string[] GetValues_internal(string header, bool split) + internal List<string> GetValues_internal(string header, bool split) { if (header == null) throw new ArgumentNullException("header"); - string[] values = base.GetValues(header); - if (values == null || values.Length == 0) + var values = base.GetValues(header); + if (values == null || values.Count == 0) return null; if (split && IsMultiValue(header)) @@ -155,7 +155,7 @@ namespace SocketHttpListener.Net if (separated == null) { - separated = new List<string>(values.Length + 1); + separated = new List<string>(values.Count + 1); foreach (var v in values) { if (v == value) @@ -177,13 +177,13 @@ namespace SocketHttpListener.Net } if (separated != null) - return separated.ToArray(separated.Count); + return separated; } return values; } - public override string[] GetValues(string header) + public override List<string> GetValues(string header) { return GetValues_internal(header, true); } diff --git a/SocketHttpListener/Net/WebHeaderEncoding.cs b/SocketHttpListener/Net/WebHeaderEncoding.cs index 64330c1b4..4a080179e 100644 --- a/SocketHttpListener/Net/WebHeaderEncoding.cs +++ b/SocketHttpListener/Net/WebHeaderEncoding.cs @@ -1,6 +1,5 @@ using System; using System.Collections.Generic; -using System.Linq; using System.Text; using System.Threading.Tasks; diff --git a/SocketHttpListener/Primitives/ICertificate.cs b/SocketHttpListener/Primitives/ICertificate.cs index 1289da13d..ec21e9445 100644 --- a/SocketHttpListener/Primitives/ICertificate.cs +++ b/SocketHttpListener/Primitives/ICertificate.cs @@ -1,6 +1,5 @@ using System; using System.Collections.Generic; -using System.Linq; using System.Text; using System.Threading.Tasks; diff --git a/SocketHttpListener/Primitives/IStreamFactory.cs b/SocketHttpListener/Primitives/IStreamFactory.cs index 57e21e31b..4b623b940 100644 --- a/SocketHttpListener/Primitives/IStreamFactory.cs +++ b/SocketHttpListener/Primitives/IStreamFactory.cs @@ -1,7 +1,6 @@ using System; using System.Collections.Generic; using System.IO; -using System.Linq; using System.Text; using System.Threading.Tasks; using MediaBrowser.Model.Net; diff --git a/SocketHttpListener/Primitives/ITextEncoding.cs b/SocketHttpListener/Primitives/ITextEncoding.cs index b10145687..2c25a308c 100644 --- a/SocketHttpListener/Primitives/ITextEncoding.cs +++ b/SocketHttpListener/Primitives/ITextEncoding.cs @@ -1,6 +1,5 @@ using System; using System.Collections.Generic; -using System.Linq; using System.Text; using System.Threading.Tasks; using MediaBrowser.Model.Text; |
