fixes #2324 - [BUG] FFProbe: StartIndex cannot be less than zero

This commit is contained in:
Luke Pulverenti 2016-12-03 14:42:34 -05:00
parent 68772e7d9b
commit 232da3f17b
1 changed files with 7 additions and 1 deletions

View File

@ -188,7 +188,13 @@ namespace MediaBrowser.MediaEncoding.Probing
private void FetchFromItunesInfo(string xml, MediaInfo info)
{
// Make things simpler and strip out the dtd
xml = xml.Substring(xml.IndexOf("<plist", StringComparison.OrdinalIgnoreCase));
var plistIndex = xml.IndexOf("<plist", StringComparison.OrdinalIgnoreCase);
if (plistIndex != -1)
{
xml = xml.Substring(plistIndex);
}
xml = "<?xml version=\"1.0\"?>" + xml;
// <?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\">\n<plist version=\"1.0\">\n<dict>\n\t<key>cast</key>\n\t<array>\n\t\t<dict>\n\t\t\t<key>name</key>\n\t\t\t<string>Blender Foundation</string>\n\t\t</dict>\n\t\t<dict>\n\t\t\t<key>name</key>\n\t\t\t<string>Janus Bager Kristensen</string>\n\t\t</dict>\n\t</array>\n\t<key>directors</key>\n\t<array>\n\t\t<dict>\n\t\t\t<key>name</key>\n\t\t\t<string>Sacha Goedegebure</string>\n\t\t</dict>\n\t</array>\n\t<key>studio</key>\n\t<string>Blender Foundation</string>\n</dict>\n</plist>\n