Comment and simplify code

This commit is contained in:
Balázs Váradi 2021-02-08 18:56:06 +01:00
parent b646787ab6
commit 094ffafb24
1 changed files with 10 additions and 14 deletions

View File

@ -51,6 +51,7 @@ namespace MediaBrowser.XbmcMetadata.Parsers
// 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
try try
{ {
// Extract episode details from the firs episodedetails block
using (var stringReader = new StringReader(xml)) using (var stringReader = new StringReader(xml))
using (var reader = XmlReader.Create(stringReader, settings)) using (var reader = XmlReader.Create(stringReader, settings))
{ {
@ -72,19 +73,14 @@ namespace MediaBrowser.XbmcMetadata.Parsers
} }
} }
} }
}
catch (XmlException)
{
}
// Extract the last episode number from nfo
// This is needed because XBMC metadata uses multiple episodedetails blocks instead of episodenumberend tag
while ((index = xmlFile.IndexOf(srch, StringComparison.OrdinalIgnoreCase)) != -1) while ((index = xmlFile.IndexOf(srch, StringComparison.OrdinalIgnoreCase)) != -1)
{ {
xml = xmlFile.Substring(0, index + srch.Length); xml = xmlFile.Substring(0, index + srch.Length);
xmlFile = xmlFile.Substring(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 stringReader = new StringReader(xml))
using (var reader = XmlReader.Create(stringReader, settings)) using (var reader = XmlReader.Create(stringReader, settings))
{ {
@ -104,12 +100,12 @@ namespace MediaBrowser.XbmcMetadata.Parsers
} }
} }
} }
}
catch (XmlException) catch (XmlException)
{ {
} }
} }
} }
}
/// <inheritdoc /> /// <inheritdoc />
protected override void FetchDataFromXmlNode(XmlReader reader, MetadataResult<Episode> itemResult) protected override void FetchDataFromXmlNode(XmlReader reader, MetadataResult<Episode> itemResult)