aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLukePulverenti Luke Pulverenti luke pulverenti <LukePulverenti Luke Pulverenti luke.pulverenti@gmail.com>2012-08-01 13:20:22 -0400
committerLukePulverenti Luke Pulverenti luke pulverenti <LukePulverenti Luke Pulverenti luke.pulverenti@gmail.com>2012-08-01 13:20:22 -0400
commit00c22a34546ee426cc7097953eb6b1c3443f946b (patch)
tree82b2d466f98cec9436148f05a6f29ab98d40ae83
parenta7bead51b2d3f84c0665e9559ca2d024b973c9e4 (diff)
Added ParentLogoItemId to indicate what parent item has a logo
-rw-r--r--MediaBrowser.Api/ApiService.cs27
-rw-r--r--MediaBrowser.Model/Entities/ApiBaseItem.cs7
2 files changed, 32 insertions, 2 deletions
diff --git a/MediaBrowser.Api/ApiService.cs b/MediaBrowser.Api/ApiService.cs
index 34f7e69e7..bb2427574 100644
--- a/MediaBrowser.Api/ApiService.cs
+++ b/MediaBrowser.Api/ApiService.cs
@@ -31,9 +31,14 @@ namespace MediaBrowser.Api
UserItemData = Kernel.Instance.GetUserItemData(userId, item.Id),
Type = item.GetType().Name,
IsFolder = (item is Folder),
- ParentId = item.Parent == null ? Guid.Empty : item.Parent.Id
+ ParentLogoItemId = GetParentLogoItemId(item)
};
+ if (item.Parent != null)
+ {
+ wrapper.ParentId = item.Parent.Id;
+ }
+
if (includeChildren)
{
var folder = item as Folder;
@@ -46,5 +51,25 @@ namespace MediaBrowser.Api
return wrapper;
}
+
+ private static Guid? GetParentLogoItemId(BaseItem item)
+ {
+ if (string.IsNullOrEmpty(item.LogoImagePath))
+ {
+ var parent = item.Parent;
+
+ while (parent != null)
+ {
+ if (!string.IsNullOrEmpty(parent.LogoImagePath))
+ {
+ return parent.Id;
+ }
+
+ parent = parent.Parent;
+ }
+ }
+
+ return null;
+ }
}
}
diff --git a/MediaBrowser.Model/Entities/ApiBaseItem.cs b/MediaBrowser.Model/Entities/ApiBaseItem.cs
index 341b1c77f..0ec9ed7c6 100644
--- a/MediaBrowser.Model/Entities/ApiBaseItem.cs
+++ b/MediaBrowser.Model/Entities/ApiBaseItem.cs
@@ -26,7 +26,7 @@ namespace MediaBrowser.Model.Entities
public bool IsFolder { get; set; }
- public Guid ParentId { get; set; }
+ public Guid? ParentId { get; set; }
public string Type { get; set; }
@@ -39,5 +39,10 @@ namespace MediaBrowser.Model.Entities
{
return Type.Equals(type, StringComparison.OrdinalIgnoreCase);
}
+
+ /// <summary>
+ /// If the item does not have a logo, this will hold the Id of the Parent that has one.
+ /// </summary>
+ public Guid? ParentLogoItemId { get; set; }
}
}