From d06b78d9398330b98828d752d7fe49232ffdb3d0 Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Tue, 12 Jan 2016 15:03:06 -0500 Subject: [PATCH] fix merge conflict --- MediaBrowser.Controller/Entities/BaseItem.cs | 259 ++++++------------- 1 file changed, 77 insertions(+), 182 deletions(-) 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.Runtime.Serialization; using System.Threading; using System.Threading.Tasks; using CommonIO; -using MediaBrowser.Model.LiveTv; namespace MediaBrowser.Controller.Entities { @@ -34,7 +34,6 @@ namespace MediaBrowser.Controller.Entities { protected BaseItem() { - Tags = new List(); Genres = new List(); Studios = new List(); ProviderIds = new Dictionary(StringComparer.OrdinalIgnoreCase); @@ -45,7 +44,7 @@ namespace MediaBrowser.Controller.Entities /// /// 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 @@ namespace MediaBrowser.Controller.Entities /// Gets or sets the name. /// /// The name. - [IgnoreDataMember] - public virtual string Name + public string Name { get { @@ -124,23 +122,14 @@ namespace MediaBrowser.Controller.Entities /// 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 @@ namespace MediaBrowser.Controller.Entities /// Gets or sets the path. /// /// The path. - [IgnoreDataMember] public virtual string Path { get; set; } [IgnoreDataMember] @@ -185,7 +173,7 @@ namespace MediaBrowser.Controller.Entities } /// - /// 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 @@ namespace MediaBrowser.Controller.Entities } } + public virtual bool IsHiddenFromUser(User user) + { + return false; + } + [IgnoreDataMember] public virtual bool IsOwnedItem { @@ -332,14 +325,12 @@ namespace MediaBrowser.Controller.Entities /// 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 @@ namespace MediaBrowser.Controller.Entities /// 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 @@ namespace MediaBrowser.Controller.Entities { 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 @@ namespace MediaBrowser.Controller.Entities return sortable; } - [IgnoreDataMember] public Guid ParentId { get; set; } /// @@ -510,7 +502,15 @@ namespace MediaBrowser.Controller.Entities [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 @@ namespace MediaBrowser.Controller.Entities [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 @@ namespace MediaBrowser.Controller.Entities 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 @@ namespace MediaBrowser.Controller.Entities /// 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 @@ namespace MediaBrowser.Controller.Entities /// 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 @@ namespace MediaBrowser.Controller.Entities /// 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 @@ namespace MediaBrowser.Controller.Entities 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 @@ namespace MediaBrowser.Controller.Entities return LibraryManager.ResolvePaths(files, directoryService, null) .OfType