update xml readers

This commit is contained in:
Luke Pulverenti 2016-12-03 16:46:06 -05:00
parent f5467021b0
commit 83ad945015
21 changed files with 168 additions and 168 deletions

View File

@ -129,7 +129,7 @@ namespace Emby.Dlna.Service
reader.Read();
// Loop through each element
while (!reader.EOF)
while (!reader.EOF && reader.ReadState == ReadState.Interactive)
{
if (reader.NodeType == XmlNodeType.Element)
{
@ -166,7 +166,7 @@ namespace Emby.Dlna.Service
reader.Read();
// Loop through each element
while (!reader.EOF)
while (!reader.EOF && reader.ReadState == ReadState.Interactive)
{
if (reader.NodeType == XmlNodeType.Element)
{
@ -197,7 +197,7 @@ namespace Emby.Dlna.Service
reader.Read();
// Loop through each element
while (!reader.EOF)
while (!reader.EOF && reader.ReadState == ReadState.Interactive)
{
if (reader.NodeType == XmlNodeType.Element)
{

View File

@ -4,6 +4,8 @@ using MediaBrowser.Model.Entities;
using MediaBrowser.Naming.Video;
using System;
using System.IO;
using System.Linq;
using MediaBrowser.Controller.Providers;
using MediaBrowser.Model.Logging;
namespace Emby.Server.Implementations.Library.Resolvers
@ -59,7 +61,7 @@ namespace Emby.Server.Implementations.Library.Resolvers
if (child.IsDirectory)
{
if (IsDvdDirectory(filename))
if (IsDvdDirectory(child.FullName, filename, args.DirectoryService))
{
videoInfo = parser.ResolveDirectory(args.Path);
@ -76,7 +78,7 @@ namespace Emby.Server.Implementations.Library.Resolvers
};
break;
}
if (IsBluRayDirectory(filename))
if (IsBluRayDirectory(child.FullName, filename, args.DirectoryService))
{
videoInfo = parser.ResolveDirectory(args.Path);
@ -267,11 +269,14 @@ namespace Emby.Server.Implementations.Library.Resolvers
/// <summary>
/// Determines whether [is DVD directory] [the specified directory name].
/// </summary>
/// <param name="directoryName">Name of the directory.</param>
/// <returns><c>true</c> if [is DVD directory] [the specified directory name]; otherwise, <c>false</c>.</returns>
protected bool IsDvdDirectory(string directoryName)
protected bool IsDvdDirectory(string fullPath, string directoryName, IDirectoryService directoryService)
{
return string.Equals(directoryName, "video_ts", StringComparison.OrdinalIgnoreCase);
if (!string.Equals(directoryName, "video_ts", StringComparison.OrdinalIgnoreCase))
{
return false;
}
return directoryService.GetFiles(fullPath).Any(i => string.Equals(i.Extension, ".vob", StringComparison.OrdinalIgnoreCase));
}
/// <summary>
@ -287,11 +292,14 @@ namespace Emby.Server.Implementations.Library.Resolvers
/// <summary>
/// Determines whether [is blu ray directory] [the specified directory name].
/// </summary>
/// <param name="directoryName">Name of the directory.</param>
/// <returns><c>true</c> if [is blu ray directory] [the specified directory name]; otherwise, <c>false</c>.</returns>
protected bool IsBluRayDirectory(string directoryName)
protected bool IsBluRayDirectory(string fullPath, string directoryName, IDirectoryService directoryService)
{
return string.Equals(directoryName, "bdmv", StringComparison.OrdinalIgnoreCase);
if (!string.Equals(directoryName, "bdmv", StringComparison.OrdinalIgnoreCase))
{
return false;
}
return directoryService.GetFiles(fullPath).Any(i => string.Equals(i.Extension, ".m2ts", StringComparison.OrdinalIgnoreCase));
}
}
}

View File

@ -366,7 +366,7 @@ namespace Emby.Server.Implementations.Library.Resolvers.Movies
if (child.IsDirectory)
{
if (IsDvdDirectory(filename))
if (IsDvdDirectory(child.FullName, filename, directoryService))
{
var movie = new T
{
@ -376,7 +376,7 @@ namespace Emby.Server.Implementations.Library.Resolvers.Movies
Set3DFormat(movie);
return movie;
}
if (IsBluRayDirectory(filename))
if (IsBluRayDirectory(child.FullName, filename, directoryService))
{
var movie = new T
{
@ -446,15 +446,14 @@ namespace Emby.Server.Implementations.Library.Resolvers.Movies
var subfolders = subFileEntries
.Where(e => e.IsDirectory)
.Select(d => d.Name)
.ToList();
if (subfolders.Any(IsDvdDirectory))
if (subfolders.Any(s => IsDvdDirectory(s.FullName, s.Name, directoryService)))
{
videoTypes.Add(VideoType.Dvd);
return true;
}
if (subfolders.Any(IsBluRayDirectory))
if (subfolders.Any(s => IsBluRayDirectory(s.FullName, s.Name, directoryService)))
{
videoTypes.Add(VideoType.BluRay);
return true;

View File

@ -126,7 +126,7 @@ namespace Emby.Server.Implementations.News
reader.MoveToContent();
reader.Read();
while (!reader.EOF)
while (!reader.EOF && reader.ReadState == ReadState.Interactive)
{
if (reader.NodeType == XmlNodeType.Element)
{
@ -162,7 +162,7 @@ namespace Emby.Server.Implementations.News
reader.MoveToContent();
reader.Read();
while (!reader.EOF)
while (!reader.EOF && reader.ReadState == ReadState.Interactive)
{
if (reader.NodeType == XmlNodeType.Element)
{
@ -199,7 +199,7 @@ namespace Emby.Server.Implementations.News
reader.MoveToContent();
reader.Read();
while (!reader.EOF)
while (!reader.EOF && reader.ReadState == ReadState.Interactive)
{
if (reader.NodeType == XmlNodeType.Element)
{

View File

@ -110,9 +110,10 @@ namespace MediaBrowser.LocalMetadata.Parsers
using (var reader = XmlReader.Create(streamReader, settings))
{
reader.MoveToContent();
reader.Read();
// Loop through each element
while (reader.Read())
while (!reader.EOF && reader.ReadState == ReadState.Interactive)
{
cancellationToken.ThrowIfCancellationRequested();
@ -120,6 +121,10 @@ namespace MediaBrowser.LocalMetadata.Parsers
{
FetchDataFromXmlNode(reader, item);
}
else
{
reader.Read();
}
}
}
}
@ -752,12 +757,12 @@ namespace MediaBrowser.LocalMetadata.Parsers
case "Format3D":
{
var val = reader.ReadElementContentAsString();
var video = item as Video;
if (video != null)
{
var val = reader.ReadElementContentAsString();
if (string.Equals("HSBS", val, StringComparison.OrdinalIgnoreCase))
{
video.Video3DFormat = Video3DFormat.HalfSideBySide;
@ -808,8 +813,10 @@ namespace MediaBrowser.LocalMetadata.Parsers
private void FetchFromSharesNode(XmlReader reader, IHasShares item)
{
reader.MoveToContent();
reader.Read();
while (reader.Read())
// Loop through each element
while (!reader.EOF && reader.ReadState == ReadState.Interactive)
{
if (reader.NodeType == XmlNodeType.Element)
{
@ -833,6 +840,10 @@ namespace MediaBrowser.LocalMetadata.Parsers
break;
}
}
else
{
reader.Read();
}
}
}
@ -841,8 +852,10 @@ namespace MediaBrowser.LocalMetadata.Parsers
var share = new Share();
reader.MoveToContent();
reader.Read();
while (reader.Read())
// Loop through each element
while (!reader.EOF && reader.ReadState == ReadState.Interactive)
{
if (reader.NodeType == XmlNodeType.Element)
{
@ -865,6 +878,10 @@ namespace MediaBrowser.LocalMetadata.Parsers
break;
}
}
else
{
reader.Read();
}
}
return share;
@ -873,8 +890,10 @@ namespace MediaBrowser.LocalMetadata.Parsers
private void FetchFromCountriesNode(XmlReader reader, T item)
{
reader.MoveToContent();
reader.Read();
while (reader.Read())
// Loop through each element
while (!reader.EOF && reader.ReadState == ReadState.Interactive)
{
if (reader.NodeType == XmlNodeType.Element)
{
@ -895,6 +914,10 @@ namespace MediaBrowser.LocalMetadata.Parsers
break;
}
}
else
{
reader.Read();
}
}
}
@ -909,7 +932,7 @@ namespace MediaBrowser.LocalMetadata.Parsers
reader.Read();
// Loop through each element
while (!reader.EOF)
while (!reader.EOF && reader.ReadState == ReadState.Interactive)
{
if (reader.NodeType == XmlNodeType.Element)
{
@ -945,8 +968,10 @@ namespace MediaBrowser.LocalMetadata.Parsers
private void FetchFromGenresNode(XmlReader reader, T item)
{
reader.MoveToContent();
reader.Read();
while (reader.Read())
// Loop through each element
while (!reader.EOF && reader.ReadState == ReadState.Interactive)
{
if (reader.NodeType == XmlNodeType.Element)
{
@ -968,14 +993,20 @@ namespace MediaBrowser.LocalMetadata.Parsers
break;
}
}
else
{
reader.Read();
}
}
}
private void FetchFromTagsNode(XmlReader reader, BaseItem item)
{
reader.MoveToContent();
reader.Read();
while (reader.Read())
// Loop through each element
while (!reader.EOF && reader.ReadState == ReadState.Interactive)
{
if (reader.NodeType == XmlNodeType.Element)
{
@ -997,14 +1028,20 @@ namespace MediaBrowser.LocalMetadata.Parsers
break;
}
}
else
{
reader.Read();
}
}
}
private void FetchFromKeywordsNode(XmlReader reader, BaseItem item)
{
reader.MoveToContent();
reader.Read();
while (reader.Read())
// Loop through each element
while (!reader.EOF && reader.ReadState == ReadState.Interactive)
{
if (reader.NodeType == XmlNodeType.Element)
{
@ -1026,6 +1063,10 @@ namespace MediaBrowser.LocalMetadata.Parsers
break;
}
}
else
{
reader.Read();
}
}
}
@ -1037,8 +1078,10 @@ namespace MediaBrowser.LocalMetadata.Parsers
private void FetchDataFromPersonsNode(XmlReader reader, MetadataResult<T> item)
{
reader.MoveToContent();
reader.Read();
while (reader.Read())
// Loop through each element
while (!reader.EOF && reader.ReadState == ReadState.Interactive)
{
if (reader.NodeType == XmlNodeType.Element)
{
@ -1066,14 +1109,20 @@ namespace MediaBrowser.LocalMetadata.Parsers
break;
}
}
else
{
reader.Read();
}
}
}
private void FetchDataFromTrailersNode(XmlReader reader, IHasTrailers item)
{
reader.MoveToContent();
reader.Read();
while (reader.Read())
// Loop through each element
while (!reader.EOF && reader.ReadState == ReadState.Interactive)
{
if (reader.NodeType == XmlNodeType.Element)
{
@ -1095,87 +1144,11 @@ namespace MediaBrowser.LocalMetadata.Parsers
break;
}
}
}
}
protected List<ChapterInfo> FetchChaptersFromXmlNode(BaseItem item, XmlReader reader)
{
using (reader)
{
return GetChaptersFromXmlNode(reader)
.Where(i => i.StartPositionTicks >= 0)
.ToList();
}
}
private IEnumerable<ChapterInfo> GetChaptersFromXmlNode(XmlReader reader)
{
var chapters = new List<ChapterInfo>();
reader.MoveToContent();
while (reader.Read())
{
if (reader.NodeType == XmlNodeType.Element)
else
{
switch (reader.Name)
{
case "Chapter":
{
using (var subtree = reader.ReadSubtree())
{
chapters.Add(GetChapterInfoFromXmlNode(subtree));
}
break;
}
default:
reader.Skip();
break;
}
reader.Read();
}
}
return chapters;
}
private ChapterInfo GetChapterInfoFromXmlNode(XmlReader reader)
{
var chapter = new ChapterInfo();
reader.MoveToContent();
while (reader.Read())
{
if (reader.NodeType == XmlNodeType.Element)
{
switch (reader.Name)
{
case "StartPositionMs":
{
var val = reader.ReadElementContentAsString();
var ms = long.Parse(val, _usCulture);
chapter.StartPositionTicks = TimeSpan.FromMilliseconds(ms).Ticks;
break;
}
case "Name":
{
chapter.Name = reader.ReadElementContentAsString();
break;
}
default:
reader.Skip();
break;
}
}
}
return chapter;
}
/// <summary>
@ -1186,8 +1159,10 @@ namespace MediaBrowser.LocalMetadata.Parsers
private void FetchFromStudiosNode(XmlReader reader, T item)
{
reader.MoveToContent();
reader.Read();
while (reader.Read())
// Loop through each element
while (!reader.EOF && reader.ReadState == ReadState.Interactive)
{
if (reader.NodeType == XmlNodeType.Element)
{
@ -1209,6 +1184,10 @@ namespace MediaBrowser.LocalMetadata.Parsers
break;
}
}
else
{
reader.Read();
}
}
}
@ -1225,8 +1204,10 @@ namespace MediaBrowser.LocalMetadata.Parsers
int? sortOrder = null;
reader.MoveToContent();
reader.Read();
while (reader.Read())
// Loop through each element
while (!reader.EOF && reader.ReadState == ReadState.Interactive)
{
if (reader.NodeType == XmlNodeType.Element)
{
@ -1277,6 +1258,10 @@ namespace MediaBrowser.LocalMetadata.Parsers
break;
}
}
else
{
reader.Read();
}
}
var personInfo = new PersonInfo
@ -1292,14 +1277,16 @@ namespace MediaBrowser.LocalMetadata.Parsers
protected LinkedChild GetLinkedChild(XmlReader reader)
{
reader.MoveToContent();
var linkedItem = new LinkedChild
{
Type = LinkedChildType.Manual
};
while (reader.Read())
reader.MoveToContent();
reader.Read();
// Loop through each element
while (!reader.EOF && reader.ReadState == ReadState.Interactive)
{
if (reader.NodeType == XmlNodeType.Element)
{
@ -1316,6 +1303,10 @@ namespace MediaBrowser.LocalMetadata.Parsers
break;
}
}
else
{
reader.Read();
}
}
// This is valid
@ -1335,7 +1326,7 @@ namespace MediaBrowser.LocalMetadata.Parsers
reader.Read();
// Loop through each element
while (!reader.EOF)
while (!reader.EOF && reader.ReadState == ReadState.Interactive)
{
if (reader.NodeType == XmlNodeType.Element)
{

View File

@ -37,7 +37,7 @@ namespace MediaBrowser.LocalMetadata.Parsers
reader.Read();
// Loop through each element
while (!reader.EOF)
while (!reader.EOF && reader.ReadState == ReadState.Interactive)
{
if (reader.NodeType == XmlNodeType.Element)
{

View File

@ -71,7 +71,7 @@ namespace MediaBrowser.LocalMetadata.Parsers
reader.Read();
// Loop through each element
while (!reader.EOF)
while (!reader.EOF && reader.ReadState == ReadState.Interactive)
{
if (reader.NodeType == XmlNodeType.Element)
{
@ -115,7 +115,7 @@ namespace MediaBrowser.LocalMetadata.Parsers
reader.Read();
// Loop through each element
while (!reader.EOF)
while (!reader.EOF && reader.ReadState == ReadState.Interactive)
{
if (reader.NodeType == XmlNodeType.Element)
{

View File

@ -724,7 +724,7 @@ namespace MediaBrowser.LocalMetadata.Savers
reader.Read();
// Loop through each element
while (!reader.EOF)
while (!reader.EOF && reader.ReadState == ReadState.Interactive)
{
if (reader.NodeType == XmlNodeType.Element)
{

View File

@ -211,7 +211,7 @@ namespace MediaBrowser.MediaEncoding.Probing
reader.Read();
// Loop through each element
while (!reader.EOF)
while (!reader.EOF && reader.ReadState == ReadState.Interactive)
{
if (reader.NodeType == XmlNodeType.Element)
{
@ -253,7 +253,7 @@ namespace MediaBrowser.MediaEncoding.Probing
reader.Read();
// Loop through each element
while (!reader.EOF)
while (!reader.EOF && reader.ReadState == ReadState.Interactive)
{
if (reader.NodeType == XmlNodeType.Element)
{
@ -308,7 +308,7 @@ namespace MediaBrowser.MediaEncoding.Probing
reader.Read();
// Loop through each element
while (!reader.EOF)
while (!reader.EOF && reader.ReadState == ReadState.Interactive)
{
if (reader.NodeType == XmlNodeType.Element)
{
@ -397,7 +397,7 @@ namespace MediaBrowser.MediaEncoding.Probing
reader.Read();
// Loop through each element
while (!reader.EOF)
while (!reader.EOF && reader.ReadState == ReadState.Interactive)
{
if (reader.NodeType == XmlNodeType.Element)
{

View File

@ -266,7 +266,7 @@ namespace MediaBrowser.Providers.Music
reader.Read();
// Loop through each element
while (!reader.EOF)
while (!reader.EOF && reader.ReadState == ReadState.Interactive)
{
if (reader.NodeType == XmlNodeType.Element)
{
@ -303,7 +303,7 @@ namespace MediaBrowser.Providers.Music
reader.Read();
// Loop through each element
while (!reader.EOF)
while (!reader.EOF && reader.ReadState == ReadState.Interactive)
{
if (reader.NodeType == XmlNodeType.Element)
{
@ -352,7 +352,7 @@ namespace MediaBrowser.Providers.Music
// http://stackoverflow.com/questions/2299632/why-does-xmlreader-skip-every-other-element-if-there-is-no-whitespace-separator
// Loop through each element
while (!reader.EOF)
while (!reader.EOF && reader.ReadState == ReadState.Interactive)
{
if (reader.NodeType == XmlNodeType.Element)
{
@ -427,7 +427,7 @@ namespace MediaBrowser.Providers.Music
reader.Read();
// Loop through each element
while (!reader.EOF)
while (!reader.EOF && reader.ReadState == ReadState.Interactive)
{
if (reader.NodeType == XmlNodeType.Element)
{
@ -464,7 +464,7 @@ namespace MediaBrowser.Providers.Music
reader.Read();
// Loop through each element
while (!reader.EOF)
while (!reader.EOF && reader.ReadState == ReadState.Interactive)
{
if (reader.NodeType == XmlNodeType.Element)
{

View File

@ -89,7 +89,7 @@ namespace MediaBrowser.Providers.Music
reader.Read();
// Loop through each element
while (!reader.EOF)
while (!reader.EOF && reader.ReadState == ReadState.Interactive)
{
if (reader.NodeType == XmlNodeType.Element)
{
@ -128,7 +128,7 @@ namespace MediaBrowser.Providers.Music
reader.Read();
// Loop through each element
while (!reader.EOF)
while (!reader.EOF && reader.ReadState == ReadState.Interactive)
{
if (reader.NodeType == XmlNodeType.Element)
{
@ -174,7 +174,7 @@ namespace MediaBrowser.Providers.Music
// http://stackoverflow.com/questions/2299632/why-does-xmlreader-skip-every-other-element-if-there-is-no-whitespace-separator
// Loop through each element
while (!reader.EOF)
while (!reader.EOF && reader.ReadState == ReadState.Interactive)
{
if (reader.NodeType == XmlNodeType.Element)
{

View File

@ -117,7 +117,7 @@ namespace MediaBrowser.Providers.People
reader.Read();
// Loop through each element
while (!reader.EOF)
while (!reader.EOF && reader.ReadState == ReadState.Interactive)
{
cancellationToken.ThrowIfCancellationRequested();
@ -170,7 +170,7 @@ namespace MediaBrowser.Providers.People
reader.Read();
// Loop through each element
while (!reader.EOF)
while (!reader.EOF && reader.ReadState == ReadState.Interactive)
{
if (reader.NodeType == XmlNodeType.Element)
{

View File

@ -524,7 +524,7 @@ namespace MediaBrowser.Providers.TV
reader.Read();
// Loop through each element
while (!reader.EOF)
while (!reader.EOF && reader.ReadState == ReadState.Interactive)
{
if (reader.NodeType == XmlNodeType.Element)
{

View File

@ -86,7 +86,7 @@ namespace MediaBrowser.Providers.TV
reader.Read();
// Loop through each element
while (!reader.EOF)
while (!reader.EOF && reader.ReadState == ReadState.Interactive)
{
if (reader.NodeType == XmlNodeType.Element)
{

View File

@ -343,7 +343,7 @@ namespace MediaBrowser.Providers.TV
reader.Read();
// Loop through each element
while (!reader.EOF)
while (!reader.EOF && reader.ReadState == ReadState.Interactive)
{
if (reader.NodeType == XmlNodeType.Element)
{
@ -398,7 +398,7 @@ namespace MediaBrowser.Providers.TV
reader.Read();
// Loop through each element
while (!reader.EOF)
while (!reader.EOF && reader.ReadState == ReadState.Interactive)
{
if (reader.NodeType == XmlNodeType.Element)
{
@ -452,7 +452,7 @@ namespace MediaBrowser.Providers.TV
reader.Read();
// Loop through each element
while (!reader.EOF)
while (!reader.EOF && reader.ReadState == ReadState.Interactive)
{
cancellationToken.ThrowIfCancellationRequested();
@ -825,7 +825,7 @@ namespace MediaBrowser.Providers.TV
reader.Read();
// Loop through each element
while (!reader.EOF)
while (!reader.EOF && reader.ReadState == ReadState.Interactive)
{
cancellationToken.ThrowIfCancellationRequested();

View File

@ -198,7 +198,7 @@ namespace MediaBrowser.Providers.TV
reader.Read();
// Loop through each element
while (!reader.EOF)
while (!reader.EOF && reader.ReadState == ReadState.Interactive)
{
if (reader.NodeType == XmlNodeType.Element)
{
@ -274,7 +274,7 @@ namespace MediaBrowser.Providers.TV
reader.Read();
// Loop through each element
while (!reader.EOF)
while (!reader.EOF && reader.ReadState == ReadState.Interactive)
{
if (reader.NodeType == XmlNodeType.Element)
{

View File

@ -129,7 +129,7 @@ namespace MediaBrowser.Providers.TV
reader.Read();
// Loop through each element
while (!reader.EOF)
while (!reader.EOF && reader.ReadState == ReadState.Interactive)
{
cancellationToken.ThrowIfCancellationRequested();
@ -204,7 +204,7 @@ namespace MediaBrowser.Providers.TV
reader.Read();
// Loop through each element
while (!reader.EOF)
while (!reader.EOF && reader.ReadState == ReadState.Interactive)
{
if (reader.NodeType == XmlNodeType.Element)
{

View File

@ -116,7 +116,7 @@ namespace MediaBrowser.Providers.TV
reader.Read();
// Loop through each element
while (!reader.EOF)
while (!reader.EOF && reader.ReadState == ReadState.Interactive)
{
cancellationToken.ThrowIfCancellationRequested();
@ -190,7 +190,7 @@ namespace MediaBrowser.Providers.TV
reader.Read();
// Loop through each element
while (!reader.EOF)
while (!reader.EOF && reader.ReadState == ReadState.Interactive)
{
if (reader.NodeType == XmlNodeType.Element)
{

View File

@ -306,7 +306,7 @@ namespace MediaBrowser.Providers.TV
reader.Read();
// Loop through each element
while (!reader.EOF)
while (!reader.EOF && reader.ReadState == ReadState.Interactive)
{
if (reader.NodeType == XmlNodeType.Element)
{
@ -342,7 +342,7 @@ namespace MediaBrowser.Providers.TV
reader.Read();
// Loop through each element
while (!reader.EOF)
while (!reader.EOF && reader.ReadState == ReadState.Interactive)
{
if (reader.NodeType == XmlNodeType.Element)
{
@ -549,7 +549,7 @@ namespace MediaBrowser.Providers.TV
reader.Read();
// Loop through each element
while (!reader.EOF)
while (!reader.EOF && reader.ReadState == ReadState.Interactive)
{
cancellationToken.ThrowIfCancellationRequested();
@ -607,7 +607,7 @@ namespace MediaBrowser.Providers.TV
reader.Read();
// Loop through each element
while (!reader.EOF)
while (!reader.EOF && reader.ReadState == ReadState.Interactive)
{
if (reader.NodeType == XmlNodeType.Element)
{
@ -789,7 +789,7 @@ namespace MediaBrowser.Providers.TV
reader.Read();
// Loop through each element
while (!reader.EOF)
while (!reader.EOF && reader.ReadState == ReadState.Interactive)
{
cancellationToken.ThrowIfCancellationRequested();
@ -849,7 +849,7 @@ namespace MediaBrowser.Providers.TV
reader.Read();
// Loop through each element
while (!reader.EOF)
while (!reader.EOF && reader.ReadState == ReadState.Interactive)
{
cancellationToken.ThrowIfCancellationRequested();
@ -934,7 +934,7 @@ namespace MediaBrowser.Providers.TV
reader.Read();
// Loop through each element
while (!reader.EOF)
while (!reader.EOF && reader.ReadState == ReadState.Interactive)
{
if (reader.NodeType == XmlNodeType.Element)
{
@ -978,7 +978,7 @@ namespace MediaBrowser.Providers.TV
reader.Read();
// Loop through each element
while (!reader.EOF)
while (!reader.EOF && reader.ReadState == ReadState.Interactive)
{
if (reader.NodeType == XmlNodeType.Element)
{
@ -1056,7 +1056,7 @@ namespace MediaBrowser.Providers.TV
reader.Read();
// Loop through each element
while (!reader.EOF)
while (!reader.EOF && reader.ReadState == ReadState.Interactive)
{
cancellationToken.ThrowIfCancellationRequested();
@ -1315,7 +1315,7 @@ namespace MediaBrowser.Providers.TV
reader.Read();
// Loop through each element
while (!reader.EOF)
while (!reader.EOF && reader.ReadState == ReadState.Interactive)
{
if (reader.NodeType == XmlNodeType.Element)
{
@ -1366,7 +1366,7 @@ namespace MediaBrowser.Providers.TV
reader.Read();
// Loop through each element
while (!reader.EOF)
while (!reader.EOF && reader.ReadState == ReadState.Interactive)
{
if (reader.NodeType == XmlNodeType.Element)
{

View File

@ -123,7 +123,7 @@ namespace MediaBrowser.XbmcMetadata.Parsers
reader.Read();
// Loop through each element
while (!reader.EOF)
while (!reader.EOF && reader.ReadState == ReadState.Interactive)
{
cancellationToken.ThrowIfCancellationRequested();
@ -203,7 +203,7 @@ namespace MediaBrowser.XbmcMetadata.Parsers
reader.Read();
// Loop through each element
while (!reader.EOF)
while (!reader.EOF && reader.ReadState == ReadState.Interactive)
{
cancellationToken.ThrowIfCancellationRequested();
@ -607,7 +607,8 @@ namespace MediaBrowser.XbmcMetadata.Parsers
case "director":
{
foreach (var p in SplitNames(reader.ReadElementContentAsString()).Select(v => new PersonInfo { Name = v.Trim(), Type = PersonType.Director }))
var val = reader.ReadElementContentAsString();
foreach (var p in SplitNames(val).Select(v => new PersonInfo { Name = v.Trim(), Type = PersonType.Director }))
{
if (string.IsNullOrWhiteSpace(p.Name))
{
@ -640,7 +641,8 @@ namespace MediaBrowser.XbmcMetadata.Parsers
case "writer":
{
foreach (var p in SplitNames(reader.ReadElementContentAsString()).Select(v => new PersonInfo { Name = v.Trim(), Type = PersonType.Writer }))
var val = reader.ReadElementContentAsString();
foreach (var p in SplitNames(val).Select(v => new PersonInfo { Name = v.Trim(), Type = PersonType.Writer }))
{
if (string.IsNullOrWhiteSpace(p.Name))
{
@ -957,7 +959,7 @@ namespace MediaBrowser.XbmcMetadata.Parsers
reader.Read();
// Loop through each element
while (!reader.EOF)
while (!reader.EOF && reader.ReadState == ReadState.Interactive)
{
if (reader.NodeType == XmlNodeType.Element)
{
@ -996,7 +998,7 @@ namespace MediaBrowser.XbmcMetadata.Parsers
reader.Read();
// Loop through each element
while (!reader.EOF)
while (!reader.EOF && reader.ReadState == ReadState.Interactive)
{
if (reader.NodeType == XmlNodeType.Element)
{
@ -1029,7 +1031,7 @@ namespace MediaBrowser.XbmcMetadata.Parsers
reader.Read();
// Loop through each element
while (!reader.EOF)
while (!reader.EOF && reader.ReadState == ReadState.Interactive)
{
if (reader.NodeType == XmlNodeType.Element)
{
@ -1062,7 +1064,7 @@ namespace MediaBrowser.XbmcMetadata.Parsers
reader.Read();
// Loop through each element
while (!reader.EOF)
while (!reader.EOF && reader.ReadState == ReadState.Interactive)
{
if (reader.NodeType == XmlNodeType.Element)
{
@ -1128,7 +1130,7 @@ namespace MediaBrowser.XbmcMetadata.Parsers
reader.Read();
// Loop through each element
while (!reader.EOF)
while (!reader.EOF && reader.ReadState == ReadState.Interactive)
{
if (reader.NodeType == XmlNodeType.Element)
{

View File

@ -1066,7 +1066,7 @@ namespace MediaBrowser.XbmcMetadata.Savers
reader.Read();
// Loop through each element
while (!reader.EOF)
while (!reader.EOF && reader.ReadState == ReadState.Interactive)
{
if (reader.NodeType == XmlNodeType.Element)
{