diff options
| author | Luke Pulverenti <luke.pulverenti@gmail.com> | 2016-04-16 15:28:00 -0400 |
|---|---|---|
| committer | Luke Pulverenti <luke.pulverenti@gmail.com> | 2016-04-16 15:28:00 -0400 |
| commit | f3f3da0d8be8b7e6c956982b525283ae4b86876e (patch) | |
| tree | b49edf8c7291886f46569437349e1075b30c66f5 /MediaBrowser.Controller/Entities/BaseItem.cs | |
| parent | b0839ffd2c10cb7a8ec0837f897db61ddd3a7c01 (diff) | |
| parent | 18dbdb194b6db75c1acb5457e9797d8b37150c07 (diff) | |
Merge branch 'master' of https://github.com/MediaBrowser/Emby
Diffstat (limited to 'MediaBrowser.Controller/Entities/BaseItem.cs')
| -rw-r--r-- | MediaBrowser.Controller/Entities/BaseItem.cs | 69 |
1 files changed, 59 insertions, 10 deletions
diff --git a/MediaBrowser.Controller/Entities/BaseItem.cs b/MediaBrowser.Controller/Entities/BaseItem.cs index a85ab621de..04371c13b6 100644 --- a/MediaBrowser.Controller/Entities/BaseItem.cs +++ b/MediaBrowser.Controller/Entities/BaseItem.cs @@ -255,6 +255,11 @@ namespace MediaBrowser.Controller.Entities if (string.IsNullOrWhiteSpace(Path)) { + if (SourceType == SourceType.Channel) + { + return LocationType.Remote; + } + return LocationType.Virtual; } @@ -301,13 +306,13 @@ namespace MediaBrowser.Controller.Entities } } - private List<Tuple<StringBuilder,bool>> GetSortChunks(string s1) + private List<Tuple<StringBuilder, bool>> GetSortChunks(string s1) { var list = new List<Tuple<StringBuilder, bool>>(); int thisMarker = 0, thisNumericChunk = 0; - while ((thisMarker < s1.Length)) + while (thisMarker < s1.Length) { if (thisMarker >= s1.Length) { @@ -407,6 +412,9 @@ namespace MediaBrowser.Controller.Entities [IgnoreDataMember] public DateTime DateLastRefreshed { get; set; } + [IgnoreDataMember] + public DateTime? DateModifiedDuringLastRefresh { get; set; } + /// <summary> /// The logger /// </summary> @@ -494,7 +502,19 @@ namespace MediaBrowser.Controller.Entities { get { - return _sortName ?? (_sortName = CreateSortName()); + if (_sortName == null) + { + if (!string.IsNullOrWhiteSpace(ForcedSortName)) + { + // Need the ToLower because that's what CreateSortName does + _sortName = ModifySortChunks(ForcedSortName).ToLower(); + } + else + { + _sortName = CreateSortName(); + } + } + return _sortName; } set { @@ -529,11 +549,6 @@ namespace MediaBrowser.Controller.Entities /// <returns>System.String.</returns> protected virtual string CreateSortName() { - if (!string.IsNullOrWhiteSpace(ForcedSortName)) - { - return ModifySortChunks(ForcedSortName).ToLower(); - } - if (Name == null) return null; //some items may not have name filled in properly if (!EnableAlphaNumericSorting) @@ -653,9 +668,30 @@ namespace MediaBrowser.Controller.Entities } [IgnoreDataMember] - public virtual BaseItem DisplayParent + public virtual Guid? DisplayParentId { - get { return GetParent(); } + get + { + if (ParentId == Guid.Empty) + { + return null; + } + return ParentId; + } + } + + [IgnoreDataMember] + public BaseItem DisplayParent + { + get + { + var id = DisplayParentId; + if (!id.HasValue || id.Value == Guid.Empty) + { + return null; + } + return LibraryManager.GetItemById(id.Value); + } } /// <summary> @@ -1312,6 +1348,19 @@ namespace MediaBrowser.Controller.Entities return LocalizationManager.GetRatingLevel(rating); } + public List<string> GetInheritedTags() + { + var list = new List<string>(); + list.AddRange(Tags); + + foreach (var parent in GetParents()) + { + list.AddRange(parent.Tags); + } + + return list.Distinct(StringComparer.OrdinalIgnoreCase).ToList(); + } + private bool IsVisibleViaTags(User user) { var hasTags = this as IHasTags; |
