diff --git a/Emby.Drawing/ImageMagick/ImageMagickEncoder.cs b/Emby.Drawing/ImageMagick/ImageMagickEncoder.cs index 12a98edffa..6858c6d520 100644 --- a/Emby.Drawing/ImageMagick/ImageMagickEncoder.cs +++ b/Emby.Drawing/ImageMagick/ImageMagickEncoder.cs @@ -181,7 +181,9 @@ public void EncodeImage(string inputPath, string outputPath, int width, int heig private void ScaleImage(MagickWand wand, int width, int height) { - if (_config.Configuration.EnableHighQualityImageScaling) + var highQuality = false; + + if (highQuality) { wand.CurrentImage.ResizeImage(width, height); } diff --git a/MediaBrowser.Controller/Entities/BaseItem.cs b/MediaBrowser.Controller/Entities/BaseItem.cs index 379697b816..59e2b87e3a 100644 --- a/MediaBrowser.Controller/Entities/BaseItem.cs +++ b/MediaBrowser.Controller/Entities/BaseItem.cs @@ -1,4 +1,5 @@ using MediaBrowser.Common.Extensions; +using MediaBrowser.Common.IO; using MediaBrowser.Controller.Channels; using MediaBrowser.Controller.Collections; using MediaBrowser.Controller.Configuration; @@ -23,7 +24,6 @@ using System.Threading; using System.Threading.Tasks; using CommonIO; -using MediaBrowser.Model.LiveTv; namespace MediaBrowser.Controller.Entities { @@ -34,7 +34,6 @@ public abstract class BaseItem : IHasProviderIds, ILibraryItem, IHasImages, IHas { protected BaseItem() { - Tags = new List(); Genres = new List(); Studios = new List(); ProviderIds = new Dictionary(StringComparer.OrdinalIgnoreCase); @@ -45,7 +44,7 @@ protected BaseItem() /// /// The supported image extensions /// - public static readonly string[] SupportedImageExtensions = { ".png", ".jpg", ".jpeg", ".tbn", ".gif" }; + public static readonly string[] SupportedImageExtensions = { ".png", ".jpg", ".jpeg" }; public static readonly List SupportedImageExtensionsList = SupportedImageExtensions.ToList(); @@ -104,8 +103,7 @@ public virtual bool SupportsRemoteImageDownloading /// Gets or sets the name. /// /// The name. - [IgnoreDataMember] - public virtual string Name + public string Name { get { @@ -124,23 +122,14 @@ public virtual string Name /// Gets or sets the id. /// /// The id. - [IgnoreDataMember] public Guid Id { get; set; } /// /// Gets or sets a value indicating whether this instance is hd. /// /// true if this instance is hd; otherwise, false. - [IgnoreDataMember] public bool? IsHD { get; set; } - /// - /// Gets or sets the audio. - /// - /// The audio. - [IgnoreDataMember] - public ProgramAudio? Audio { get; set; } - /// /// Return the id that should be used to key display prefs for this item. /// Default is based on the type for everything except actual generic folders. @@ -160,7 +149,6 @@ public virtual Guid DisplayPreferencesId /// Gets or sets the path. /// /// The path. - [IgnoreDataMember] public virtual string Path { get; set; } [IgnoreDataMember] @@ -185,7 +173,7 @@ public virtual string ContainingFolderPath } /// - /// If this content came from an external service, the id of the content on that service + /// Id of the program. /// [IgnoreDataMember] public string ExternalId @@ -213,6 +201,11 @@ public virtual bool IsHidden } } + public virtual bool IsHiddenFromUser(User user) + { + return false; + } + [IgnoreDataMember] public virtual bool IsOwnedItem { @@ -332,14 +325,12 @@ public bool CanDownload(User user) /// Gets or sets the date created. /// /// The date created. - [IgnoreDataMember] public DateTime DateCreated { get; set; } /// /// Gets or sets the date modified. /// /// The date modified. - [IgnoreDataMember] public DateTime DateModified { get; set; } public DateTime DateLastSaved { get; set; } @@ -416,7 +407,6 @@ public virtual IEnumerable PhysicalLocations /// Gets or sets the name of the forced sort. /// /// The name of the forced sort. - [IgnoreDataMember] public string ForcedSortName { get { return _forcedSortName; } @@ -457,7 +447,10 @@ protected virtual string GetInternalMetadataPath(string basePath) { var idString = Id.ToString("N"); - basePath = System.IO.Path.Combine(basePath, "library"); + if (ConfigurationManager.Configuration.EnableLibraryMetadataSubFolder) + { + basePath = System.IO.Path.Combine(basePath, "library"); + } return System.IO.Path.Combine(basePath, idString.Substring(0, 2), idString); } @@ -500,7 +493,6 @@ protected virtual string CreateSortName() return sortable; } - [IgnoreDataMember] public Guid ParentId { get; set; } /// @@ -510,7 +502,15 @@ protected virtual string CreateSortName() [IgnoreDataMember] public Folder Parent { - get { return GetParent() as Folder; } + get + { + if (ParentId != Guid.Empty) + { + return LibraryManager.GetItemById(ParentId) as Folder; + } + + return null; + } set { @@ -525,28 +525,16 @@ public void SetParent(Folder parent) [IgnoreDataMember] public IEnumerable Parents { - get { return GetParents().OfType(); } - } - - public BaseItem GetParent() - { - if (ParentId != Guid.Empty) + get { - return LibraryManager.GetItemById(ParentId); - } - - return null; - } - - public IEnumerable GetParents() - { - var parent = GetParent(); + var parent = Parent; - while (parent != null) - { - yield return parent; + while (parent != null) + { + yield return parent; - parent = parent.GetParent(); + parent = parent.Parent; + } } } @@ -558,20 +546,19 @@ public IEnumerable GetParents() public T FindParent() where T : Folder { - return GetParents().OfType().FirstOrDefault(); + return Parents.OfType().FirstOrDefault(); } [IgnoreDataMember] public virtual BaseItem DisplayParent { - get { return GetParent(); } + get { return Parent; } } /// /// When the item first debuted. For movies this could be premiere date, episodes would be first aired /// /// The premiere date. - [IgnoreDataMember] public DateTime? PremiereDate { get; set; } /// @@ -585,35 +572,31 @@ public virtual BaseItem DisplayParent /// Gets or sets the display type of the media. /// /// The display type of the media. - [IgnoreDataMember] public string DisplayMediaType { get; set; } /// /// Gets or sets the official rating. /// /// The official rating. - [IgnoreDataMember] public string OfficialRating { get; set; } /// /// Gets or sets the official rating description. /// /// The official rating description. - [IgnoreDataMember] public string OfficialRatingDescription { get; set; } /// /// Gets or sets the custom rating. /// /// The custom rating. - [IgnoreDataMember] + //[IgnoreDataMember] public string CustomRating { get; set; } /// /// Gets or sets the overview. /// /// The overview. - [IgnoreDataMember] public string Overview { get; set; } /// @@ -626,48 +609,37 @@ public virtual BaseItem DisplayParent /// Gets or sets the genres. /// /// The genres. - [IgnoreDataMember] public List Genres { get; set; } - /// - /// Gets or sets the tags. - /// - /// The tags. - public List Tags { get; set; } - /// /// Gets or sets the home page URL. /// /// The home page URL. - [IgnoreDataMember] public string HomePageUrl { get; set; } /// /// Gets or sets the community rating. /// /// The community rating. - [IgnoreDataMember] + //[IgnoreDataMember] public float? CommunityRating { get; set; } /// /// Gets or sets the community rating vote count. /// /// The community rating vote count. - [IgnoreDataMember] public int? VoteCount { get; set; } /// /// Gets or sets the run time ticks. /// /// The run time ticks. - [IgnoreDataMember] public long? RunTimeTicks { get; set; } /// /// Gets or sets the production year. /// /// The production year. - [IgnoreDataMember] public int? ProductionYear { get; set; } /// @@ -675,34 +647,19 @@ public virtual BaseItem DisplayParent /// This could be episode number, album track number, etc. /// /// The index number. - [IgnoreDataMember] + //[IgnoreDataMember] public int? IndexNumber { get; set; } /// /// For an episode this could be the season number, or for a song this could be the disc number. /// /// The parent index number. - [IgnoreDataMember] public int? ParentIndexNumber { get; set; } [IgnoreDataMember] - public string OfficialRatingForComparison + public virtual string OfficialRatingForComparison { - get - { - if (!string.IsNullOrWhiteSpace(OfficialRating)) - { - return OfficialRating; - } - - var parent = DisplayParent; - if (parent != null) - { - return parent.OfficialRatingForComparison; - } - - return null; - } + get { return OfficialRating; } } [IgnoreDataMember] @@ -764,21 +721,21 @@ private IEnumerable LoadThemeSongs(List fileSys return LibraryManager.ResolvePaths(files, directoryService, null) .OfType() .Select(audio => - { - // Try to retrieve it from the db. If we don't find it, use the resolved version - var dbItem = LibraryManager.GetItemById(audio.Id) as Audio.Audio; + { + // Try to retrieve it from the db. If we don't find it, use the resolved version + var dbItem = LibraryManager.GetItemById(audio.Id) as Audio.Audio; - if (dbItem != null) - { - audio = dbItem; - } + if (dbItem != null) + { + audio = dbItem; + } - audio.ExtraType = ExtraType.ThemeSong; + audio.ExtraType = ExtraType.ThemeSong; - return audio; + return audio; - // Sort them so that the list can be easily compared for changes - }).OrderBy(i => i.Path).ToList(); + // Sort them so that the list can be easily compared for changes + }).OrderBy(i => i.Path).ToList(); } /// @@ -794,21 +751,21 @@ private IEnumerable