start people update
This commit is contained in:
parent
64bdf13434
commit
8bb10cb12f
|
@ -1,5 +1,4 @@
|
|||
using System.Threading.Tasks;
|
||||
using MediaBrowser.Controller.Dto;
|
||||
using MediaBrowser.Controller.Dto;
|
||||
using MediaBrowser.Controller.Entities;
|
||||
using MediaBrowser.Controller.Entities.Audio;
|
||||
using MediaBrowser.Controller.Library;
|
||||
|
@ -12,6 +11,7 @@ using ServiceStack.Web;
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace MediaBrowser.Api
|
||||
{
|
||||
|
@ -344,9 +344,7 @@ namespace MediaBrowser.Api
|
|||
return name;
|
||||
}
|
||||
|
||||
return libraryManager.RootFolder
|
||||
.GetRecursiveChildren()
|
||||
.SelectMany(i => i.People)
|
||||
return libraryManager.GetAllPeople()
|
||||
.Select(i => i.Name)
|
||||
.DistinctNames()
|
||||
.FirstOrDefault(i =>
|
||||
|
|
|
@ -218,6 +218,11 @@ namespace MediaBrowser.Api
|
|||
|
||||
await item.UpdateToRepository(ItemUpdateType.MetadataEdit, CancellationToken.None).ConfigureAwait(false);
|
||||
|
||||
if (request.People != null)
|
||||
{
|
||||
await _libraryManager.UpdatePeople(item, request.People.Select(x => new PersonInfo { Name = x.Name, Role = x.Role, Type = x.Type }).ToList());
|
||||
}
|
||||
|
||||
if (isLockedChanged && item.IsFolder)
|
||||
{
|
||||
var folder = (Folder)item;
|
||||
|
@ -303,11 +308,6 @@ namespace MediaBrowser.Api
|
|||
item.Studios = request.Studios.Select(x => x.Name).ToList();
|
||||
}
|
||||
|
||||
if (request.People != null)
|
||||
{
|
||||
item.People = request.People.Select(x => new PersonInfo { Name = x.Name, Role = x.Role, Type = x.Type }).ToList();
|
||||
}
|
||||
|
||||
if (request.DateCreated.HasValue)
|
||||
{
|
||||
item.DateCreated = NormalizeDateTime(request.DateCreated.Value);
|
||||
|
|
|
@ -165,7 +165,7 @@ namespace MediaBrowser.Api.Movies
|
|||
return ToOptimizedResult(result);
|
||||
}
|
||||
|
||||
private async Task<ItemsResult> GetSimilarItemsResult(BaseGetSimilarItemsFromItem request, Func<BaseItem, bool> includeInSearch, Func<BaseItem, BaseItem, int> getSimilarityScore)
|
||||
private async Task<ItemsResult> GetSimilarItemsResult(BaseGetSimilarItemsFromItem request, Func<BaseItem, bool> includeInSearch, Func<BaseItem, BaseItem, ILibraryManager, int> getSimilarityScore)
|
||||
{
|
||||
var user = !string.IsNullOrWhiteSpace(request.UserId) ? _userManager.GetUserById(request.UserId) : null;
|
||||
|
||||
|
@ -214,7 +214,7 @@ namespace MediaBrowser.Api.Movies
|
|||
}
|
||||
}
|
||||
|
||||
var items = SimilarItemsHelper.GetSimilaritems(item, list, getSimilarityScore).ToList();
|
||||
var items = SimilarItemsHelper.GetSimilaritems(item, _libraryManager, list, getSimilarityScore).ToList();
|
||||
|
||||
IEnumerable<BaseItem> returnItems = items;
|
||||
|
||||
|
@ -339,7 +339,7 @@ namespace MediaBrowser.Api.Movies
|
|||
foreach (var director in directors)
|
||||
{
|
||||
var items = allMovies
|
||||
.Where(i => i.People.Any(p => string.Equals(p.Type, PersonType.Director, StringComparison.OrdinalIgnoreCase) && string.Equals(p.Name, director, StringComparison.OrdinalIgnoreCase)))
|
||||
.Where(i => _libraryManager.GetPeople(i).Any(p => string.Equals(p.Type, PersonType.Director, StringComparison.OrdinalIgnoreCase) && string.Equals(p.Name, director, StringComparison.OrdinalIgnoreCase)))
|
||||
.Take(itemLimit)
|
||||
.ToList();
|
||||
|
||||
|
@ -363,7 +363,7 @@ namespace MediaBrowser.Api.Movies
|
|||
foreach (var name in names)
|
||||
{
|
||||
var items = allMovies
|
||||
.Where(i => i.People.Any(p => string.Equals(p.Name, name, StringComparison.OrdinalIgnoreCase)))
|
||||
.Where(i => _libraryManager.GetPeople(i).Any(p => string.Equals(p.Name, name, StringComparison.OrdinalIgnoreCase)))
|
||||
.Take(itemLimit)
|
||||
.ToList();
|
||||
|
||||
|
@ -387,7 +387,7 @@ namespace MediaBrowser.Api.Movies
|
|||
foreach (var item in baselineItems)
|
||||
{
|
||||
var similar = SimilarItemsHelper
|
||||
.GetSimilaritems(item, allMovies, SimilarItemsHelper.GetSimiliarityScore)
|
||||
.GetSimilaritems(item, _libraryManager, allMovies, SimilarItemsHelper.GetSimiliarityScore)
|
||||
.Take(itemLimit)
|
||||
.ToList();
|
||||
|
||||
|
@ -408,7 +408,7 @@ namespace MediaBrowser.Api.Movies
|
|||
{
|
||||
// Get the two leading actors for all movies
|
||||
return items
|
||||
.SelectMany(i => i.People.Where(p => !string.Equals(PersonType.Director, p.Type, StringComparison.OrdinalIgnoreCase)).Take(2))
|
||||
.SelectMany(i => _libraryManager.GetPeople(i).Where(p => !string.Equals(PersonType.Director, p.Type, StringComparison.OrdinalIgnoreCase)).Take(2))
|
||||
.Select(i => i.Name)
|
||||
.DistinctNames();
|
||||
}
|
||||
|
@ -416,7 +416,7 @@ namespace MediaBrowser.Api.Movies
|
|||
private IEnumerable<string> GetDirectors(IEnumerable<BaseItem> items)
|
||||
{
|
||||
return items
|
||||
.Select(i => i.People.FirstOrDefault(p => string.Equals(PersonType.Director, p.Type, StringComparison.OrdinalIgnoreCase)))
|
||||
.Select(i => _libraryManager.GetPeople(i).FirstOrDefault(p => string.Equals(PersonType.Director, p.Type, StringComparison.OrdinalIgnoreCase)))
|
||||
.Where(i => i != null)
|
||||
.Select(i => i.Name)
|
||||
.DistinctNames();
|
||||
|
|
|
@ -69,10 +69,11 @@ namespace MediaBrowser.Api.Music
|
|||
/// </summary>
|
||||
/// <param name="item1">The item1.</param>
|
||||
/// <param name="item2">The item2.</param>
|
||||
/// <param name="libraryManager">The library manager.</param>
|
||||
/// <returns>System.Int32.</returns>
|
||||
private int GetAlbumSimilarityScore(BaseItem item1, BaseItem item2)
|
||||
private int GetAlbumSimilarityScore(BaseItem item1, BaseItem item2, ILibraryManager libraryManager)
|
||||
{
|
||||
var points = SimilarItemsHelper.GetSimiliarityScore(item1, item2);
|
||||
var points = SimilarItemsHelper.GetSimiliarityScore(item1, item2, libraryManager);
|
||||
|
||||
var album1 = (MusicAlbum)item1;
|
||||
var album2 = (MusicAlbum)item2;
|
||||
|
|
|
@ -779,7 +779,7 @@ namespace MediaBrowser.Api.Reports
|
|||
.Select(p => p == null ? "-1" : p.Name)
|
||||
.ToList();
|
||||
|
||||
if (!(names.Any(v => i.People.Select(p => p.Name).Contains(v, StringComparer.OrdinalIgnoreCase))))
|
||||
if (!(names.Any(v => _libraryManager.GetPeople(i).Select(p => p.Name).Contains(v, StringComparer.OrdinalIgnoreCase))))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
@ -792,7 +792,7 @@ namespace MediaBrowser.Api.Reports
|
|||
|
||||
if (personTypes.Length == 0)
|
||||
{
|
||||
if (!(i.People.Any(p => string.Equals(p.Name, request.Person, StringComparison.OrdinalIgnoreCase))))
|
||||
if (!(_libraryManager.GetPeople(i).Any(p => string.Equals(p.Name, request.Person, StringComparison.OrdinalIgnoreCase))))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
@ -802,8 +802,7 @@ namespace MediaBrowser.Api.Reports
|
|||
var types = personTypes;
|
||||
|
||||
var ok = new[] { i }.Any(item =>
|
||||
item.People != null &&
|
||||
item.People.Any(p =>
|
||||
_libraryManager.GetPeople(i).Any(p =>
|
||||
p.Name.Equals(request.Person, StringComparison.OrdinalIgnoreCase) && (types.Contains(p.Type, StringComparer.OrdinalIgnoreCase) || types.Contains(p.Role, StringComparer.OrdinalIgnoreCase))));
|
||||
|
||||
if (!ok)
|
||||
|
|
|
@ -107,7 +107,7 @@ namespace MediaBrowser.Api.Reports
|
|||
foreach (var item in t)
|
||||
{
|
||||
this.GetGroups(result, ReportHelper.GetServerLocalizedString("Option" + item), topItem,
|
||||
items.SelectMany(x => x.People)
|
||||
items.SelectMany(x => _libraryManager.GetPeople(x))
|
||||
.Where(n => n.Type == item)
|
||||
.GroupBy(x => x.Name)
|
||||
.OrderByDescending(x => x.Count())
|
||||
|
|
|
@ -68,7 +68,7 @@ namespace MediaBrowser.Api
|
|||
/// <param name="includeInSearch">The include in search.</param>
|
||||
/// <param name="getSimilarityScore">The get similarity score.</param>
|
||||
/// <returns>ItemsResult.</returns>
|
||||
internal static ItemsResult GetSimilarItemsResult(DtoOptions dtoOptions, IUserManager userManager, IItemRepository itemRepository, ILibraryManager libraryManager, IUserDataManager userDataRepository, IDtoService dtoService, ILogger logger, BaseGetSimilarItemsFromItem request, Func<BaseItem, bool> includeInSearch, Func<BaseItem, BaseItem, int> getSimilarityScore)
|
||||
internal static ItemsResult GetSimilarItemsResult(DtoOptions dtoOptions, IUserManager userManager, IItemRepository itemRepository, ILibraryManager libraryManager, IUserDataManager userDataRepository, IDtoService dtoService, ILogger logger, BaseGetSimilarItemsFromItem request, Func<BaseItem, bool> includeInSearch, Func<BaseItem, BaseItem, ILibraryManager, int> getSimilarityScore)
|
||||
{
|
||||
var user = !string.IsNullOrWhiteSpace(request.UserId) ? userManager.GetUserById(request.UserId) : null;
|
||||
|
||||
|
@ -82,7 +82,7 @@ namespace MediaBrowser.Api
|
|||
? libraryManager.RootFolder.GetRecursiveChildren(filter)
|
||||
: user.RootFolder.GetRecursiveChildren(user, filter);
|
||||
|
||||
var items = GetSimilaritems(item, inputItems, getSimilarityScore)
|
||||
var items = GetSimilaritems(item, libraryManager, inputItems, getSimilarityScore)
|
||||
.ToList();
|
||||
|
||||
IEnumerable<BaseItem> returnItems = items;
|
||||
|
@ -106,15 +106,16 @@ namespace MediaBrowser.Api
|
|||
/// Gets the similaritems.
|
||||
/// </summary>
|
||||
/// <param name="item">The item.</param>
|
||||
/// <param name="libraryManager">The library manager.</param>
|
||||
/// <param name="inputItems">The input items.</param>
|
||||
/// <param name="getSimilarityScore">The get similarity score.</param>
|
||||
/// <returns>IEnumerable{BaseItem}.</returns>
|
||||
internal static IEnumerable<BaseItem> GetSimilaritems(BaseItem item, IEnumerable<BaseItem> inputItems, Func<BaseItem, BaseItem, int> getSimilarityScore)
|
||||
internal static IEnumerable<BaseItem> GetSimilaritems(BaseItem item, ILibraryManager libraryManager, IEnumerable<BaseItem> inputItems, Func<BaseItem, BaseItem, ILibraryManager, int> getSimilarityScore)
|
||||
{
|
||||
var itemId = item.Id;
|
||||
inputItems = inputItems.Where(i => i.Id != itemId);
|
||||
|
||||
return inputItems.Select(i => new Tuple<BaseItem, int>(i, getSimilarityScore(item, i)))
|
||||
return inputItems.Select(i => new Tuple<BaseItem, int>(i, getSimilarityScore(item, i, libraryManager)))
|
||||
.Where(i => i.Item2 > 2)
|
||||
.OrderByDescending(i => i.Item2)
|
||||
.Select(i => i.Item1);
|
||||
|
@ -148,7 +149,7 @@ namespace MediaBrowser.Api
|
|||
/// <param name="item1">The item1.</param>
|
||||
/// <param name="item2">The item2.</param>
|
||||
/// <returns>System.Int32.</returns>
|
||||
internal static int GetSimiliarityScore(BaseItem item1, BaseItem item2)
|
||||
internal static int GetSimiliarityScore(BaseItem item1, BaseItem item2, ILibraryManager libraryManager)
|
||||
{
|
||||
var points = 0;
|
||||
|
||||
|
@ -169,11 +170,11 @@ namespace MediaBrowser.Api
|
|||
// Find common studios
|
||||
points += item1.Studios.Where(i => item2.Studios.Contains(i, StringComparer.OrdinalIgnoreCase)).Sum(i => 3);
|
||||
|
||||
var item2PeopleNames = item2.People.Select(i => i.Name)
|
||||
var item2PeopleNames = libraryManager.GetPeople(item2).Select(i => i.Name)
|
||||
.DistinctNames()
|
||||
.ToDictionary(i => i, StringComparer.OrdinalIgnoreCase);
|
||||
|
||||
points += item1.People.Where(i => item2PeopleNames.ContainsKey(i.Name)).Sum(i =>
|
||||
points += libraryManager.GetPeople(item1).Where(i => item2PeopleNames.ContainsKey(i.Name)).Sum(i =>
|
||||
{
|
||||
if (string.Equals(i.Type, PersonType.Director, StringComparison.OrdinalIgnoreCase) || string.Equals(i.Role, PersonType.Director, StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
|
|
|
@ -990,7 +990,7 @@ namespace MediaBrowser.Api.UserLibrary
|
|||
.Select(p => p == null ? "-1" : p.Name)
|
||||
.ToList();
|
||||
|
||||
if (!(names.Any(v => i.People.Select(p => p.Name).Contains(v, StringComparer.OrdinalIgnoreCase))))
|
||||
if (!(names.Any(v => libraryManager.GetPeople(i).Select(p => p.Name).Contains(v, StringComparer.OrdinalIgnoreCase))))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
@ -1003,7 +1003,7 @@ namespace MediaBrowser.Api.UserLibrary
|
|||
|
||||
if (personTypes.Length == 0)
|
||||
{
|
||||
if (!(i.People.Any(p => string.Equals(p.Name, request.Person, StringComparison.OrdinalIgnoreCase))))
|
||||
if (!(libraryManager.GetPeople(i).Any(p => string.Equals(p.Name, request.Person, StringComparison.OrdinalIgnoreCase))))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
@ -1013,8 +1013,7 @@ namespace MediaBrowser.Api.UserLibrary
|
|||
var types = personTypes;
|
||||
|
||||
var ok = new[] { i }.Any(item =>
|
||||
item.People != null &&
|
||||
item.People.Any(p =>
|
||||
libraryManager.GetPeople(item).Any(p =>
|
||||
p.Name.Equals(request.Person, StringComparison.OrdinalIgnoreCase) && (types.Contains(p.Type, StringComparer.OrdinalIgnoreCase) || types.Contains(p.Role, StringComparer.OrdinalIgnoreCase))));
|
||||
|
||||
if (!ok)
|
||||
|
|
|
@ -153,7 +153,7 @@ namespace MediaBrowser.Api.UserLibrary
|
|||
/// <returns>IEnumerable{PersonInfo}.</returns>
|
||||
private IEnumerable<PersonInfo> GetAllPeople(IEnumerable<BaseItem> itemsList, string[] personTypes)
|
||||
{
|
||||
var people = itemsList.SelectMany(i => i.People.OrderBy(p => p.SortOrder ?? int.MaxValue).ThenBy(p => p.Type));
|
||||
var people = itemsList.SelectMany(i => LibraryManager.GetPeople(i).OrderBy(p => p.SortOrder ?? int.MaxValue).ThenBy(p => p.Type));
|
||||
|
||||
if (personTypes.Length > 0)
|
||||
{
|
||||
|
|
|
@ -1698,9 +1698,9 @@ namespace MediaBrowser.Controller.Entities
|
|||
.Select(libraryManager.GetItemById)
|
||||
.Select(i => i == null ? "-1" : i.Name)
|
||||
.ToList();
|
||||
|
||||
|
||||
if (!(names.Any(
|
||||
v => item.People.Select(i => i.Name).Contains(v, StringComparer.OrdinalIgnoreCase))))
|
||||
v => libraryManager.GetPeople(item).Select(i => i.Name).Contains(v, StringComparer.OrdinalIgnoreCase))))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
@ -1713,7 +1713,7 @@ namespace MediaBrowser.Controller.Entities
|
|||
|
||||
if (personTypes.Length == 0)
|
||||
{
|
||||
if (!(item.People.Any(p => string.Equals(p.Name, query.Person, StringComparison.OrdinalIgnoreCase))))
|
||||
if (!(libraryManager.GetPeople(item).Any(p => string.Equals(p.Name, query.Person, StringComparison.OrdinalIgnoreCase))))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
@ -1723,8 +1723,7 @@ namespace MediaBrowser.Controller.Entities
|
|||
var types = personTypes;
|
||||
|
||||
var ok = new[] { item }.Any(i =>
|
||||
i.People != null &&
|
||||
i.People.Any(p =>
|
||||
libraryManager.GetPeople(i).Any(p =>
|
||||
string.Equals(p.Name, query.Person, StringComparison.OrdinalIgnoreCase) && (types.Contains(p.Type ?? string.Empty, StringComparer.OrdinalIgnoreCase) || types.Contains(p.Role ?? string.Empty, StringComparer.OrdinalIgnoreCase))));
|
||||
|
||||
if (!ok)
|
||||
|
|
|
@ -412,5 +412,26 @@ namespace MediaBrowser.Controller.Library
|
|||
/// <param name="item">The item.</param>
|
||||
/// <returns>IEnumerable<Folder>.</returns>
|
||||
IEnumerable<Folder> GetCollectionFolders(BaseItem item);
|
||||
|
||||
/// <summary>
|
||||
/// Gets the people.
|
||||
/// </summary>
|
||||
/// <param name="item">The item.</param>
|
||||
/// <returns>List<PersonInfo>.</returns>
|
||||
List<PersonInfo> GetPeople(BaseItem item);
|
||||
|
||||
/// <summary>
|
||||
/// Gets all people names.
|
||||
/// </summary>
|
||||
/// <returns>List<System.String>.</returns>
|
||||
List<PersonInfo> GetAllPeople();
|
||||
|
||||
/// <summary>
|
||||
/// Updates the people.
|
||||
/// </summary>
|
||||
/// <param name="item">The item.</param>
|
||||
/// <param name="people">The people.</param>
|
||||
/// <returns>Task.</returns>
|
||||
Task UpdatePeople(BaseItem item, List<PersonInfo> people);
|
||||
}
|
||||
}
|
|
@ -58,7 +58,7 @@ namespace MediaBrowser.Dlna.ContentDirectory
|
|||
_profile = profile;
|
||||
_config = config;
|
||||
|
||||
_didlBuilder = new DidlBuilder(profile, user, imageProcessor, serverAddress, accessToken, userDataManager, localization, mediaSourceManager, Logger);
|
||||
_didlBuilder = new DidlBuilder(profile, user, imageProcessor, serverAddress, accessToken, userDataManager, localization, mediaSourceManager, Logger, libraryManager);
|
||||
}
|
||||
|
||||
protected override IEnumerable<KeyValuePair<string, string>> GetResult(string methodName, Headers methodParams)
|
||||
|
@ -410,7 +410,7 @@ namespace MediaBrowser.Dlna.ContentDirectory
|
|||
{
|
||||
if (stubType.Value == StubType.People)
|
||||
{
|
||||
var items = item.People.Select(i =>
|
||||
var items = _libraryManager.GetPeople(item).Select(i =>
|
||||
{
|
||||
try
|
||||
{
|
||||
|
|
|
@ -40,8 +40,9 @@ namespace MediaBrowser.Dlna.Didl
|
|||
private readonly ILocalizationManager _localization;
|
||||
private readonly IMediaSourceManager _mediaSourceManager;
|
||||
private readonly ILogger _logger;
|
||||
private readonly ILibraryManager _libraryManager;
|
||||
|
||||
public DidlBuilder(DeviceProfile profile, User user, IImageProcessor imageProcessor, string serverAddress, string accessToken, IUserDataManager userDataManager, ILocalizationManager localization, IMediaSourceManager mediaSourceManager, ILogger logger)
|
||||
public DidlBuilder(DeviceProfile profile, User user, IImageProcessor imageProcessor, string serverAddress, string accessToken, IUserDataManager userDataManager, ILocalizationManager localization, IMediaSourceManager mediaSourceManager, ILogger logger, ILibraryManager libraryManager)
|
||||
{
|
||||
_profile = profile;
|
||||
_imageProcessor = imageProcessor;
|
||||
|
@ -50,6 +51,7 @@ namespace MediaBrowser.Dlna.Didl
|
|||
_localization = localization;
|
||||
_mediaSourceManager = mediaSourceManager;
|
||||
_logger = logger;
|
||||
_libraryManager = libraryManager;
|
||||
_accessToken = accessToken;
|
||||
_user = user;
|
||||
}
|
||||
|
@ -654,7 +656,9 @@ namespace MediaBrowser.Dlna.Didl
|
|||
{
|
||||
var types = new[] { PersonType.Director, PersonType.Writer, PersonType.Producer, PersonType.Composer, "Creator" };
|
||||
|
||||
foreach (var actor in item.People)
|
||||
var people = _libraryManager.GetPeople(item);
|
||||
|
||||
foreach (var actor in people)
|
||||
{
|
||||
var type = types.FirstOrDefault(i => string.Equals(i, actor.Type, StringComparison.OrdinalIgnoreCase) || string.Equals(i, actor.Role, StringComparison.OrdinalIgnoreCase))
|
||||
?? PersonType.Actor;
|
||||
|
|
|
@ -478,7 +478,7 @@ namespace MediaBrowser.Dlna.PlayTo
|
|||
|
||||
playlistItem.StreamUrl = playlistItem.StreamInfo.ToDlnaUrl(_serverAddress, _accessToken);
|
||||
|
||||
var itemXml = new DidlBuilder(profile, user, _imageProcessor, _serverAddress, _accessToken, _userDataManager, _localization, _mediaSourceManager, _logger)
|
||||
var itemXml = new DidlBuilder(profile, user, _imageProcessor, _serverAddress, _accessToken, _userDataManager, _localization, _mediaSourceManager, _logger, _libraryManager)
|
||||
.GetItemDidl(item, null, _session.DeviceId, new Filter(), playlistItem.StreamInfo);
|
||||
|
||||
playlistItem.Didl = itemXml;
|
||||
|
|
|
@ -20,10 +20,12 @@ namespace MediaBrowser.LocalMetadata.Savers
|
|||
}
|
||||
|
||||
private readonly IServerConfigurationManager _config;
|
||||
private readonly ILibraryManager _libraryManager;
|
||||
|
||||
public BoxSetXmlSaver(IServerConfigurationManager config)
|
||||
public BoxSetXmlSaver(IServerConfigurationManager config, ILibraryManager libraryManager)
|
||||
{
|
||||
_config = config;
|
||||
_libraryManager = libraryManager;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -54,7 +56,7 @@ namespace MediaBrowser.LocalMetadata.Savers
|
|||
|
||||
builder.Append("<Item>");
|
||||
|
||||
XmlSaverHelpers.AddCommonNodes((BoxSet)item, builder);
|
||||
XmlSaverHelpers.AddCommonNodes((BoxSet)item, _libraryManager, builder);
|
||||
|
||||
builder.Append("</Item>");
|
||||
|
||||
|
|
|
@ -18,11 +18,13 @@ namespace MediaBrowser.LocalMetadata.Savers
|
|||
|
||||
private readonly CultureInfo _usCulture = new CultureInfo("en-US");
|
||||
private readonly IServerConfigurationManager _config;
|
||||
private readonly ILibraryManager _libraryManager;
|
||||
|
||||
public EpisodeXmlSaver(IItemRepository itemRepository, IServerConfigurationManager config)
|
||||
public EpisodeXmlSaver(IItemRepository itemRepository, IServerConfigurationManager config, ILibraryManager libraryManager)
|
||||
{
|
||||
_itemRepository = itemRepository;
|
||||
_config = config;
|
||||
_libraryManager = libraryManager;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -116,7 +118,7 @@ namespace MediaBrowser.LocalMetadata.Savers
|
|||
builder.Append("<FirstAired>" + SecurityElement.Escape(episode.PremiereDate.Value.ToLocalTime().ToString("yyyy-MM-dd")) + "</FirstAired>");
|
||||
}
|
||||
|
||||
XmlSaverHelpers.AddCommonNodes(episode, builder);
|
||||
XmlSaverHelpers.AddCommonNodes(episode, _libraryManager, builder);
|
||||
XmlSaverHelpers.AddMediaInfo(episode, builder, _itemRepository);
|
||||
|
||||
builder.Append("</Item>");
|
||||
|
|
|
@ -23,10 +23,12 @@ namespace MediaBrowser.LocalMetadata.Savers
|
|||
}
|
||||
|
||||
private readonly IServerConfigurationManager _config;
|
||||
private readonly ILibraryManager _libraryManager;
|
||||
|
||||
public FolderXmlSaver(IServerConfigurationManager config)
|
||||
public FolderXmlSaver(IServerConfigurationManager config, ILibraryManager libraryManager)
|
||||
{
|
||||
_config = config;
|
||||
_libraryManager = libraryManager;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -68,7 +70,7 @@ namespace MediaBrowser.LocalMetadata.Savers
|
|||
|
||||
builder.Append("<Item>");
|
||||
|
||||
XmlSaverHelpers.AddCommonNodes((Folder)item, builder);
|
||||
XmlSaverHelpers.AddCommonNodes((Folder)item, _libraryManager, builder);
|
||||
|
||||
builder.Append("</Item>");
|
||||
|
||||
|
|
|
@ -20,10 +20,12 @@ namespace MediaBrowser.LocalMetadata.Savers
|
|||
}
|
||||
|
||||
private readonly IServerConfigurationManager _config;
|
||||
private readonly ILibraryManager _libraryManager;
|
||||
|
||||
public GameSystemXmlSaver(IServerConfigurationManager config)
|
||||
public GameSystemXmlSaver(IServerConfigurationManager config, ILibraryManager libraryManager)
|
||||
{
|
||||
_config = config;
|
||||
_libraryManager = libraryManager;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -61,7 +63,7 @@ namespace MediaBrowser.LocalMetadata.Savers
|
|||
builder.Append("<GameSystem>" + SecurityElement.Escape(gameSystem.GameSystemName) + "</GameSystem>");
|
||||
}
|
||||
|
||||
XmlSaverHelpers.AddCommonNodes(gameSystem, builder);
|
||||
XmlSaverHelpers.AddCommonNodes(gameSystem, _libraryManager, builder);
|
||||
|
||||
builder.Append("</Item>");
|
||||
|
||||
|
|
|
@ -25,12 +25,14 @@ namespace MediaBrowser.LocalMetadata.Savers
|
|||
}
|
||||
|
||||
private readonly IServerConfigurationManager _config;
|
||||
private readonly ILibraryManager _libraryManager;
|
||||
|
||||
public GameXmlSaver(IServerConfigurationManager config)
|
||||
public GameXmlSaver(IServerConfigurationManager config, ILibraryManager libraryManager)
|
||||
{
|
||||
_config = config;
|
||||
_libraryManager = libraryManager;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Determines whether [is enabled for] [the specified item].
|
||||
/// </summary>
|
||||
|
@ -87,7 +89,7 @@ namespace MediaBrowser.LocalMetadata.Savers
|
|||
builder.Append("<NesBoxRom>" + SecurityElement.Escape(val) + "</NesBoxRom>");
|
||||
}
|
||||
|
||||
XmlSaverHelpers.AddCommonNodes(game, builder);
|
||||
XmlSaverHelpers.AddCommonNodes(game, _libraryManager, builder);
|
||||
|
||||
builder.Append("</Item>");
|
||||
|
||||
|
|
|
@ -74,7 +74,7 @@ namespace MediaBrowser.LocalMetadata.Savers
|
|||
|
||||
builder.Append("<Title>");
|
||||
|
||||
XmlSaverHelpers.AddCommonNodes(video, builder);
|
||||
XmlSaverHelpers.AddCommonNodes(video, _libraryManager, builder);
|
||||
|
||||
var musicVideo = item as MusicVideo;
|
||||
|
||||
|
|
|
@ -23,10 +23,12 @@ namespace MediaBrowser.LocalMetadata.Savers
|
|||
}
|
||||
|
||||
private readonly IServerConfigurationManager _config;
|
||||
private readonly ILibraryManager _libraryManager;
|
||||
|
||||
public PersonXmlSaver(IServerConfigurationManager config)
|
||||
public PersonXmlSaver(IServerConfigurationManager config, ILibraryManager libraryManager)
|
||||
{
|
||||
_config = config;
|
||||
_libraryManager = libraryManager;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -59,7 +61,7 @@ namespace MediaBrowser.LocalMetadata.Savers
|
|||
|
||||
builder.Append("<Item>");
|
||||
|
||||
XmlSaverHelpers.AddCommonNodes(person, builder);
|
||||
XmlSaverHelpers.AddCommonNodes(person, _libraryManager, builder);
|
||||
|
||||
if (!string.IsNullOrEmpty(person.PlaceOfBirth))
|
||||
{
|
||||
|
|
|
@ -21,10 +21,12 @@ namespace MediaBrowser.LocalMetadata.Savers
|
|||
}
|
||||
|
||||
private readonly IServerConfigurationManager _config;
|
||||
private readonly ILibraryManager _libraryManager;
|
||||
|
||||
public PlaylistXmlSaver(IServerConfigurationManager config)
|
||||
public PlaylistXmlSaver(IServerConfigurationManager config, ILibraryManager libraryManager)
|
||||
{
|
||||
_config = config;
|
||||
_libraryManager = libraryManager;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -61,8 +63,8 @@ namespace MediaBrowser.LocalMetadata.Savers
|
|||
{
|
||||
builder.Append("<PlaylistMediaType>" + SecurityElement.Escape(playlist.PlaylistMediaType) + "</PlaylistMediaType>");
|
||||
}
|
||||
|
||||
XmlSaverHelpers.AddCommonNodes(playlist, builder);
|
||||
|
||||
XmlSaverHelpers.AddCommonNodes(playlist, _libraryManager, builder);
|
||||
|
||||
builder.Append("</Item>");
|
||||
|
||||
|
|
|
@ -15,12 +15,14 @@ namespace MediaBrowser.LocalMetadata.Savers
|
|||
public class SeriesXmlSaver : IMetadataFileSaver
|
||||
{
|
||||
private readonly IServerConfigurationManager _config;
|
||||
private readonly ILibraryManager _libraryManager;
|
||||
|
||||
public SeriesXmlSaver(IServerConfigurationManager config)
|
||||
public SeriesXmlSaver(IServerConfigurationManager config, ILibraryManager libraryManager)
|
||||
{
|
||||
_config = config;
|
||||
_libraryManager = libraryManager;
|
||||
}
|
||||
|
||||
|
||||
public string Name
|
||||
{
|
||||
get
|
||||
|
@ -105,7 +107,7 @@ namespace MediaBrowser.LocalMetadata.Savers
|
|||
builder.Append("<AnimeSeriesIndex>" + SecurityElement.Escape(series.AnimeSeriesIndex.Value.ToString(UsCulture)) + "</AnimeSeriesIndex>");
|
||||
}
|
||||
|
||||
XmlSaverHelpers.AddCommonNodes(series, builder);
|
||||
XmlSaverHelpers.AddCommonNodes(series, _libraryManager, builder);
|
||||
|
||||
builder.Append("</Series>");
|
||||
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
using MediaBrowser.Controller.Entities;
|
||||
using MediaBrowser.Controller.Entities.Movies;
|
||||
using MediaBrowser.Controller.Entities.TV;
|
||||
using MediaBrowser.Controller.Library;
|
||||
using MediaBrowser.Controller.Persistence;
|
||||
using MediaBrowser.Controller.Playlists;
|
||||
using MediaBrowser.Model.Entities;
|
||||
|
@ -230,7 +231,7 @@ namespace MediaBrowser.LocalMetadata.Savers
|
|||
/// </summary>
|
||||
/// <param name="item">The item.</param>
|
||||
/// <param name="builder">The builder.</param>
|
||||
public static void AddCommonNodes(BaseItem item, StringBuilder builder)
|
||||
public static void AddCommonNodes(BaseItem item, ILibraryManager libraryManager, StringBuilder builder)
|
||||
{
|
||||
if (!string.IsNullOrEmpty(item.OfficialRating))
|
||||
{
|
||||
|
@ -627,11 +628,13 @@ namespace MediaBrowser.LocalMetadata.Savers
|
|||
}
|
||||
}
|
||||
|
||||
if (item.People.Count > 0)
|
||||
var people = libraryManager.GetPeople(item);
|
||||
|
||||
if (people.Count > 0)
|
||||
{
|
||||
builder.Append("<Persons>");
|
||||
|
||||
foreach (var person in item.People)
|
||||
foreach (var person in people)
|
||||
{
|
||||
builder.Append("<Person>");
|
||||
builder.Append("<Name>" + SecurityElement.Escape(person.Name) + "</Name>");
|
||||
|
|
|
@ -21,13 +21,13 @@ namespace MediaBrowser.Providers.People
|
|||
public class TvdbPersonImageProvider : IRemoteImageProvider, IHasOrder
|
||||
{
|
||||
private readonly IServerConfigurationManager _config;
|
||||
private readonly ILibraryManager _library;
|
||||
private readonly ILibraryManager _libraryManager;
|
||||
private readonly IHttpClient _httpClient;
|
||||
|
||||
public TvdbPersonImageProvider(IServerConfigurationManager config, ILibraryManager library, IHttpClient httpClient)
|
||||
public TvdbPersonImageProvider(IServerConfigurationManager config, ILibraryManager libraryManager, IHttpClient httpClient)
|
||||
{
|
||||
_config = config;
|
||||
_library = library;
|
||||
_libraryManager = libraryManager;
|
||||
_httpClient = httpClient;
|
||||
}
|
||||
|
||||
|
@ -59,8 +59,8 @@ namespace MediaBrowser.Providers.People
|
|||
// Avoid implicitly captured closure
|
||||
var itemName = item.Name;
|
||||
|
||||
var seriesWithPerson = _library.RootFolder
|
||||
.GetRecursiveChildren(i => i is Series && !string.IsNullOrEmpty(i.GetProviderId(MetadataProviders.Tvdb)) && i.People.Any(p => string.Equals(p.Name, itemName, StringComparison.OrdinalIgnoreCase)))
|
||||
var seriesWithPerson = _libraryManager.RootFolder
|
||||
.GetRecursiveChildren(i => i is Series && !string.IsNullOrEmpty(i.GetProviderId(MetadataProviders.Tvdb)) && _libraryManager.GetPeople(i).Any(p => string.Equals(p.Name, itemName, StringComparison.OrdinalIgnoreCase)))
|
||||
.Cast<Series>()
|
||||
.ToList();
|
||||
|
||||
|
|
|
@ -7,8 +7,6 @@ using MediaBrowser.Model.Entities;
|
|||
using MediaBrowser.Model.Logging;
|
||||
using MediaBrowser.Providers.Manager;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace MediaBrowser.Providers.Videos
|
||||
{
|
||||
|
|
|
@ -636,7 +636,7 @@ namespace MediaBrowser.Server.Implementations.Dto
|
|||
// Ordering by person type to ensure actors and artists are at the front.
|
||||
// This is taking advantage of the fact that they both begin with A
|
||||
// This should be improved in the future
|
||||
var people = item.People.OrderBy(i => i.SortOrder ?? int.MaxValue)
|
||||
var people = _libraryManager.GetPeople(item).OrderBy(i => i.SortOrder ?? int.MaxValue)
|
||||
.ThenBy(i =>
|
||||
{
|
||||
if (i.IsType(PersonType.Actor))
|
||||
|
|
|
@ -94,7 +94,8 @@ namespace MediaBrowser.Server.Implementations.Intros
|
|||
Type = ItemWithTrailerType.ItemWithTrailer,
|
||||
User = user,
|
||||
WatchingItem = item,
|
||||
Random = random
|
||||
Random = random,
|
||||
LibraryManager = _libraryManager
|
||||
}));
|
||||
}
|
||||
|
||||
|
@ -134,7 +135,8 @@ namespace MediaBrowser.Server.Implementations.Intros
|
|||
Type = ItemWithTrailerType.ChannelTrailer,
|
||||
User = user,
|
||||
WatchingItem = item,
|
||||
Random = random
|
||||
Random = random,
|
||||
LibraryManager = _libraryManager
|
||||
}));
|
||||
}
|
||||
|
||||
|
@ -239,7 +241,7 @@ namespace MediaBrowser.Server.Implementations.Intros
|
|||
return true;
|
||||
}
|
||||
|
||||
internal static int GetSimiliarityScore(BaseItem item1, BaseItem item2, Random random)
|
||||
internal static int GetSimiliarityScore(BaseItem item1, BaseItem item2, Random random, ILibraryManager libraryManager)
|
||||
{
|
||||
var points = 0;
|
||||
|
||||
|
@ -260,11 +262,11 @@ namespace MediaBrowser.Server.Implementations.Intros
|
|||
// Find common studios
|
||||
points += item1.Studios.Where(i => item2.Studios.Contains(i, StringComparer.OrdinalIgnoreCase)).Sum(i => 5);
|
||||
|
||||
var item2PeopleNames = item2.People.Select(i => i.Name)
|
||||
var item2PeopleNames = libraryManager.GetPeople(item2).Select(i => i.Name)
|
||||
.Distinct(StringComparer.OrdinalIgnoreCase)
|
||||
.ToDictionary(i => i, StringComparer.OrdinalIgnoreCase);
|
||||
|
||||
points += item1.People.Where(i => item2PeopleNames.ContainsKey(i.Name)).Sum(i =>
|
||||
points += libraryManager.GetPeople(item1).Where(i => item2PeopleNames.ContainsKey(i.Name)).Sum(i =>
|
||||
{
|
||||
if (string.Equals(i.Type, PersonType.Director, StringComparison.OrdinalIgnoreCase) || string.Equals(i.Role, PersonType.Director, StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
|
@ -340,6 +342,7 @@ namespace MediaBrowser.Server.Implementations.Intros
|
|||
internal User User;
|
||||
internal BaseItem WatchingItem;
|
||||
internal Random Random;
|
||||
internal ILibraryManager LibraryManager;
|
||||
|
||||
private bool? _isPlayed;
|
||||
public bool IsPlayed
|
||||
|
@ -361,7 +364,7 @@ namespace MediaBrowser.Server.Implementations.Intros
|
|||
{
|
||||
if (!_score.HasValue)
|
||||
{
|
||||
_score = GetSimiliarityScore(WatchingItem, Item, Random);
|
||||
_score = GetSimiliarityScore(WatchingItem, Item, Random, LibraryManager);
|
||||
}
|
||||
return _score.Value;
|
||||
}
|
||||
|
|
|
@ -32,6 +32,7 @@ using System.IO;
|
|||
using System.Linq;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using MoreLinq;
|
||||
using SortOrder = MediaBrowser.Model.Entities.SortOrder;
|
||||
|
||||
namespace MediaBrowser.Server.Implementations.Library
|
||||
|
@ -2055,5 +2056,26 @@ namespace MediaBrowser.Server.Implementations.Library
|
|||
item.ExtraType = ExtraType.Clip;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public List<PersonInfo> GetPeople(BaseItem item)
|
||||
{
|
||||
return item.People ?? new List<PersonInfo>();
|
||||
}
|
||||
|
||||
public List<PersonInfo> GetAllPeople()
|
||||
{
|
||||
return RootFolder.GetRecursiveChildren()
|
||||
.SelectMany(GetPeople)
|
||||
.Where(i => !string.IsNullOrWhiteSpace(i.Name))
|
||||
.DistinctBy(i => i.Name, StringComparer.OrdinalIgnoreCase)
|
||||
.ToList();
|
||||
}
|
||||
|
||||
public Task UpdatePeople(BaseItem item, List<PersonInfo> people)
|
||||
{
|
||||
item.People = people;
|
||||
return item.UpdateToRepository(ItemUpdateType.MetadataEdit, CancellationToken.None);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -257,7 +257,7 @@ namespace MediaBrowser.Server.Implementations.Library
|
|||
if (query.IncludePeople)
|
||||
{
|
||||
// Find persons
|
||||
var persons = items.SelectMany(i => i.People)
|
||||
var persons = items.SelectMany(i => _libraryManager.GetPeople(i))
|
||||
.Select(i => i.Name)
|
||||
.Where(i => !string.IsNullOrWhiteSpace(i))
|
||||
.Distinct(StringComparer.OrdinalIgnoreCase)
|
||||
|
|
|
@ -72,39 +72,6 @@ namespace MediaBrowser.Server.Implementations.Library.Validators
|
|||
return options.DownloadOtherPeopleMetadata;
|
||||
}
|
||||
|
||||
private IEnumerable<PersonInfo> GetPeopleToValidate(BaseItem item, PeopleMetadataOptions options)
|
||||
{
|
||||
return item.People.Where(i =>
|
||||
{
|
||||
if (i.IsType(PersonType.Actor))
|
||||
{
|
||||
return options.DownloadActorMetadata;
|
||||
}
|
||||
if (i.IsType(PersonType.Director))
|
||||
{
|
||||
return options.DownloadDirectorMetadata;
|
||||
}
|
||||
if (i.IsType(PersonType.Composer))
|
||||
{
|
||||
return options.DownloadComposerMetadata;
|
||||
}
|
||||
if (i.IsType(PersonType.Writer))
|
||||
{
|
||||
return options.DownloadWriterMetadata;
|
||||
}
|
||||
if (i.IsType(PersonType.Producer))
|
||||
{
|
||||
return options.DownloadProducerMetadata;
|
||||
}
|
||||
if (i.IsType(PersonType.GuestStar))
|
||||
{
|
||||
return options.DownloadGuestStarMetadata;
|
||||
}
|
||||
|
||||
return options.DownloadOtherPeopleMetadata;
|
||||
});
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Validates the people.
|
||||
/// </summary>
|
||||
|
@ -119,10 +86,7 @@ namespace MediaBrowser.Server.Implementations.Library.Validators
|
|||
|
||||
var peopleOptions = _config.Configuration.PeopleMetadataOptions;
|
||||
|
||||
var people = _libraryManager.RootFolder.GetRecursiveChildren()
|
||||
.SelectMany(i => i.People)
|
||||
.Where(i => !string.IsNullOrWhiteSpace(i.Name))
|
||||
.ToList();
|
||||
var people = _libraryManager.GetAllPeople();
|
||||
|
||||
var dict = new Dictionary<string, bool>(StringComparer.OrdinalIgnoreCase);
|
||||
|
||||
|
|
|
@ -143,6 +143,12 @@ namespace MediaBrowser.Server.Implementations.Persistence
|
|||
_connection.AddColumn(_logger, "TypedBaseItems", "Name", "Text");
|
||||
_connection.AddColumn(_logger, "TypedBaseItems", "OfficialRating", "Text");
|
||||
|
||||
_connection.AddColumn(_logger, "TypedBaseItems", "MediaType", "Text");
|
||||
_connection.AddColumn(_logger, "TypedBaseItems", "Overview", "Text");
|
||||
_connection.AddColumn(_logger, "TypedBaseItems", "ParentIndexNumber", "INT");
|
||||
_connection.AddColumn(_logger, "TypedBaseItems", "PremiereDate", "DATETIME");
|
||||
_connection.AddColumn(_logger, "TypedBaseItems", "ProductionYear", "INT");
|
||||
|
||||
PrepareStatements();
|
||||
|
||||
_mediaStreamsRepository.Initialize();
|
||||
|
@ -176,10 +182,15 @@ namespace MediaBrowser.Server.Implementations.Persistence
|
|||
"IndexNumber",
|
||||
"IsLocked",
|
||||
"Name",
|
||||
"OfficialRating"
|
||||
"OfficialRating",
|
||||
"MediaType",
|
||||
"Overview",
|
||||
"ParentIndexNumber",
|
||||
"PremiereDate",
|
||||
"ProductionYear"
|
||||
};
|
||||
_saveItemCommand = _connection.CreateCommand();
|
||||
_saveItemCommand.CommandText = "replace into TypedBaseItems (" + string.Join(",", saveColumns.ToArray()) + ") values (@1, @2, @3, @4, @5, @6, @7, @8, @9, @10, @11, @12, @13, @14, @15, @16)";
|
||||
_saveItemCommand.CommandText = "replace into TypedBaseItems (" + string.Join(",", saveColumns.ToArray()) + ") values (@1, @2, @3, @4, @5, @6, @7, @8, @9, @10, @11, @12, @13, @14, @15, @16, @17, @18, @19, @20, @21)";
|
||||
for (var i = 1; i <= saveColumns.Count; i++)
|
||||
{
|
||||
_saveItemCommand.Parameters.Add(_saveItemCommand, "@" + i.ToString(CultureInfo.InvariantCulture));
|
||||
|
@ -293,6 +304,12 @@ namespace MediaBrowser.Server.Implementations.Persistence
|
|||
|
||||
_saveItemCommand.GetParameter(index++).Value = item.Name;
|
||||
_saveItemCommand.GetParameter(index++).Value = item.OfficialRating;
|
||||
|
||||
_saveItemCommand.GetParameter(index++).Value = item.MediaType;
|
||||
_saveItemCommand.GetParameter(index++).Value = item.Overview;
|
||||
_saveItemCommand.GetParameter(index++).Value = item.ParentIndexNumber;
|
||||
_saveItemCommand.GetParameter(index++).Value = item.PremiereDate;
|
||||
_saveItemCommand.GetParameter(index++).Value = item.ProductionYear;
|
||||
|
||||
_saveItemCommand.Transaction = transaction;
|
||||
|
||||
|
|
|
@ -260,7 +260,7 @@ namespace MediaBrowser.WebDashboard.Api
|
|||
|
||||
html = _localization.LocalizeDocument(html, localizationCulture, GetLocalizationToken);
|
||||
|
||||
html = html.Replace("<html>", "<html lang=\"" + lang + "\">");
|
||||
html = html.Replace("<html>", "<html lang=\"" + lang + "\">").Replace("<body>", "<body><div class=\"pageContainer\">").Replace("</body>", "</div></body>");
|
||||
}
|
||||
|
||||
if (enableMinification)
|
||||
|
|
|
@ -472,7 +472,9 @@ namespace MediaBrowser.XbmcMetadata.Savers
|
|||
}
|
||||
}
|
||||
|
||||
var directors = item.People
|
||||
var people = libraryManager.GetPeople(item);
|
||||
|
||||
var directors = people
|
||||
.Where(i => IsPersonType(i, PersonType.Director))
|
||||
.Select(i => i.Name)
|
||||
.ToList();
|
||||
|
@ -482,7 +484,7 @@ namespace MediaBrowser.XbmcMetadata.Savers
|
|||
writer.WriteElementString("director", person);
|
||||
}
|
||||
|
||||
var writers = item.People
|
||||
var writers = people
|
||||
.Where(i => IsPersonType(i, PersonType.Writer))
|
||||
.Select(i => i.Name)
|
||||
.Distinct(StringComparer.OrdinalIgnoreCase)
|
||||
|
@ -820,7 +822,7 @@ namespace MediaBrowser.XbmcMetadata.Savers
|
|||
|
||||
AddUserData(item, writer, userManager, userDataRepo, options);
|
||||
|
||||
AddActors(item, writer, libraryManager, fileSystem, config);
|
||||
AddActors(people, writer, libraryManager, fileSystem, config);
|
||||
|
||||
var folder = item as BoxSet;
|
||||
if (folder != null)
|
||||
|
@ -948,9 +950,9 @@ namespace MediaBrowser.XbmcMetadata.Savers
|
|||
writer.WriteEndElement();
|
||||
}
|
||||
|
||||
private static void AddActors(BaseItem item, XmlWriter writer, ILibraryManager libraryManager, IFileSystem fileSystem, IServerConfigurationManager config)
|
||||
private static void AddActors(List<PersonInfo> people, XmlWriter writer, ILibraryManager libraryManager, IFileSystem fileSystem, IServerConfigurationManager config)
|
||||
{
|
||||
var actors = item.People
|
||||
var actors = people
|
||||
.Where(i => !IsPersonType(i, PersonType.Director) && !IsPersonType(i, PersonType.Writer))
|
||||
.ToList();
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user