aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--MediaBrowser.Controller/Entities/Audio/MusicAlbum.cs58
1 files changed, 34 insertions, 24 deletions
diff --git a/MediaBrowser.Controller/Entities/Audio/MusicAlbum.cs b/MediaBrowser.Controller/Entities/Audio/MusicAlbum.cs
index e9f222016..7b64c0e85 100644
--- a/MediaBrowser.Controller/Entities/Audio/MusicAlbum.cs
+++ b/MediaBrowser.Controller/Entities/Audio/MusicAlbum.cs
@@ -1,6 +1,7 @@
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
+using MediaBrowser.Model.Entities;
namespace MediaBrowser.Controller.Entities.Audio
{
@@ -53,30 +54,6 @@ namespace MediaBrowser.Controller.Entities.Audio
}
/// <summary>
- /// Override to point to first child (song) if not explicitly defined
- /// </summary>
- /// <value>The primary image path.</value>
- [IgnoreDataMember]
- public override string PrimaryImagePath
- {
- get
- {
- if (base.PrimaryImagePath == null)
- {
- var child = Children.FirstOrDefault();
-
- return child == null ? base.PrimaryImagePath : child.PrimaryImagePath;
- }
-
- return base.PrimaryImagePath;
- }
- set
- {
- base.PrimaryImagePath = value;
- }
- }
-
- /// <summary>
/// Override to point to first child (song)
/// </summary>
/// <value>The production year.</value>
@@ -131,6 +108,39 @@ namespace MediaBrowser.Controller.Entities.Audio
}
/// <summary>
+ /// Gets or sets the images.
+ /// </summary>
+ /// <value>The images.</value>
+ public override Dictionary<string, string> Images
+ {
+ get
+ {
+ var images = base.Images;
+ string primaryImagePath;
+
+ if (images == null || !images.TryGetValue(ImageType.Primary.ToString(), out primaryImagePath))
+ {
+ var image = Children.Select(c => c.PrimaryImagePath).FirstOrDefault(c => !string.IsNullOrEmpty(c));
+
+ if (!string.IsNullOrEmpty(image))
+ {
+ if (images == null)
+ {
+ images = new Dictionary<string, string>();
+ }
+ images[ImageType.Primary.ToString()] = image;
+ }
+ }
+
+ return images;
+ }
+ set
+ {
+ base.Images = value;
+ }
+ }
+
+ /// <summary>
/// Creates the name of the sort.
/// </summary>
/// <returns>System.String.</returns>