diff --git a/MediaBrowser.LocalMetadata/Savers/BaseXmlSaver.cs b/MediaBrowser.LocalMetadata/Savers/BaseXmlSaver.cs
index 3a8a4c9f82..97780d0541 100644
--- a/MediaBrowser.LocalMetadata/Savers/BaseXmlSaver.cs
+++ b/MediaBrowser.LocalMetadata/Savers/BaseXmlSaver.cs
@@ -391,40 +391,40 @@ namespace MediaBrowser.LocalMetadata.Savers
}
}
- //var hasTrailers = item as IHasTrailers;
- //if (hasTrailers != null)
- //{
- // if (hasTrailers.RemoteTrailers.Count > 0)
- // {
- // builder.Append("");
-
- // foreach (var trailer in hasTrailers.RemoteTrailers)
- // {
- // builder.Append("" + SecurityElement.Escape(trailer.Url) + "");
- // }
+ var hasTrailers = item as IHasTrailers;
+ if (hasTrailers != null)
+ {
+ if (hasTrailers.RemoteTrailers.Count > 0)
+ {
+ writer.WriteStartElement("Trailers");
- // builder.Append("");
- // }
- //}
+ foreach (var trailer in hasTrailers.RemoteTrailers)
+ {
+ writer.WriteElementString("Trailer", trailer.Url);
+ }
- ////if (hasProductionLocations.ProductionLocations.Count > 0)
- ////{
- //// builder.Append("");
+ writer.WriteEndElement();
+ }
+ }
- //// foreach (var name in hasProductionLocations.ProductionLocations)
- //// {
- //// builder.Append("" + SecurityElement.Escape(name) + "");
- //// }
+ //if (hasProductionLocations.ProductionLocations.Count > 0)
+ //{
+ // builder.Append("");
- //// builder.Append("");
- ////}
+ // foreach (var name in hasProductionLocations.ProductionLocations)
+ // {
+ // builder.Append("" + SecurityElement.Escape(name) + "");
+ // }
- //var hasDisplayOrder = item as IHasDisplayOrder;
- //if (hasDisplayOrder != null && !string.IsNullOrEmpty(hasDisplayOrder.DisplayOrder))
- //{
- // builder.Append("" + SecurityElement.Escape(hasDisplayOrder.DisplayOrder) + "");
+ // builder.Append("");
//}
+ var hasDisplayOrder = item as IHasDisplayOrder;
+ if (hasDisplayOrder != null && !string.IsNullOrEmpty(hasDisplayOrder.DisplayOrder))
+ {
+ writer.WriteElementString("DisplayOrder", hasDisplayOrder.DisplayOrder);
+ }
+
//var hasMetascore = item as IHasMetascore;
//if (hasMetascore != null && hasMetascore.Metascore.HasValue)
//{
@@ -437,19 +437,19 @@ namespace MediaBrowser.LocalMetadata.Savers
// builder.Append("" + SecurityElement.Escape(hasAwards.AwardSummary) + "");
//}
- //var hasBudget = item as IHasBudget;
- //if (hasBudget != null)
- //{
- // if (hasBudget.Budget.HasValue)
- // {
- // builder.Append("" + SecurityElement.Escape(hasBudget.Budget.Value.ToString(UsCulture)) + "");
- // }
+ var hasBudget = item as IHasBudget;
+ if (hasBudget != null)
+ {
+ if (hasBudget.Budget.HasValue)
+ {
+ writer.WriteElementString("Budget", hasBudget.Budget.Value.ToString(UsCulture));
+ }
- // if (hasBudget.Revenue.HasValue)
- // {
- // builder.Append("" + SecurityElement.Escape(hasBudget.Revenue.Value.ToString(UsCulture)) + "");
- // }
- //}
+ if (hasBudget.Revenue.HasValue)
+ {
+ writer.WriteElementString("Revenue", hasBudget.Revenue.Value.ToString(UsCulture));
+ }
+ }
//if (item.CommunityRating.HasValue)
//{
@@ -460,15 +460,15 @@ namespace MediaBrowser.LocalMetadata.Savers
// builder.Append("" + SecurityElement.Escape(item.VoteCount.Value.ToString(UsCulture)) + "");
//}
- //if (item.ProductionYear.HasValue && !(item is Person))
- //{
- // builder.Append("" + SecurityElement.Escape(item.ProductionYear.Value.ToString(UsCulture)) + "");
- //}
+ if (item.ProductionYear.HasValue && !(item is Person))
+ {
+ writer.WriteElementString("ProductionYear", item.ProductionYear.Value.ToString(UsCulture));
+ }
- //if (!string.IsNullOrEmpty(item.HomePageUrl))
- //{
- // builder.Append("" + SecurityElement.Escape(item.HomePageUrl) + "");
- //}
+ if (!string.IsNullOrEmpty(item.HomePageUrl))
+ {
+ writer.WriteElementString("Website", item.HomePageUrl);
+ }
//var hasAspectRatio = item as IHasAspectRatio;
//if (hasAspectRatio != null)
@@ -589,42 +589,42 @@ namespace MediaBrowser.LocalMetadata.Savers
// builder.Append("");
//}
- //var boxset = item as BoxSet;
- //if (boxset != null)
- //{
- // AddLinkedChildren(boxset, builder, "CollectionItems", "CollectionItem");
- //}
+ var boxset = item as BoxSet;
+ if (boxset != null)
+ {
+ AddLinkedChildren(boxset, writer, "CollectionItems", "CollectionItem");
+ }
- //var playlist = item as Playlist;
- //if (playlist != null)
- //{
- // AddLinkedChildren(playlist, builder, "PlaylistItems", "PlaylistItem");
- //}
+ var playlist = item as Playlist;
+ if (playlist != null)
+ {
+ AddLinkedChildren(playlist, writer, "PlaylistItems", "PlaylistItem");
+ }
- //var hasShares = item as IHasShares;
- //if (hasShares != null)
- //{
- // AddShares(hasShares, builder);
- //}
+ var hasShares = item as IHasShares;
+ if (hasShares != null)
+ {
+ AddShares(hasShares, writer);
+ }
AddMediaInfo(item, writer);
}
- public static void AddShares(IHasShares item, StringBuilder builder)
+ public static void AddShares(IHasShares item, XmlWriter writer)
{
- //builder.Append("");
+ writer.WriteStartElement("Shares");
- //foreach (var share in item.Shares)
- //{
- // builder.Append("");
+ foreach (var share in item.Shares)
+ {
+ writer.WriteStartElement("Share");
- // builder.Append("" + SecurityElement.Escape(share.UserId) + "");
- // builder.Append("" + SecurityElement.Escape(share.CanEdit.ToString().ToLower()) + "");
+ writer.WriteElementString("UserId", share.UserId);
+ writer.WriteElementString("CanEdit", share.CanEdit.ToString().ToLower());
- // builder.Append("");
- //}
+ writer.WriteEndElement();
+ }
- //builder.Append("");
+ writer.WriteEndElement();
}
///
@@ -662,30 +662,30 @@ namespace MediaBrowser.LocalMetadata.Savers
}
}
- public static void AddLinkedChildren(Folder item, StringBuilder builder, string pluralNodeName, string singularNodeName)
+ public static void AddLinkedChildren(Folder item, XmlWriter writer, string pluralNodeName, string singularNodeName)
{
- //var items = item.LinkedChildren
- // .Where(i => i.Type == LinkedChildType.Manual)
- // .ToList();
+ var items = item.LinkedChildren
+ .Where(i => i.Type == LinkedChildType.Manual)
+ .ToList();
- //if (items.Count == 0)
- //{
- // return;
- //}
+ if (items.Count == 0)
+ {
+ return;
+ }
- //builder.Append("<" + pluralNodeName + ">");
- //foreach (var link in items)
- //{
- // builder.Append("<" + singularNodeName + ">");
+ writer.WriteStartElement(pluralNodeName);
- // if (!string.IsNullOrWhiteSpace(link.Path))
- // {
- // builder.Append("" + SecurityElement.Escape((link.Path)) + "");
- // }
+ foreach (var link in items)
+ {
+ if (!string.IsNullOrWhiteSpace(link.Path))
+ {
+ writer.WriteStartElement(singularNodeName);
+ writer.WriteElementString("Path", link.Path);
+ writer.WriteEndElement();
+ }
+ }
- // builder.Append("" + singularNodeName + ">");
- //}
- //builder.Append("" + pluralNodeName + ">");
+ writer.WriteEndElement();
}
private static bool IsPersonType(PersonInfo person, string type)