fix config startup

pull/702/head
Luke Pulverenti 11 years ago
parent 62d98551ed
commit f0da58a997

@ -96,5 +96,10 @@ namespace MediaBrowser.Controller.Entities
{ {
return Name; return Name;
} }
public bool IsType(string type)
{
return string.Equals(Type, type, StringComparison.OrdinalIgnoreCase) || string.Equals(Role, type, StringComparison.OrdinalIgnoreCase);
}
} }
} }

@ -423,7 +423,38 @@ namespace MediaBrowser.Server.Implementations.Dto
// Ordering by person type to ensure actors and artists are at the front. // 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 is taking advantage of the fact that they both begin with A
// This should be improved in the future // This should be improved in the future
var people = item.People.OrderBy(i => i.SortOrder ?? int.MaxValue).ThenBy(i => i.Type).ToList(); var people = item.People.OrderBy(i => i.SortOrder ?? int.MaxValue)
.ThenBy(i =>
{
if (i.IsType(PersonType.Actor))
{
return 0;
}
if (i.IsType(PersonType.GuestStar))
{
return 1;
}
if (i.IsType(PersonType.Director))
{
return 2;
}
if (i.IsType(PersonType.Writer))
{
return 3;
}
if (i.IsType(PersonType.Producer))
{
return 4;
}
if (i.IsType(PersonType.Composer))
{
return 4;
}
return 10;
})
.ThenBy(i => i.Name)
.ToList();
// Attach People by transforming them into BaseItemPerson (DTO) // Attach People by transforming them into BaseItemPerson (DTO)
dto.People = new BaseItemPerson[people.Count]; dto.People = new BaseItemPerson[people.Count];

@ -277,19 +277,19 @@ namespace MediaBrowser.ServerApplication
LogManager.RemoveConsoleOutput(); LogManager.RemoveConsoleOutput();
} }
public override Task Init(IProgress<double> progress) public override async Task Init(IProgress<double> progress)
{ {
PerformVersionMigration(); PerformVersionMigration();
return base.Init(progress); await base.Init(progress).ConfigureAwait(false);
MigrateModularConfigurations();
ApplyDefaultMetadataSettings();
} }
private void PerformVersionMigration() private void PerformVersionMigration()
{ {
DeleteDeprecatedModules(); DeleteDeprecatedModules();
MigrateModularConfigurations();
ApplyDefaultMetadataSettings();
} }
private void MigrateModularConfigurations() private void MigrateModularConfigurations()

@ -382,8 +382,9 @@ namespace MediaBrowser.XbmcMetadata.Savers
} }
var writers = item.People var writers = item.People
.Where(i => IsPersonType(i, PersonType.Director)) .Where(i => IsPersonType(i, PersonType.Writer))
.Select(i => i.Name) .Select(i => i.Name)
.Distinct(StringComparer.OrdinalIgnoreCase)
.ToList(); .ToList();
foreach (var person in writers) foreach (var person in writers)
@ -391,11 +392,9 @@ namespace MediaBrowser.XbmcMetadata.Savers
builder.Append("<writer>" + SecurityElement.Escape(person) + "</writer>"); builder.Append("<writer>" + SecurityElement.Escape(person) + "</writer>");
} }
var credits = writers.Distinct(StringComparer.OrdinalIgnoreCase).ToList(); if (writers.Count > 0)
if (credits.Count > 0)
{ {
builder.Append("<credits>" + SecurityElement.Escape(string.Join(" / ", credits.ToArray())) + "</credits>"); builder.Append("<credits>" + SecurityElement.Escape(string.Join(" / ", writers.ToArray())) + "</credits>");
} }
var hasTrailer = item as IHasTrailers; var hasTrailer = item as IHasTrailers;
@ -850,6 +849,11 @@ namespace MediaBrowser.XbmcMetadata.Savers
builder.Append("<role>" + SecurityElement.Escape(person.Role ?? string.Empty) + "</role>"); builder.Append("<role>" + SecurityElement.Escape(person.Role ?? string.Empty) + "</role>");
builder.Append("<type>" + SecurityElement.Escape(person.Type ?? string.Empty) + "</type>"); builder.Append("<type>" + SecurityElement.Escape(person.Type ?? string.Empty) + "</type>");
if (person.SortOrder.HasValue)
{
builder.Append("<sortorder>" + SecurityElement.Escape(person.SortOrder.Value.ToString(UsCulture)) + "</sortorder>");
}
try try
{ {
var personEntity = libraryManager.GetPerson(person.Name); var personEntity = libraryManager.GetPerson(person.Name);

Loading…
Cancel
Save