diff --git a/MediaBrowser.Controller/Dto/DtoBuilder.cs b/MediaBrowser.Controller/Dto/DtoBuilder.cs
index 7af9cb496..39b139f02 100644
--- a/MediaBrowser.Controller/Dto/DtoBuilder.cs
+++ b/MediaBrowser.Controller/Dto/DtoBuilder.cs
@@ -63,7 +63,7 @@ namespace MediaBrowser.Controller.Dto
if (fields.Contains(ItemFields.Studios))
{
- dto.Studios = item.Studios;
+ tasks.Add(AttachStudios(dto, item));
}
if (fields.Contains(ItemFields.People))
@@ -124,7 +124,7 @@ namespace MediaBrowser.Controller.Dto
if (fields.Contains(ItemFields.Studios))
{
- dto.Studios = item.Studios;
+ tasks.Add(AttachStudios(dto, item));
}
if (fields.Contains(ItemFields.People))
@@ -644,6 +644,67 @@ namespace MediaBrowser.Controller.Dto
}
}
+ ///
+ /// Attaches the studios.
+ ///
+ /// The dto.
+ /// The item.
+ /// Task.
+ private async Task AttachStudios(BaseItemDto dto, BaseItem item)
+ {
+ if (item.Studios == null)
+ {
+ return;
+ }
+
+ var studios = item.Studios.ToList();
+
+ dto.Studios = new StudioDto[studios.Count];
+
+ var entities = await Task.WhenAll(studios.Distinct(StringComparer.OrdinalIgnoreCase).Select(c =>
+
+ Task.Run(async () =>
+ {
+ try
+ {
+ return await _libraryManager.GetStudio(c).ConfigureAwait(false);
+ }
+ catch (IOException ex)
+ {
+ _logger.ErrorException("Error getting studio {0}", ex, c);
+ return null;
+ }
+ })
+
+ )).ConfigureAwait(false);
+
+ var dictionary = entities.ToDictionary(i => i.Name, StringComparer.OrdinalIgnoreCase);
+
+ for (var i = 0; i < studios.Count; i++)
+ {
+ var studio = studios[i];
+
+ var studioDto = new StudioDto
+ {
+ Name = studio
+ };
+
+ Studio entity;
+
+ if (dictionary.TryGetValue(studio, out entity))
+ {
+ var primaryImagePath = entity.PrimaryImagePath;
+
+ if (!string.IsNullOrEmpty(primaryImagePath))
+ {
+ studioDto.PrimaryImageTag = Kernel.Instance.ImageManager.GetImageCacheTag(entity, ImageType.Primary, primaryImagePath);
+ }
+ }
+
+ dto.Studios[i] = studioDto;
+ }
+ }
+
///
/// If an item does not any backdrops, this can be used to find the first parent that does have one
///
diff --git a/MediaBrowser.Model/DTO/BaseItemDto.cs b/MediaBrowser.Model/DTO/BaseItemDto.cs
index 4170e7250..f33892c47 100644
--- a/MediaBrowser.Model/DTO/BaseItemDto.cs
+++ b/MediaBrowser.Model/DTO/BaseItemDto.cs
@@ -160,7 +160,7 @@ namespace MediaBrowser.Model.Dto
/// Gets or sets the studios.
///
/// The studios.
- public List Studios { get; set; }
+ public StudioDto[] Studios { get; set; }
///
/// If the item does not have a logo, this will hold the Id of the Parent that has one.
diff --git a/MediaBrowser.Model/DTO/BaseItemPerson.cs b/MediaBrowser.Model/DTO/BaseItemPerson.cs
index 9fd5e1a8a..911f070ce 100644
--- a/MediaBrowser.Model/DTO/BaseItemPerson.cs
+++ b/MediaBrowser.Model/DTO/BaseItemPerson.cs
@@ -51,4 +51,40 @@ namespace MediaBrowser.Model.Dto
///
public event PropertyChangedEventHandler PropertyChanged;
}
+
+ ///
+ /// Class StudioDto
+ ///
+ public class StudioDto
+ {
+ ///
+ /// Gets or sets the name.
+ ///
+ /// The name.
+ public string Name { get; set; }
+
+ ///
+ /// Gets or sets the primary image tag.
+ ///
+ /// The primary image tag.
+ public Guid? PrimaryImageTag { get; set; }
+
+ ///
+ /// Gets a value indicating whether this instance has primary image.
+ ///
+ /// true if this instance has primary image; otherwise, false.
+ [IgnoreDataMember]
+ public bool HasPrimaryImage
+ {
+ get
+ {
+ return PrimaryImageTag.HasValue;
+ }
+ }
+
+ ///
+ /// Occurs when [property changed].
+ ///
+ public event PropertyChangedEventHandler PropertyChanged;
+ }
}
diff --git a/Nuget/MediaBrowser.Common.Internal.nuspec b/Nuget/MediaBrowser.Common.Internal.nuspec
index b40b91f17..b15974fe6 100644
--- a/Nuget/MediaBrowser.Common.Internal.nuspec
+++ b/Nuget/MediaBrowser.Common.Internal.nuspec
@@ -2,7 +2,7 @@
MediaBrowser.Common.Internal
- 3.0.90
+ 3.0.91
MediaBrowser.Common.Internal
Luke
ebr,Luke,scottisafool
@@ -12,9 +12,9 @@
Contains common components shared by Media Browser Theatre and Media Browser Server. Not intended for plugin developer consumption.
Copyright © Media Browser 2013
-
+
-
+
diff --git a/Nuget/MediaBrowser.Common.nuspec b/Nuget/MediaBrowser.Common.nuspec
index 5229c21e9..97210cd62 100644
--- a/Nuget/MediaBrowser.Common.nuspec
+++ b/Nuget/MediaBrowser.Common.nuspec
@@ -2,7 +2,7 @@
MediaBrowser.Common
- 3.0.90
+ 3.0.91
MediaBrowser.Common
Media Browser Team
ebr,Luke,scottisafool
diff --git a/Nuget/MediaBrowser.Server.Core.nuspec b/Nuget/MediaBrowser.Server.Core.nuspec
index 0d6e8581e..0bd9c18cf 100644
--- a/Nuget/MediaBrowser.Server.Core.nuspec
+++ b/Nuget/MediaBrowser.Server.Core.nuspec
@@ -2,7 +2,7 @@
MediaBrowser.Server.Core
- 3.0.90
+ 3.0.91
Media Browser.Server.Core
Media Browser Team
ebr,Luke,scottisafool
@@ -12,7 +12,7 @@
Contains core components required to build plugins for Media Browser Server.
Copyright © Media Browser 2013
-
+