浏览代码

Added AlbumId and AlbumPrimaryImageTag

Luke Pulverenti 12 年之前
父节点
当前提交
61c7c5a9fc
共有 2 个文件被更改,包括 25 次插入0 次删除
  1. 14 0
      MediaBrowser.Controller/Dto/DtoBuilder.cs
  2. 11 0
      MediaBrowser.Model/Dto/BaseItemDto.cs

+ 14 - 0
MediaBrowser.Controller/Dto/DtoBuilder.cs

@@ -591,6 +591,20 @@ namespace MediaBrowser.Controller.Dto
                 dto.Album = audio.Album;
                 dto.AlbumArtist = audio.AlbumArtist;
                 dto.Artists = new[] { audio.Artist };
+
+                var albumParent = audio.FindParent<MusicAlbum>();
+
+                if (albumParent != null)
+                {
+                    dto.AlbumId = GetClientItemId(albumParent);
+
+                    var imagePath = albumParent.PrimaryImagePath;
+
+                    if (!string.IsNullOrEmpty(imagePath))
+                    {
+                        dto.AlbumPrimaryImageTag = GetImageCacheTag(albumParent, ImageType.Primary, imagePath);
+                    }
+                }
             }
 
             var album = item as MusicAlbum;

+ 11 - 0
MediaBrowser.Model/Dto/BaseItemDto.cs

@@ -348,6 +348,17 @@ namespace MediaBrowser.Model.Dto
         /// <value>The album.</value>
         public string Album { get; set; }
 
+        /// <summary>
+        /// Gets or sets the album id.
+        /// </summary>
+        /// <value>The album id.</value>
+        public string AlbumId { get; set; }
+        /// <summary>
+        /// Gets or sets the album image tag.
+        /// </summary>
+        /// <value>The album image tag.</value>
+        public Guid? AlbumPrimaryImageTag { get; set; }
+
         /// <summary>
         /// Gets or sets the album artist.
         /// </summary>