Merge pull request #314 from lalmanzar/strip_html

remove CDATA and html tags
This commit is contained in:
Luke 2013-05-26 15:49:28 -07:00
commit a53133c002

View File

@ -1,5 +1,6 @@
using System.Globalization; using System.Globalization;
using System.IO; using System.IO;
using System.Text.RegularExpressions;
using MediaBrowser.Controller.Entities; using MediaBrowser.Controller.Entities;
using MediaBrowser.Model.Entities; using MediaBrowser.Model.Entities;
using MediaBrowser.Model.Logging; using MediaBrowser.Model.Logging;
@ -145,7 +146,14 @@ namespace MediaBrowser.Controller.Providers
case "Overview": case "Overview":
case "Description": case "Description":
item.Overview = reader.ReadInnerXml(); var overview = reader.ReadInnerXml();
const string cdataRegex = @"\<\!\[CDATA\[(?<text>.*)\]\]\>";
if (Regex.IsMatch(overview, cdataRegex))
{
var match = Regex.Match(overview, cdataRegex);
overview = match.Groups["text"].Value;
}
item.Overview = Regex.Replace(overview, @"\<[^\>]*\>", string.Empty);
break; break;
case "TagLine": case "TagLine":