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