diff options
Diffstat (limited to 'MediaBrowser.Api/ApiService.cs')
| -rw-r--r-- | MediaBrowser.Api/ApiService.cs | 52 |
1 files changed, 40 insertions, 12 deletions
diff --git a/MediaBrowser.Api/ApiService.cs b/MediaBrowser.Api/ApiService.cs index bb2427574..382d236ae 100644 --- a/MediaBrowser.Api/ApiService.cs +++ b/MediaBrowser.Api/ApiService.cs @@ -30,10 +30,21 @@ namespace MediaBrowser.Api Item = item,
UserItemData = Kernel.Instance.GetUserItemData(userId, item.Id),
Type = item.GetType().Name,
- IsFolder = (item is Folder),
- ParentLogoItemId = GetParentLogoItemId(item)
+ IsFolder = (item is Folder)
};
+ if (string.IsNullOrEmpty(item.LogoImagePath))
+ {
+ wrapper.ParentLogoItemId = GetParentLogoItemId(item);
+ }
+
+ if (item.BackdropImagePaths == null || !item.BackdropImagePaths.Any())
+ {
+ int backdropCount;
+ wrapper.ParentBackdropItemId = GetParentBackdropItemId(item, out backdropCount);
+ wrapper.ParentBackdropCount = backdropCount;
+ }
+
if (item.Parent != null)
{
wrapper.ParentId = item.Parent.Id;
@@ -52,21 +63,38 @@ namespace MediaBrowser.Api return wrapper;
}
- private static Guid? GetParentLogoItemId(BaseItem item)
+ private static Guid? GetParentBackdropItemId(BaseItem item, out int backdropCount)
{
- if (string.IsNullOrEmpty(item.LogoImagePath))
- {
- var parent = item.Parent;
+ backdropCount = 0;
+
+ var parent = item.Parent;
- while (parent != null)
+ while (parent != null)
+ {
+ if (parent.BackdropImagePaths != null && parent.BackdropImagePaths.Any())
{
- if (!string.IsNullOrEmpty(parent.LogoImagePath))
- {
- return parent.Id;
- }
+ backdropCount = parent.BackdropImagePaths.Count();
+ return parent.Id;
+ }
+
+ parent = parent.Parent;
+ }
+
+ return null;
+ }
- parent = parent.Parent;
+ private static Guid? GetParentLogoItemId(BaseItem item)
+ {
+ var parent = item.Parent;
+
+ while (parent != null)
+ {
+ if (!string.IsNullOrEmpty(parent.LogoImagePath))
+ {
+ return parent.Id;
}
+
+ parent = parent.Parent;
}
return null;
|
