aboutsummaryrefslogtreecommitdiff
path: root/MediaBrowser.Api/LibraryService.cs
diff options
context:
space:
mode:
authorLuke Pulverenti <luke.pulverenti@gmail.com>2013-12-05 11:50:21 -0500
committerLuke Pulverenti <luke.pulverenti@gmail.com>2013-12-05 11:50:21 -0500
commit55a776427b97bec48a70a4b4f403b52935b620ea (patch)
tree5fc0e1feaee36df2116a4842d3eb9d27c491bbae /MediaBrowser.Api/LibraryService.cs
parent9e84a712ae3da9eada815e790160a17153b76d37 (diff)
Removed unused properties from BaseItem.
Diffstat (limited to 'MediaBrowser.Api/LibraryService.cs')
-rw-r--r--MediaBrowser.Api/LibraryService.cs40
1 files changed, 32 insertions, 8 deletions
diff --git a/MediaBrowser.Api/LibraryService.cs b/MediaBrowser.Api/LibraryService.cs
index cf62e42ba..51eef225e 100644
--- a/MediaBrowser.Api/LibraryService.cs
+++ b/MediaBrowser.Api/LibraryService.cs
@@ -588,7 +588,7 @@ namespace MediaBrowser.Api
var originalItem = item;
- while (item.ThemeSongIds.Count == 0 && request.InheritFromParent && item.Parent != null)
+ while (GetThemeSongIds(item).Count == 0 && request.InheritFromParent && item.Parent != null)
{
item = item.Parent;
}
@@ -598,7 +598,7 @@ namespace MediaBrowser.Api
.Select(i => (ItemFields)Enum.Parse(typeof(ItemFields), i, true))
.ToList();
- var themeSongIds = item.ThemeSongIds;
+ var themeSongIds = GetThemeSongIds(item);
if (themeSongIds.Count == 0 && request.InheritFromParent)
{
@@ -608,11 +608,11 @@ namespace MediaBrowser.Api
{
var linkedItemWithThemes = album.SoundtrackIds
.Select(i => _libraryManager.GetItemById(i))
- .FirstOrDefault(i => i.ThemeSongIds.Count > 0);
+ .FirstOrDefault(i => GetThemeSongIds(i).Count > 0);
if (linkedItemWithThemes != null)
{
- themeSongIds = linkedItemWithThemes.ThemeSongIds;
+ themeSongIds = GetThemeSongIds(linkedItemWithThemes);
item = linkedItemWithThemes;
}
}
@@ -656,7 +656,7 @@ namespace MediaBrowser.Api
var originalItem = item;
- while (item.ThemeVideoIds.Count == 0 && request.InheritFromParent && item.Parent != null)
+ while (GetThemeVideoIds(item).Count == 0 && request.InheritFromParent && item.Parent != null)
{
item = item.Parent;
}
@@ -666,7 +666,7 @@ namespace MediaBrowser.Api
.Select(i => (ItemFields)Enum.Parse(typeof(ItemFields), i, true))
.ToList();
- var themeVideoIds = item.ThemeVideoIds;
+ var themeVideoIds = GetThemeVideoIds(item);
if (themeVideoIds.Count == 0 && request.InheritFromParent)
{
@@ -681,11 +681,11 @@ namespace MediaBrowser.Api
{
var linkedItemWithThemes = album.SoundtrackIds
.Select(i => _libraryManager.GetItemById(i))
- .FirstOrDefault(i => i.ThemeVideoIds.Count > 0);
+ .FirstOrDefault(i => GetThemeVideoIds(i).Count > 0);
if (linkedItemWithThemes != null)
{
- themeVideoIds = linkedItemWithThemes.ThemeVideoIds;
+ themeVideoIds = GetThemeVideoIds(linkedItemWithThemes);
item = linkedItemWithThemes;
}
}
@@ -705,6 +705,30 @@ namespace MediaBrowser.Api
};
}
+ private List<Guid> GetThemeVideoIds(BaseItem item)
+ {
+ var i = item as IHasThemeMedia;
+
+ if (i != null)
+ {
+ return i.ThemeVideoIds;
+ }
+
+ return new List<Guid>();
+ }
+
+ private List<Guid> GetThemeSongIds(BaseItem item)
+ {
+ var i = item as IHasThemeMedia;
+
+ if (i != null)
+ {
+ return i.ThemeSongIds;
+ }
+
+ return new List<Guid>();
+ }
+
private readonly CultureInfo _usCulture = new CultureInfo("en-US");
public object Get(GetYearIndex request)