Cleanup/simplification

* Removed useless copies/allocations
* Reduced unneeded complexity
This commit is contained in:
Bond-009 2019-03-07 15:54:30 +01:00
parent 10a0d6bdba
commit c5fce647de
19 changed files with 127 additions and 157 deletions

View File

@ -36,7 +36,7 @@ namespace Emby.Server.Implementations.Collections
return base.Supports(item);
}
protected override List<BaseItem> GetItemsWithImages(BaseItem item)
protected override IReadOnlyList<BaseItem> GetItemsWithImages(BaseItem item)
{
var playlist = (BoxSet)item;
@ -80,7 +80,7 @@ namespace Emby.Server.Implementations.Collections
.ToList();
}
protected override string CreateImage(BaseItem item, List<BaseItem> itemsWithImages, string outputPathWithoutExtension, ImageType imageType, int imageIndex)
protected override string CreateImage(BaseItem item, IReadOnlyCollection<BaseItem> itemsWithImages, string outputPathWithoutExtension, ImageType imageType, int imageIndex)
{
return CreateSingleImage(itemsWithImages, outputPathWithoutExtension, ImageType.Primary);
}

View File

@ -7,7 +7,6 @@ using System.Text;
using MediaBrowser.Common.Configuration;
using MediaBrowser.Model.IO;
using MediaBrowser.Model.System;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.Logging;
namespace Emby.Server.Implementations.IO
@ -711,20 +710,20 @@ namespace Emby.Server.Implementations.IO
return GetFiles(path, null, false, recursive);
}
public virtual IEnumerable<FileSystemMetadata> GetFiles(string path, string[] extensions, bool enableCaseSensitiveExtensions, bool recursive = false)
public virtual IEnumerable<FileSystemMetadata> GetFiles(string path, IReadOnlyList<string> extensions, bool enableCaseSensitiveExtensions, bool recursive = false)
{
var searchOption = recursive ? SearchOption.AllDirectories : SearchOption.TopDirectoryOnly;
// On linux and osx the search pattern is case sensitive
// If we're OK with case-sensitivity, and we're only filtering for one extension, then use the native method
if ((enableCaseSensitiveExtensions || _isEnvironmentCaseInsensitive) && extensions != null && extensions.Length == 1)
if ((enableCaseSensitiveExtensions || _isEnvironmentCaseInsensitive) && extensions != null && extensions.Count == 1)
{
return ToMetadata(new DirectoryInfo(path).EnumerateFiles("*" + extensions[0], searchOption));
}
var files = new DirectoryInfo(path).EnumerateFiles("*", searchOption);
if (extensions != null && extensions.Length > 0)
if (extensions != null && extensions.Count > 0)
{
files = files.Where(i =>
{

View File

@ -20,6 +20,9 @@ namespace Emby.Server.Implementations.Images
public abstract class BaseDynamicImageProvider<T> : IHasItemChangeMonitor, IForcedProvider, ICustomMetadataProvider<T>, IHasOrder
where T : BaseItem
{
protected virtual IReadOnlyCollection<ImageType> SupportedImages { get; }
= new ImageType[] { ImageType.Primary };
protected IFileSystem FileSystem { get; private set; }
protected IProviderManager ProviderManager { get; private set; }
protected IApplicationPaths ApplicationPaths { get; private set; }
@ -33,18 +36,7 @@ namespace Emby.Server.Implementations.Images
ImageProcessor = imageProcessor;
}
protected virtual bool Supports(BaseItem item)
{
return true;
}
public virtual ImageType[] GetSupportedImages(BaseItem item)
{
return new ImageType[]
{
ImageType.Primary
};
}
protected virtual bool Supports(BaseItem _) => true;
public async Task<ItemUpdateType> FetchAsync(T item, MetadataRefreshOptions options, CancellationToken cancellationToken)
{
@ -54,15 +46,14 @@ namespace Emby.Server.Implementations.Images
}
var updateType = ItemUpdateType.None;
var supportedImages = GetSupportedImages(item);
if (supportedImages.Contains(ImageType.Primary))
if (SupportedImages.Contains(ImageType.Primary))
{
var primaryResult = await FetchAsync(item, ImageType.Primary, options, cancellationToken).ConfigureAwait(false);
updateType = updateType | primaryResult;
}
if (supportedImages.Contains(ImageType.Thumb))
if (SupportedImages.Contains(ImageType.Thumb))
{
var thumbResult = await FetchAsync(item, ImageType.Thumb, options, cancellationToken).ConfigureAwait(false);
updateType = updateType | thumbResult;
@ -94,7 +85,7 @@ namespace Emby.Server.Implementations.Images
}
protected async Task<ItemUpdateType> FetchToFileInternal(BaseItem item,
List<BaseItem> itemsWithImages,
IReadOnlyList<BaseItem> itemsWithImages,
ImageType imageType,
CancellationToken cancellationToken)
{
@ -119,9 +110,9 @@ namespace Emby.Server.Implementations.Images
return ItemUpdateType.ImageUpdate;
}
protected abstract List<BaseItem> GetItemsWithImages(BaseItem item);
protected abstract IReadOnlyList<BaseItem> GetItemsWithImages(BaseItem item);
protected string CreateThumbCollage(BaseItem primaryItem, List<BaseItem> items, string outputPath)
protected string CreateThumbCollage(BaseItem primaryItem, IEnumerable<BaseItem> items, string outputPath)
{
return CreateCollage(primaryItem, items, outputPath, 640, 360);
}
@ -132,38 +123,38 @@ namespace Emby.Server.Implementations.Images
.Select(i =>
{
var image = i.GetImageInfo(ImageType.Primary, 0);
if (image != null && image.IsLocalFile)
{
return image.Path;
}
image = i.GetImageInfo(ImageType.Thumb, 0);
if (image != null && image.IsLocalFile)
{
return image.Path;
}
return null;
})
.Where(i => !string.IsNullOrEmpty(i));
}
protected string CreatePosterCollage(BaseItem primaryItem, List<BaseItem> items, string outputPath)
protected string CreatePosterCollage(BaseItem primaryItem, IEnumerable<BaseItem> items, string outputPath)
{
return CreateCollage(primaryItem, items, outputPath, 400, 600);
}
protected string CreateSquareCollage(BaseItem primaryItem, List<BaseItem> items, string outputPath)
protected string CreateSquareCollage(BaseItem primaryItem, IEnumerable<BaseItem> items, string outputPath)
{
return CreateCollage(primaryItem, items, outputPath, 600, 600);
}
protected string CreateThumbCollage(BaseItem primaryItem, List<BaseItem> items, string outputPath, int width, int height)
protected string CreateThumbCollage(BaseItem primaryItem, IEnumerable<BaseItem> items, string outputPath, int width, int height)
{
return CreateCollage(primaryItem, items, outputPath, width, height);
}
private string CreateCollage(BaseItem primaryItem, List<BaseItem> items, string outputPath, int width, int height)
private string CreateCollage(BaseItem primaryItem, IEnumerable<BaseItem> items, string outputPath, int width, int height)
{
Directory.CreateDirectory(Path.GetDirectoryName(outputPath));
@ -192,7 +183,7 @@ namespace Emby.Server.Implementations.Images
public string Name => "Dynamic Image Provider";
protected virtual string CreateImage(BaseItem item,
List<BaseItem> itemsWithImages,
IReadOnlyCollection<BaseItem> itemsWithImages,
string outputPathWithoutExtension,
ImageType imageType,
int imageIndex)
@ -211,18 +202,15 @@ namespace Emby.Server.Implementations.Images
if (imageType == ImageType.Primary)
{
if (item is UserView)
{
return CreateSquareCollage(item, itemsWithImages, outputPath);
}
if (item is Playlist || item is MusicGenre || item is Genre || item is PhotoAlbum)
if (item is UserView || item is Playlist || item is MusicGenre || item is Genre || item is PhotoAlbum)
{
return CreateSquareCollage(item, itemsWithImages, outputPath);
}
return CreatePosterCollage(item, itemsWithImages, outputPath);
}
throw new ArgumentException("Unexpected image type");
throw new ArgumentException("Unexpected image type", nameof(imageType));
}
protected virtual int MaxImageAgeDays => 7;
@ -234,13 +222,11 @@ namespace Emby.Server.Implementations.Images
return false;
}
var supportedImages = GetSupportedImages(item);
if (supportedImages.Contains(ImageType.Primary) && HasChanged(item, ImageType.Primary))
if (SupportedImages.Contains(ImageType.Primary) && HasChanged(item, ImageType.Primary))
{
return true;
}
if (supportedImages.Contains(ImageType.Thumb) && HasChanged(item, ImageType.Thumb))
if (SupportedImages.Contains(ImageType.Thumb) && HasChanged(item, ImageType.Thumb))
{
return true;
}
@ -285,7 +271,7 @@ namespace Emby.Server.Implementations.Images
public int Order => 0;
protected string CreateSingleImage(List<BaseItem> itemsWithImages, string outputPathWithoutExtension, ImageType imageType)
protected string CreateSingleImage(IEnumerable<BaseItem> itemsWithImages, string outputPathWithoutExtension, ImageType imageType)
{
var image = itemsWithImages
.Where(i => i.HasImage(imageType) && i.GetImageInfo(imageType, 0).IsLocalFile && Path.HasExtension(i.GetImagePath(imageType)))

View File

@ -24,7 +24,7 @@ namespace Emby.Server.Implementations.Playlists
{
}
protected override List<BaseItem> GetItemsWithImages(BaseItem item)
protected override IReadOnlyList<BaseItem> GetItemsWithImages(BaseItem item)
{
var playlist = (Playlist)item;
@ -78,7 +78,7 @@ namespace Emby.Server.Implementations.Playlists
_libraryManager = libraryManager;
}
protected override List<BaseItem> GetItemsWithImages(BaseItem item)
protected override IReadOnlyList<BaseItem> GetItemsWithImages(BaseItem item)
{
return _libraryManager.GetItemList(new InternalItemsQuery
{
@ -89,7 +89,6 @@ namespace Emby.Server.Implementations.Playlists
Recursive = true,
ImageTypes = new[] { ImageType.Primary },
DtoOptions = new DtoOptions(false)
});
}
}
@ -103,7 +102,7 @@ namespace Emby.Server.Implementations.Playlists
_libraryManager = libraryManager;
}
protected override List<BaseItem> GetItemsWithImages(BaseItem item)
protected override IReadOnlyList<BaseItem> GetItemsWithImages(BaseItem item)
{
return _libraryManager.GetItemList(new InternalItemsQuery
{
@ -116,11 +115,5 @@ namespace Emby.Server.Implementations.Playlists
DtoOptions = new DtoOptions(false)
});
}
//protected override Task<string> CreateImage(IHasMetadata item, List<BaseItem> itemsWithImages, string outputPathWithoutExtension, ImageType imageType, int imageIndex)
//{
// return CreateSingleImage(itemsWithImages, outputPathWithoutExtension, ImageType.Primary);
//}
}
}

View File

@ -79,7 +79,7 @@ namespace Emby.Server.Implementations.SocketSharp
byte[] copy = new byte[e.Length];
input.Position = e.Start;
input.Read(copy, 0, (int)e.Length);
await input.ReadAsync(copy, 0, (int)e.Length).ConfigureAwait(false);
form.Add(e.Name, (e.Encoding ?? ContentEncoding).GetString(copy, 0, copy.Length));
}
@ -98,11 +98,11 @@ namespace Emby.Server.Implementations.SocketSharp
var form = new WebROCollection();
files = new Dictionary<string, HttpPostedFile>();
if (IsContentType("multipart/form-data", true))
if (IsContentType("multipart/form-data"))
{
await LoadMultiPart(form).ConfigureAwait(false);
}
else if (IsContentType("application/x-www-form-urlencoded", true))
else if (IsContentType("application/x-www-form-urlencoded"))
{
await LoadWwwForm(form).ConfigureAwait(false);
}
@ -200,21 +200,16 @@ namespace Emby.Server.Implementations.SocketSharp
return false;
}
private bool IsContentType(string ct, bool starts_with)
private bool IsContentType(string ct)
{
if (ct == null || ContentType == null)
if (ContentType == null)
{
return false;
}
if (starts_with)
{
return ContentType.StartsWith(ct, StringComparison.OrdinalIgnoreCase);
}
return string.Equals(ContentType, ct, StringComparison.OrdinalIgnoreCase);
}
private async Task LoadWwwForm(WebROCollection form)
{
using (var input = InputStream)

View File

@ -4,7 +4,6 @@ using System.Globalization;
using System.IO;
using System.Net;
using System.Text;
using Emby.Server.Implementations.HttpServer;
using MediaBrowser.Model.Services;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Http.Extensions;
@ -405,8 +404,7 @@ namespace Emby.Server.Implementations.SocketSharp
return null;
}
var path = sbPathInfo.ToString();
return path.Length > 1 ? path.TrimEnd('/') : "/";
return sbPathInfo.Length > 1 ? sbPathInfo.ToString().TrimEnd('/') : "/";
}
public string UserAgent => request.Headers[HeaderNames.UserAgent];

View File

@ -1,7 +1,6 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using Emby.Server.Implementations.Images;
using MediaBrowser.Common.Configuration;
using MediaBrowser.Controller.Drawing;
@ -20,7 +19,7 @@ namespace Emby.Server.Implementations.UserViews
{
}
protected override List<BaseItem> GetItemsWithImages(BaseItem item)
protected override IReadOnlyList<BaseItem> GetItemsWithImages(BaseItem item)
{
var view = (CollectionFolder)item;
var viewType = view.CollectionType;
@ -56,7 +55,7 @@ namespace Emby.Server.Implementations.UserViews
includeItemTypes = new string[] { "Video", "Audio", "Photo", "Movie", "Series" };
}
var recursive = !new[] { CollectionType.Playlists }.Contains(view.CollectionType ?? string.Empty, StringComparer.OrdinalIgnoreCase);
var recursive = !string.Equals(CollectionType.Playlists, viewType, StringComparison.OrdinalIgnoreCase);
return view.GetItemList(new InternalItemsQuery
{
@ -71,7 +70,7 @@ namespace Emby.Server.Implementations.UserViews
},
IncludeItemTypes = includeItemTypes
}).ToList();
});
}
protected override bool Supports(BaseItem item)
@ -79,7 +78,7 @@ namespace Emby.Server.Implementations.UserViews
return item is CollectionFolder;
}
protected override string CreateImage(BaseItem item, List<BaseItem> itemsWithImages, string outputPathWithoutExtension, ImageType imageType, int imageIndex)
protected override string CreateImage(BaseItem item, IReadOnlyCollection<BaseItem> itemsWithImages, string outputPathWithoutExtension, ImageType imageType, int imageIndex)
{
var outputPath = Path.ChangeExtension(outputPathWithoutExtension, ".png");

View File

@ -28,7 +28,7 @@ namespace Emby.Server.Implementations.UserViews
_libraryManager = libraryManager;
}
protected override List<BaseItem> GetItemsWithImages(BaseItem item)
protected override IReadOnlyList<BaseItem> GetItemsWithImages(BaseItem item)
{
var view = (UserView)item;
@ -46,8 +46,7 @@ namespace Emby.Server.Implementations.UserViews
var items = result.Select(i =>
{
var episode = i as Episode;
if (episode != null)
if (i is Episode episode)
{
var series = episode.Series;
if (series != null)
@ -58,8 +57,7 @@ namespace Emby.Server.Implementations.UserViews
return episode;
}
var season = i as Season;
if (season != null)
if (i is Season season)
{
var series = season.Series;
if (series != null)
@ -70,8 +68,7 @@ namespace Emby.Server.Implementations.UserViews
return season;
}
var audio = i as Audio;
if (audio != null)
if (i is Audio audio)
{
var album = audio.AlbumEntity;
if (album != null && album.HasImage(ImageType.Primary))
@ -122,7 +119,7 @@ namespace Emby.Server.Implementations.UserViews
return collectionStripViewTypes.Contains(view.ViewType ?? string.Empty);
}
protected override string CreateImage(BaseItem item, List<BaseItem> itemsWithImages, string outputPathWithoutExtension, ImageType imageType, int imageIndex)
protected override string CreateImage(BaseItem item, IReadOnlyCollection<BaseItem> itemsWithImages, string outputPathWithoutExtension, ImageType imageType, int imageIndex)
{
if (itemsWithImages.Count == 0)
{

View File

@ -24,7 +24,7 @@ namespace Emby.Server.Implementations.UserViews
_libraryManager = libraryManager;
}
protected override List<BaseItem> GetItemsWithImages(BaseItem item)
protected override IReadOnlyList<BaseItem> GetItemsWithImages(BaseItem item)
{
return _libraryManager.GetItemList(new InternalItemsQuery
{
@ -40,7 +40,7 @@ namespace Emby.Server.Implementations.UserViews
});
}
protected override string CreateImage(BaseItem item, List<BaseItem> itemsWithImages, string outputPathWithoutExtension, ImageType imageType, int imageIndex)
protected override string CreateImage(BaseItem item, IReadOnlyCollection<BaseItem> itemsWithImages, string outputPathWithoutExtension, ImageType imageType, int imageIndex)
{
return CreateSingleImage(itemsWithImages, outputPathWithoutExtension, ImageType.Primary);
}

View File

@ -311,8 +311,6 @@ namespace MediaBrowser.Api.Images
}
private ImageInfo GetImageInfo(BaseItem item, ItemImageInfo info, int? imageIndex)
{
try
{
int? width = null;
int? height = null;
@ -334,13 +332,15 @@ namespace MediaBrowser.Api.Images
width = null;
height = null;
}
}
}
catch
catch (Exception ex)
{
Logger.LogError(ex, "Error getting image information for {Item}", item.Name);
}
try
{
return new ImageInfo
{
Path = info.Path,
@ -354,7 +354,7 @@ namespace MediaBrowser.Api.Images
}
catch (Exception ex)
{
Logger.LogError(ex, "Error getting image information for {path}", info.Path);
Logger.LogError(ex, "Error getting image information for {Path}", info.Path);
return null;
}
@ -519,17 +519,17 @@ namespace MediaBrowser.Api.Images
request.AddPlayedIndicator = true;
}
}
if (request.PercentPlayed.HasValue)
{
request.UnplayedCount = null;
}
if (request.UnplayedCount.HasValue)
{
if (request.UnplayedCount.Value <= 0)
if (request.UnplayedCount.HasValue
&& request.UnplayedCount.Value <= 0)
{
request.UnplayedCount = null;
}
}
if (item == null)
{
@ -542,7 +542,6 @@ namespace MediaBrowser.Api.Images
}
var imageInfo = GetImageInfo(request, item);
if (imageInfo == null)
{
var displayText = item == null ? itemId.ToString() : item.Name;
@ -550,7 +549,6 @@ namespace MediaBrowser.Api.Images
}
IImageEnhancer[] supportedImageEnhancers;
if (_imageProcessor.ImageEnhancers.Length > 0)
{
if (item == null)
@ -565,13 +563,15 @@ namespace MediaBrowser.Api.Images
supportedImageEnhancers = Array.Empty<IImageEnhancer>();
}
var cropwhitespace = request.Type == ImageType.Logo ||
request.Type == ImageType.Art;
bool cropwhitespace;
if (request.CropWhitespace.HasValue)
{
cropwhitespace = request.CropWhitespace.Value;
}
else
{
cropwhitespace = request.Type == ImageType.Logo || request.Type == ImageType.Art;
}
var outputFormats = GetOutputFormats(request);
@ -653,21 +653,30 @@ namespace MediaBrowser.Api.Images
private ImageFormat[] GetOutputFormats(ImageRequest request)
{
if (!string.IsNullOrWhiteSpace(request.Format))
{
if (Enum.TryParse(request.Format, true, out ImageFormat format))
if (!string.IsNullOrWhiteSpace(request.Format)
&& Enum.TryParse(request.Format, true, out ImageFormat format))
{
return new ImageFormat[] { format };
}
}
return GetClientSupportedFormats();
}
private ImageFormat[] GetClientSupportedFormats()
{
//logger.LogDebug("Request types: {0}", string.Join(",", Request.AcceptTypes ?? Array.Empty<string>()));
var supportedFormats = (Request.AcceptTypes ?? Array.Empty<string>()).Select(i => i.Split(';')[0]).ToArray();
var supportedFormats = Request.AcceptTypes ?? Array.Empty<string>();
if (supportedFormats.Length > 0)
{
for (int i = 0; i < supportedFormats.Length; i++)
{
int index = supportedFormats[i].IndexOf(';');
if (index != -1)
{
supportedFormats[i] = supportedFormats[i].Substring(0, index);
}
}
}
var acceptParam = Request.QueryString["accept"];
var supportsWebP = SupportsFormat(supportedFormats, acceptParam, "webp", false);
@ -700,7 +709,7 @@ namespace MediaBrowser.Api.Images
return formats.ToArray();
}
private bool SupportsFormat(string[] requestAcceptTypes, string acceptParam, string format, bool acceptAll)
private bool SupportsFormat(IEnumerable<string> requestAcceptTypes, string acceptParam, string format, bool acceptAll)
{
var mimeType = "image/" + format;

View File

@ -36,10 +36,20 @@ namespace MediaBrowser.Controller.Entities
/// </summary>
public abstract class BaseItem : IHasProviderIds, IHasLookupInfo<ItemLookupInfo>
{
protected static MetadataFields[] EmptyMetadataFieldsArray = Array.Empty<MetadataFields>();
protected static MediaUrl[] EmptyMediaUrlArray = Array.Empty<MediaUrl>();
protected static ItemImageInfo[] EmptyItemImageInfoArray = Array.Empty<ItemImageInfo>();
public static readonly LinkedChild[] EmptyLinkedChildArray = Array.Empty<LinkedChild>();
private static readonly List<string> _supportedExtensions = new List<string>(SupportedImageExtensions)
{
".nfo",
".xml",
".srt",
".vtt",
".sub",
".idx",
".txt",
".edl",
".bif",
".smi",
".ttml"
};
protected BaseItem()
{
@ -49,8 +59,8 @@ namespace MediaBrowser.Controller.Entities
Genres = Array.Empty<string>();
Studios = Array.Empty<string>();
ProviderIds = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase);
LockedFields = EmptyMetadataFieldsArray;
ImageInfos = EmptyItemImageInfoArray;
LockedFields = Array.Empty<MetadataFields>();
ImageInfos = Array.Empty<ItemImageInfo>();
ProductionLocations = Array.Empty<string>();
RemoteTrailers = Array.Empty<MediaUrl>();
ExtraIds = Array.Empty<Guid>();
@ -2452,10 +2462,8 @@ namespace MediaBrowser.Controller.Entities
}
var filename = System.IO.Path.GetFileNameWithoutExtension(Path);
var extensions = new List<string> { ".nfo", ".xml", ".srt", ".vtt", ".sub", ".idx", ".txt", ".edl", ".bif", ".smi", ".ttml" };
extensions.AddRange(SupportedImageExtensions);
return FileSystem.GetFiles(System.IO.Path.GetDirectoryName(Path), extensions.ToArray(), false, false)
return FileSystem.GetFiles(System.IO.Path.GetDirectoryName(Path), _supportedExtensions, false, false)
.Where(i => System.IO.Path.GetFileNameWithoutExtension(i.FullName).StartsWith(filename, StringComparison.OrdinalIgnoreCase))
.ToList();
}

View File

@ -43,7 +43,7 @@ namespace MediaBrowser.Controller.Entities
public Folder()
{
LinkedChildren = EmptyLinkedChildArray;
LinkedChildren = Array.Empty<LinkedChild>();
}
[IgnoreDataMember]

View File

@ -25,22 +25,10 @@ namespace MediaBrowser.Controller.Entities
public DateTime DateModified { get; set; }
public int Width { get; set; }
public int Height { get; set; }
[IgnoreDataMember]
public bool IsLocalFile
{
get
{
if (Path != null)
{
if (Path.StartsWith("http", StringComparison.OrdinalIgnoreCase))
{
return false;
}
}
return true;
}
}
public bool IsLocalFile => Path == null || !Path.StartsWith("http", StringComparison.OrdinalIgnoreCase);
}
}

View File

@ -17,7 +17,7 @@ namespace MediaBrowser.Controller.Entities.Movies
{
public BoxSet()
{
RemoteTrailers = EmptyMediaUrlArray;
RemoteTrailers = Array.Empty<MediaUrl>();
LocalTrailerIds = Array.Empty<Guid>();
RemoteTrailerIds = Array.Empty<Guid>();

View File

@ -21,10 +21,10 @@ namespace MediaBrowser.Controller.Entities.Movies
public Movie()
{
SpecialFeatureIds = new Guid[] { };
RemoteTrailers = EmptyMediaUrlArray;
LocalTrailerIds = new Guid[] { };
RemoteTrailerIds = new Guid[] { };
SpecialFeatureIds = Array.Empty<Guid>();
RemoteTrailers = Array.Empty<MediaUrl>();
LocalTrailerIds = Array.Empty<Guid>();
RemoteTrailerIds = Array.Empty<Guid>();
}
public Guid[] LocalTrailerIds { get; set; }

View File

@ -18,7 +18,7 @@ namespace MediaBrowser.Controller.Entities.TV
{
public Episode()
{
RemoteTrailers = EmptyMediaUrlArray;
RemoteTrailers = Array.Empty<MediaUrl>();
LocalTrailerIds = Array.Empty<Guid>();
RemoteTrailerIds = Array.Empty<Guid>();
}

View File

@ -7,7 +7,6 @@ using MediaBrowser.Controller.Dto;
using MediaBrowser.Controller.Providers;
using MediaBrowser.Model.Configuration;
using MediaBrowser.Model.Entities;
using MediaBrowser.Model.Extensions;
using MediaBrowser.Model.Providers;
using MediaBrowser.Model.Querying;
using MediaBrowser.Model.Serialization;
@ -22,7 +21,7 @@ namespace MediaBrowser.Controller.Entities.TV
{
public Series()
{
RemoteTrailers = EmptyMediaUrlArray;
RemoteTrailers = Array.Empty<MediaUrl>();
LocalTrailerIds = Array.Empty<Guid>();
RemoteTrailerIds = Array.Empty<Guid>();
AirDays = Array.Empty<DayOfWeek>();

View File

@ -167,7 +167,7 @@ namespace MediaBrowser.Controller.Entities
AdditionalParts = Array.Empty<string>();
LocalAlternateVersions = Array.Empty<string>();
SubtitleFiles = Array.Empty<string>();
LinkedAlternateVersions = EmptyLinkedChildArray;
LinkedAlternateVersions = Array.Empty<LinkedChild>();
}
public override bool CanDownload()

View File

@ -1,7 +1,6 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Text;
namespace MediaBrowser.Model.IO
{
@ -177,7 +176,7 @@ namespace MediaBrowser.Model.IO
/// </summary>
IEnumerable<FileSystemMetadata> GetFiles(string path, bool recursive = false);
IEnumerable<FileSystemMetadata> GetFiles(string path, string[] extensions, bool enableCaseSensitiveExtensions, bool recursive);
IEnumerable<FileSystemMetadata> GetFiles(string path, IReadOnlyList<string> extensions, bool enableCaseSensitiveExtensions, bool recursive);
/// <summary>
/// Gets the file system entries.