update BaseXmlSaver

This commit is contained in:
Luke Pulverenti 2016-11-01 11:30:15 -04:00
parent 7036901a9b
commit 86de351e23

View File

@ -407,17 +407,17 @@ namespace MediaBrowser.LocalMetadata.Savers
} }
} }
//if (hasProductionLocations.ProductionLocations.Count > 0) if (item.ProductionLocations.Count > 0)
//{ {
// builder.Append("<Countries>"); writer.WriteStartElement("Countries");
// foreach (var name in hasProductionLocations.ProductionLocations) foreach (var name in item.ProductionLocations)
// { {
// builder.Append("<Country>" + SecurityElement.Escape(name) + "</Country>"); writer.WriteElementString("Country", name);
// } }
// builder.Append("</Countries>"); writer.WriteEndElement();
//} }
var hasDisplayOrder = item as IHasDisplayOrder; var hasDisplayOrder = item as IHasDisplayOrder;
if (hasDisplayOrder != null && !string.IsNullOrEmpty(hasDisplayOrder.DisplayOrder)) if (hasDisplayOrder != null && !string.IsNullOrEmpty(hasDisplayOrder.DisplayOrder))
@ -425,17 +425,17 @@ namespace MediaBrowser.LocalMetadata.Savers
writer.WriteElementString("DisplayOrder", hasDisplayOrder.DisplayOrder); writer.WriteElementString("DisplayOrder", hasDisplayOrder.DisplayOrder);
} }
//var hasMetascore = item as IHasMetascore; var hasMetascore = item as IHasMetascore;
//if (hasMetascore != null && hasMetascore.Metascore.HasValue) if (hasMetascore != null && hasMetascore.Metascore.HasValue)
//{ {
// builder.Append("<Metascore>" + SecurityElement.Escape(hasMetascore.Metascore.Value.ToString(UsCulture)) + "</Metascore>"); writer.WriteElementString("Metascore", hasMetascore.Metascore.Value.ToString(UsCulture));
//} }
//var hasAwards = item as IHasAwards; var hasAwards = item as IHasAwards;
//if (hasAwards != null && !string.IsNullOrEmpty(hasAwards.AwardSummary)) if (hasAwards != null && !string.IsNullOrEmpty(hasAwards.AwardSummary))
//{ {
// builder.Append("<AwardSummary>" + SecurityElement.Escape(hasAwards.AwardSummary) + "</AwardSummary>"); writer.WriteElementString("AwardSummary", hasAwards.AwardSummary);
//} }
var hasBudget = item as IHasBudget; var hasBudget = item as IHasBudget;
if (hasBudget != null) if (hasBudget != null)
@ -451,14 +451,14 @@ namespace MediaBrowser.LocalMetadata.Savers
} }
} }
//if (item.CommunityRating.HasValue) if (item.CommunityRating.HasValue)
//{ {
// builder.Append("<Rating>" + SecurityElement.Escape(item.CommunityRating.Value.ToString(UsCulture)) + "</Rating>"); writer.WriteElementString("Rating", item.CommunityRating.Value.ToString(UsCulture));
//} }
//if (item.VoteCount.HasValue) if (item.VoteCount.HasValue)
//{ {
// builder.Append("<VoteCount>" + SecurityElement.Escape(item.VoteCount.Value.ToString(UsCulture)) + "</VoteCount>"); writer.WriteElementString("VoteCount", item.VoteCount.Value.ToString(UsCulture));
//} }
if (item.ProductionYear.HasValue && !(item is Person)) if (item.ProductionYear.HasValue && !(item is Person))
{ {
@ -470,76 +470,76 @@ namespace MediaBrowser.LocalMetadata.Savers
writer.WriteElementString("Website", item.HomePageUrl); writer.WriteElementString("Website", item.HomePageUrl);
} }
//var hasAspectRatio = item as IHasAspectRatio; var hasAspectRatio = item as IHasAspectRatio;
//if (hasAspectRatio != null) if (hasAspectRatio != null)
//{ {
// if (!string.IsNullOrEmpty(hasAspectRatio.AspectRatio)) if (!string.IsNullOrEmpty(hasAspectRatio.AspectRatio))
// { {
// builder.Append("<AspectRatio>" + SecurityElement.Escape(hasAspectRatio.AspectRatio) + "</AspectRatio>"); writer.WriteElementString("AspectRatio", hasAspectRatio.AspectRatio);
// } }
//} }
//if (!string.IsNullOrEmpty(item.PreferredMetadataLanguage)) if (!string.IsNullOrEmpty(item.PreferredMetadataLanguage))
//{ {
// builder.Append("<Language>" + SecurityElement.Escape(item.PreferredMetadataLanguage) + "</Language>"); writer.WriteElementString("Language", item.PreferredMetadataLanguage);
//} }
//if (!string.IsNullOrEmpty(item.PreferredMetadataCountryCode)) if (!string.IsNullOrEmpty(item.PreferredMetadataCountryCode))
//{ {
// builder.Append("<CountryCode>" + SecurityElement.Escape(item.PreferredMetadataCountryCode) + "</CountryCode>"); writer.WriteElementString("CountryCode", item.PreferredMetadataCountryCode);
//} }
//// Use original runtime here, actual file runtime later in MediaInfo // Use original runtime here, actual file runtime later in MediaInfo
//var runTimeTicks = item.RunTimeTicks; var runTimeTicks = item.RunTimeTicks;
//if (runTimeTicks.HasValue) if (runTimeTicks.HasValue)
//{ {
// var timespan = TimeSpan.FromTicks(runTimeTicks.Value); var timespan = TimeSpan.FromTicks(runTimeTicks.Value);
// builder.Append("<RunningTime>" + Convert.ToInt32(timespan.TotalMinutes).ToString(UsCulture) + "</RunningTime>"); writer.WriteElementString("RunningTime", Convert.ToInt32(timespan.TotalMinutes).ToString(UsCulture));
//} }
//if (item.ProviderIds != null) if (item.ProviderIds != null)
//{ {
// foreach (var providerKey in item.ProviderIds.Keys) foreach (var providerKey in item.ProviderIds.Keys)
// { {
// var providerId = item.ProviderIds[providerKey]; var providerId = item.ProviderIds[providerKey];
// if (!string.IsNullOrEmpty(providerId)) if (!string.IsNullOrEmpty(providerId))
// { {
// builder.Append(string.Format("<{0}>{1}</{0}>", providerKey + "Id", SecurityElement.Escape(providerId))); writer.WriteElementString(providerKey + "Id", providerId);
// } }
// } }
//} }
//if (!string.IsNullOrWhiteSpace(item.Tagline)) if (!string.IsNullOrWhiteSpace(item.Tagline))
//{ {
// builder.Append("<Taglines>"); writer.WriteStartElement("Taglines");
// builder.Append("<Tagline>" + SecurityElement.Escape(item.Tagline) + "</Tagline>"); writer.WriteElementString("Tagline", item.Tagline);
// builder.Append("</Taglines>"); writer.WriteEndElement();
//} }
//if (item.Genres.Count > 0) if (item.Genres.Count > 0)
//{ {
// builder.Append("<Genres>"); writer.WriteStartElement("Genres");
// foreach (var genre in item.Genres) foreach (var genre in item.Genres)
// { {
// builder.Append("<Genre>" + SecurityElement.Escape(genre) + "</Genre>"); writer.WriteElementString("Genre", genre);
// } }
// builder.Append("</Genres>"); writer.WriteEndElement();
//} }
//if (item.Studios.Count > 0) if (item.Studios.Count > 0)
//{ {
// builder.Append("<Studios>"); writer.WriteStartElement("Studios");
// foreach (var studio in item.Studios) foreach (var studio in item.Studios)
// { {
// builder.Append("<Studio>" + SecurityElement.Escape(studio) + "</Studio>"); writer.WriteElementString("Studio", studio);
// } }
// builder.Append("</Studios>"); writer.WriteEndElement();
//} }
if (item.Tags.Count > 0) if (item.Tags.Count > 0)
{ {
@ -565,29 +565,29 @@ namespace MediaBrowser.LocalMetadata.Savers
writer.WriteEndElement(); writer.WriteEndElement();
} }
//var people = libraryManager.GetPeople(item); var people = libraryManager.GetPeople(item);
//if (people.Count > 0) if (people.Count > 0)
//{ {
// builder.Append("<Persons>"); writer.WriteStartElement("Persons");
// foreach (var person in people) foreach (var person in people)
// { {
// builder.Append("<Person>"); writer.WriteStartElement("Person");
// builder.Append("<Name>" + SecurityElement.Escape(person.Name) + "</Name>"); writer.WriteElementString("Name", person.Name);
// builder.Append("<Type>" + SecurityElement.Escape(person.Type) + "</Type>"); writer.WriteElementString("Type", person.Type);
// builder.Append("<Role>" + SecurityElement.Escape(person.Role) + "</Role>"); writer.WriteElementString("Role", person.Role);
// if (person.SortOrder.HasValue) if (person.SortOrder.HasValue)
// { {
// builder.Append("<SortOrder>" + SecurityElement.Escape(person.SortOrder.Value.ToString(UsCulture)) + "</SortOrder>"); writer.WriteElementString("SortOrder", person.SortOrder.Value.ToString(UsCulture));
// } }
// builder.Append("</Person>"); writer.WriteEndElement();
// } }
// builder.Append("</Persons>"); writer.WriteEndElement();
//} }
var boxset = item as BoxSet; var boxset = item as BoxSet;
if (boxset != null) if (boxset != null)