pull person sort order from tvdb/tmdb data

This commit is contained in:
Luke Pulverenti
2013-11-19 22:15:48 -05:00
parent de339b8265
commit bce86c5022
14 changed files with 109 additions and 24 deletions

View File

@@ -247,11 +247,16 @@ namespace MediaBrowser.Api
item.PremiereDate = request.PremiereDate.HasValue ? request.PremiereDate.Value.ToUniversalTime() : (DateTime?)null;
item.ProductionYear = request.ProductionYear;
item.ProductionLocations = request.ProductionLocations;
item.AspectRatio = request.AspectRatio;
item.Language = request.Language;
item.OfficialRating = request.OfficialRating;
item.CustomRating = request.CustomRating;
var hasAspectRatio = item as IHasAspectRatio;
if (hasAspectRatio != null)
{
hasAspectRatio.AspectRatio = request.AspectRatio;
}
item.DontFetchMeta = !(request.EnableInternetProviders ?? true);
if (request.EnableInternetProviders ?? true)
{

View File

@@ -681,6 +681,11 @@ namespace MediaBrowser.Api
{
var album = originalItem as MusicAlbum;
if (album == null)
{
album = originalItem.Parents.OfType<MusicAlbum>().FirstOrDefault();
}
if (album != null)
{
var linkedItemWithThemes = album.SoundtrackIds
@@ -744,17 +749,12 @@ namespace MediaBrowser.Api
: (Folder)_libraryManager.RootFolder)
: _dtoService.GetItemByDtoId(id, userId);
while (GetSoundtrackSongIds(item).Count == 0 && inheritFromParent && item.Parent != null)
{
item = item.Parent;
}
// Get everything
var fields = Enum.GetNames(typeof(ItemFields))
.Select(i => (ItemFields)Enum.Parse(typeof(ItemFields), i, true))
.ToList();
var dtos = GetSoundtrackSongIds(item)
var dtos = GetSoundtrackSongIds(item, inheritFromParent)
.Select(_libraryManager.GetItemById)
.OfType<MusicAlbum>()
.SelectMany(i => i.RecursiveChildren)
@@ -772,7 +772,7 @@ namespace MediaBrowser.Api
};
}
private List<Guid> GetSoundtrackSongIds(BaseItem item)
private IEnumerable<Guid> GetSoundtrackSongIds(BaseItem item, bool inherit)
{
var hasSoundtracks = item as IHasSoundtracks;
@@ -781,7 +781,14 @@ namespace MediaBrowser.Api
return hasSoundtracks.SoundtrackIds;
}
return new List<Guid>();
if (!inherit)
{
return null;
}
hasSoundtracks = item.Parents.OfType<IHasSoundtracks>().FirstOrDefault();
return hasSoundtracks != null ? hasSoundtracks.SoundtrackIds : new List<Guid>();
}
}
}

View File

@@ -155,7 +155,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.Type));
var people = itemsList.SelectMany(i => i.People.OrderBy(p => p.SortOrder ?? int.MaxValue).ThenBy(p => p.Type));
return personTypes.Length == 0 ?