add movie directors and writers (#219)
This commit is contained in:
@@ -241,7 +241,9 @@ namespace ErsatzTV.Infrastructure.Emby
|
||||
Genres = Optional(item.Genres).Flatten().Map(g => new Genre { Name = g }).ToList(),
|
||||
Tags = Optional(item.Tags).Flatten().Map(t => new Tag { Name = t }).ToList(),
|
||||
Studios = Optional(item.Studios).Flatten().Map(s => new Studio { Name = s.Name }).ToList(),
|
||||
Actors = Optional(item.People).Flatten().Map(r => ProjectToModel(r, dateAdded)).ToList(),
|
||||
Actors = Optional(item.People).Flatten().Collect(r => ProjectToActor(r, dateAdded)).ToList(),
|
||||
Directors = Optional(item.People).Flatten().Collect(r => ProjectToDirector(r)).ToList(),
|
||||
Writers = Optional(item.People).Flatten().Collect(r => ProjectToWriter(r)).ToList(),
|
||||
Artwork = new List<Artwork>()
|
||||
};
|
||||
|
||||
@@ -281,8 +283,13 @@ namespace ErsatzTV.Infrastructure.Emby
|
||||
return metadata;
|
||||
}
|
||||
|
||||
private Actor ProjectToModel(EmbyPersonResponse person, DateTime dateAdded)
|
||||
private Option<Actor> ProjectToActor(EmbyPersonResponse person, DateTime dateAdded)
|
||||
{
|
||||
if (person.Type?.ToLowerInvariant() != "actor")
|
||||
{
|
||||
return None;
|
||||
}
|
||||
|
||||
var actor = new Actor { Name = person.Name, Role = person.Role };
|
||||
if (!string.IsNullOrWhiteSpace(person.Id) && !string.IsNullOrWhiteSpace(person.PrimaryImageTag))
|
||||
{
|
||||
@@ -297,6 +304,26 @@ namespace ErsatzTV.Infrastructure.Emby
|
||||
return actor;
|
||||
}
|
||||
|
||||
private static Option<Director> ProjectToDirector(EmbyPersonResponse person)
|
||||
{
|
||||
if (person.Type?.ToLowerInvariant() != "director")
|
||||
{
|
||||
return None;
|
||||
}
|
||||
|
||||
return new Director { Name = person.Name };
|
||||
}
|
||||
|
||||
private static Option<Writer> ProjectToWriter(EmbyPersonResponse person)
|
||||
{
|
||||
if (person.Type?.ToLowerInvariant() != "writer")
|
||||
{
|
||||
return None;
|
||||
}
|
||||
|
||||
return new Writer { Name = person.Name };
|
||||
}
|
||||
|
||||
private Option<EmbyShow> ProjectToShow(EmbyLibraryItemResponse item)
|
||||
{
|
||||
try
|
||||
@@ -337,7 +364,7 @@ namespace ErsatzTV.Infrastructure.Emby
|
||||
Genres = Optional(item.Genres).Flatten().Map(g => new Genre { Name = g }).ToList(),
|
||||
Tags = Optional(item.Tags).Flatten().Map(t => new Tag { Name = t }).ToList(),
|
||||
Studios = Optional(item.Studios).Flatten().Map(s => new Studio { Name = s.Name }).ToList(),
|
||||
Actors = Optional(item.People).Flatten().Map(r => ProjectToModel(r, dateAdded)).ToList(),
|
||||
Actors = Optional(item.People).Flatten().Collect(r => ProjectToActor(r, dateAdded)).ToList(),
|
||||
Artwork = new List<Artwork>()
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user