Get IndexNumberEnd from nfo
This commit is contained in:
parent
f8283d8c20
commit
b646787ab6
|
@ -35,14 +35,17 @@ namespace MediaBrowser.XbmcMetadata.Parsers
|
||||||
{
|
{
|
||||||
item.ResetPeople();
|
item.ResetPeople();
|
||||||
|
|
||||||
var xml = streamReader.ReadToEnd();
|
var xmlFile = streamReader.ReadToEnd();
|
||||||
|
|
||||||
var srch = "</episodedetails>";
|
var srch = "</episodedetails>";
|
||||||
var index = xml.IndexOf(srch, StringComparison.OrdinalIgnoreCase);
|
var index = xmlFile.IndexOf(srch, StringComparison.OrdinalIgnoreCase);
|
||||||
|
|
||||||
|
var xml = xmlFile;
|
||||||
|
|
||||||
if (index != -1)
|
if (index != -1)
|
||||||
{
|
{
|
||||||
xml = xml.Substring(0, index + srch.Length);
|
xml = xmlFile.Substring(0, index + srch.Length);
|
||||||
|
xmlFile = xmlFile.Substring(index + srch.Length);
|
||||||
}
|
}
|
||||||
|
|
||||||
// These are not going to be valid xml so no sense in causing the provider to fail and spamming the log with exceptions
|
// These are not going to be valid xml so no sense in causing the provider to fail and spamming the log with exceptions
|
||||||
|
@ -73,6 +76,38 @@ namespace MediaBrowser.XbmcMetadata.Parsers
|
||||||
catch (XmlException)
|
catch (XmlException)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
while ((index = xmlFile.IndexOf(srch, StringComparison.OrdinalIgnoreCase)) != -1)
|
||||||
|
{
|
||||||
|
xml = xmlFile.Substring(0, index + srch.Length);
|
||||||
|
xmlFile = xmlFile.Substring(index + srch.Length);
|
||||||
|
|
||||||
|
// These are not going to be valid xml so no sense in causing the provider to fail and spamming the log with exceptions
|
||||||
|
try
|
||||||
|
{
|
||||||
|
using (var stringReader = new StringReader(xml))
|
||||||
|
using (var reader = XmlReader.Create(stringReader, settings))
|
||||||
|
{
|
||||||
|
reader.MoveToContent();
|
||||||
|
|
||||||
|
if (reader.ReadToDescendant("episode"))
|
||||||
|
{
|
||||||
|
var number = reader.ReadElementContentAsString();
|
||||||
|
|
||||||
|
if (!string.IsNullOrWhiteSpace(number))
|
||||||
|
{
|
||||||
|
if (int.TryParse(number, out var num))
|
||||||
|
{
|
||||||
|
item.Item.IndexNumberEnd = Math.Max(num, item.Item.IndexNumberEnd ?? num);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (XmlException)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user