From 68d018121671a03a5e51799ef107bfc2b77f188d Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Thu, 25 Apr 2013 15:47:38 -0400 Subject: [PATCH] changed images dictionary to be enum based --- MediaBrowser.Controller/Dto/DtoBuilder.cs | 7 ++--- .../Entities/Audio/MusicAlbum.cs | 8 +++--- MediaBrowser.Controller/Entities/BaseItem.cs | 26 +++++++++---------- .../Providers/MediaInfo/AudioImageProvider.cs | 5 ---- .../EpisodeImageFromMediaLocationProvider.cs | 5 ---- 5 files changed, 19 insertions(+), 32 deletions(-) diff --git a/MediaBrowser.Controller/Dto/DtoBuilder.cs b/MediaBrowser.Controller/Dto/DtoBuilder.cs index a5b7b72ce..63d19a662 100644 --- a/MediaBrowser.Controller/Dto/DtoBuilder.cs +++ b/MediaBrowser.Controller/Dto/DtoBuilder.cs @@ -299,12 +299,9 @@ namespace MediaBrowser.Controller.Dto foreach (var image in item.Images) { - ImageType type; + var type = image.Key; - if (Enum.TryParse(image.Key, true, out type)) - { - dto.ImageTags[type] = Kernel.Instance.ImageManager.GetImageCacheTag(item, type, image.Value); - } + dto.ImageTags[type] = Kernel.Instance.ImageManager.GetImageCacheTag(item, type, image.Value); } } diff --git a/MediaBrowser.Controller/Entities/Audio/MusicAlbum.cs b/MediaBrowser.Controller/Entities/Audio/MusicAlbum.cs index 859910ae6..0366af8c7 100644 --- a/MediaBrowser.Controller/Entities/Audio/MusicAlbum.cs +++ b/MediaBrowser.Controller/Entities/Audio/MusicAlbum.cs @@ -111,14 +111,14 @@ namespace MediaBrowser.Controller.Entities.Audio /// Gets or sets the images. /// /// The images. - public override Dictionary Images + public override Dictionary Images { get { var images = base.Images; string primaryImagePath; - if (images == null || !images.TryGetValue(ImageType.Primary.ToString(), out primaryImagePath)) + if (images == null || !images.TryGetValue(ImageType.Primary, out primaryImagePath)) { var image = Children.Select(c => c.PrimaryImagePath).FirstOrDefault(c => !string.IsNullOrEmpty(c)); @@ -126,9 +126,9 @@ namespace MediaBrowser.Controller.Entities.Audio { if (images == null) { - images = new Dictionary(); + images = new Dictionary(); } - images[ImageType.Primary.ToString()] = image; + images[ImageType.Primary] = image; } } diff --git a/MediaBrowser.Controller/Entities/BaseItem.cs b/MediaBrowser.Controller/Entities/BaseItem.cs index c59094cbf..c93923ab9 100644 --- a/MediaBrowser.Controller/Entities/BaseItem.cs +++ b/MediaBrowser.Controller/Entities/BaseItem.cs @@ -89,7 +89,7 @@ namespace MediaBrowser.Controller.Entities /// Gets or sets the images. /// /// The images. - public virtual Dictionary Images { get; set; } + public virtual Dictionary Images { get; set; } /// /// Gets or sets the date created. @@ -650,7 +650,7 @@ namespace MediaBrowser.Controller.Entities /// /// The _local trailers /// - private List /// The local trailers. [IgnoreDataMember] - public List