update nfo image saver

This commit is contained in:
Luke Pulverenti 2017-01-10 15:17:01 -05:00
parent 85cd90d6e6
commit 911e5cb490

View File

@ -846,7 +846,7 @@ namespace MediaBrowser.XbmcMetadata.Savers
AddUserData(item, writer, userManager, userDataRepo, options); AddUserData(item, writer, userManager, userDataRepo, options);
AddActors(people, writer, libraryManager, fileSystem, config); AddActors(people, writer, libraryManager, fileSystem, config, options.SaveImagePathsInNfo);
var folder = item as BoxSet; var folder = item as BoxSet;
if (folder != null) if (folder != null)
@ -974,7 +974,7 @@ namespace MediaBrowser.XbmcMetadata.Savers
writer.WriteEndElement(); writer.WriteEndElement();
} }
private static void AddActors(List<PersonInfo> people, XmlWriter writer, ILibraryManager libraryManager, IFileSystem fileSystem, IServerConfigurationManager config) private static void AddActors(List<PersonInfo> people, XmlWriter writer, ILibraryManager libraryManager, IFileSystem fileSystem, IServerConfigurationManager config, bool saveImagePath)
{ {
var actors = people var actors = people
.Where(i => !IsPersonType(i, PersonType.Director) && !IsPersonType(i, PersonType.Writer)) .Where(i => !IsPersonType(i, PersonType.Director) && !IsPersonType(i, PersonType.Writer))
@ -1004,19 +1004,22 @@ namespace MediaBrowser.XbmcMetadata.Savers
writer.WriteElementString("sortorder", person.SortOrder.Value.ToString(UsCulture)); writer.WriteElementString("sortorder", person.SortOrder.Value.ToString(UsCulture));
} }
try if (saveImagePath)
{ {
var personEntity = libraryManager.GetPerson(person.Name); try
var image = personEntity.GetImageInfo(ImageType.Primary, 0);
if (image != null)
{ {
writer.WriteElementString("thumb", GetImagePathToSave(image, libraryManager, config)); var personEntity = libraryManager.GetPerson(person.Name);
var image = personEntity.GetImageInfo(ImageType.Primary, 0);
if (image != null)
{
writer.WriteElementString("thumb", GetImagePathToSave(image, libraryManager, config));
}
}
catch (Exception)
{
// Already logged in core
} }
}
catch (Exception)
{
// Already logged in core
} }
writer.WriteEndElement(); writer.WriteEndElement();