Merge branch 'master' of https://github.com/MediaBrowser/MediaBrowser
This commit is contained in:
commit
0eed82c504
|
@ -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
|
|||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Attaches the studios.
|
||||
/// </summary>
|
||||
/// <param name="dto">The dto.</param>
|
||||
/// <param name="item">The item.</param>
|
||||
/// <returns>Task.</returns>
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// If an item does not any backdrops, this can be used to find the first parent that does have one
|
||||
/// </summary>
|
||||
|
|
|
@ -483,7 +483,7 @@ namespace MediaBrowser.Controller.Entities
|
|||
{
|
||||
get
|
||||
{
|
||||
return ActualChildren.Values;
|
||||
return ActualChildren.Values.ToList();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -160,7 +160,7 @@ namespace MediaBrowser.Model.Dto
|
|||
/// Gets or sets the studios.
|
||||
/// </summary>
|
||||
/// <value>The studios.</value>
|
||||
public List<string> Studios { get; set; }
|
||||
public StudioDto[] Studios { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// If the item does not have a logo, this will hold the Id of the Parent that has one.
|
||||
|
|
|
@ -51,4 +51,40 @@ namespace MediaBrowser.Model.Dto
|
|||
/// </summary>
|
||||
public event PropertyChangedEventHandler PropertyChanged;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Class StudioDto
|
||||
/// </summary>
|
||||
public class StudioDto
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets or sets the name.
|
||||
/// </summary>
|
||||
/// <value>The name.</value>
|
||||
public string Name { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the primary image tag.
|
||||
/// </summary>
|
||||
/// <value>The primary image tag.</value>
|
||||
public Guid? PrimaryImageTag { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets a value indicating whether this instance has primary image.
|
||||
/// </summary>
|
||||
/// <value><c>true</c> if this instance has primary image; otherwise, <c>false</c>.</value>
|
||||
[IgnoreDataMember]
|
||||
public bool HasPrimaryImage
|
||||
{
|
||||
get
|
||||
{
|
||||
return PrimaryImageTag.HasValue;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Occurs when [property changed].
|
||||
/// </summary>
|
||||
public event PropertyChangedEventHandler PropertyChanged;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
<package xmlns="http://schemas.microsoft.com/packaging/2011/08/nuspec.xsd">
|
||||
<metadata>
|
||||
<id>MediaBrowser.Common.Internal</id>
|
||||
<version>3.0.90</version>
|
||||
<version>3.0.91</version>
|
||||
<title>MediaBrowser.Common.Internal</title>
|
||||
<authors>Luke</authors>
|
||||
<owners>ebr,Luke,scottisafool</owners>
|
||||
|
@ -12,9 +12,9 @@
|
|||
<description>Contains common components shared by Media Browser Theatre and Media Browser Server. Not intended for plugin developer consumption.</description>
|
||||
<copyright>Copyright © Media Browser 2013</copyright>
|
||||
<dependencies>
|
||||
<dependency id="MediaBrowser.Common" version="3.0.90" />
|
||||
<dependency id="MediaBrowser.Common" version="3.0.91" />
|
||||
<dependency id="NLog" version="2.0.1.2" />
|
||||
<dependency id="ServiceStack.Text" version="3.9.90" />
|
||||
<dependency id="ServiceStack.Text" version="3.9.91" />
|
||||
<dependency id="SimpleInjector" version="2.2.1" />
|
||||
</dependencies>
|
||||
</metadata>
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
<package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
|
||||
<metadata>
|
||||
<id>MediaBrowser.Common</id>
|
||||
<version>3.0.90</version>
|
||||
<version>3.0.91</version>
|
||||
<title>MediaBrowser.Common</title>
|
||||
<authors>Media Browser Team</authors>
|
||||
<owners>ebr,Luke,scottisafool</owners>
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
<package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
|
||||
<metadata>
|
||||
<id>MediaBrowser.Server.Core</id>
|
||||
<version>3.0.90</version>
|
||||
<version>3.0.91</version>
|
||||
<title>Media Browser.Server.Core</title>
|
||||
<authors>Media Browser Team</authors>
|
||||
<owners>ebr,Luke,scottisafool</owners>
|
||||
|
@ -12,7 +12,7 @@
|
|||
<description>Contains core components required to build plugins for Media Browser Server.</description>
|
||||
<copyright>Copyright © Media Browser 2013</copyright>
|
||||
<dependencies>
|
||||
<dependency id="MediaBrowser.Common" version="3.0.90" />
|
||||
<dependency id="MediaBrowser.Common" version="3.0.91" />
|
||||
</dependencies>
|
||||
</metadata>
|
||||
<files>
|
||||
|
|
Loading…
Reference in New Issue
Block a user