diff options
| author | Balázs Váradi <netpok@gmail.com> | 2021-02-08 18:56:06 +0100 |
|---|---|---|
| committer | Balázs Váradi <netpok@gmail.com> | 2021-02-08 18:56:06 +0100 |
| commit | 094ffafb249e454f8e71279f8aa0693a17990e1e (patch) | |
| tree | 817f2bc7e9c9cf9ebd36c8528d2c18e660429f62 | |
| parent | b646787ab6cae179e2e31f05bbdfd9201c7d1a69 (diff) | |
Comment and simplify code
| -rw-r--r-- | MediaBrowser.XbmcMetadata/Parsers/EpisodeNfoParser.cs | 24 |
1 files changed, 10 insertions, 14 deletions
diff --git a/MediaBrowser.XbmcMetadata/Parsers/EpisodeNfoParser.cs b/MediaBrowser.XbmcMetadata/Parsers/EpisodeNfoParser.cs index 5922b4f44..3a852384a 100644 --- a/MediaBrowser.XbmcMetadata/Parsers/EpisodeNfoParser.cs +++ b/MediaBrowser.XbmcMetadata/Parsers/EpisodeNfoParser.cs @@ -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 try { + // Extract episode details from the firs episodedetails block using (var stringReader = new StringReader(xml)) using (var reader = XmlReader.Create(stringReader, settings)) { @@ -72,19 +73,14 @@ namespace MediaBrowser.XbmcMetadata.Parsers } } } - } - 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 + // 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) { + xml = xmlFile.Substring(0, index + srch.Length); + xmlFile = xmlFile.Substring(index + srch.Length); + using (var stringReader = new StringReader(xml)) using (var reader = XmlReader.Create(stringReader, settings)) { @@ -104,9 +100,9 @@ namespace MediaBrowser.XbmcMetadata.Parsers } } } - catch (XmlException) - { - } + } + catch (XmlException) + { } } } |
