|
|
@ -47,12 +47,22 @@ namespace MediaBrowser.Providers.TV
|
|
|
|
{
|
|
|
|
{
|
|
|
|
var list = new List<RemoteSearchResult>();
|
|
|
|
var list = new List<RemoteSearchResult>();
|
|
|
|
|
|
|
|
|
|
|
|
if (TvdbSeriesProvider.IsValidSeries(searchInfo.SeriesProviderIds) && searchInfo.IndexNumber.HasValue)
|
|
|
|
// The search query must either provide an episode number or date
|
|
|
|
|
|
|
|
if (!searchInfo.IndexNumber.HasValue && !searchInfo.PremiereDate.HasValue)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
return list;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (TvdbSeriesProvider.IsValidSeries(searchInfo.SeriesProviderIds))
|
|
|
|
{
|
|
|
|
{
|
|
|
|
var seriesDataPath = TvdbSeriesProvider.GetSeriesDataPath(_config.ApplicationPaths, searchInfo.SeriesProviderIds);
|
|
|
|
var seriesDataPath = TvdbSeriesProvider.GetSeriesDataPath(_config.ApplicationPaths, searchInfo.SeriesProviderIds);
|
|
|
|
|
|
|
|
|
|
|
|
var searchNumbers = new EpisodeNumbers();
|
|
|
|
var searchNumbers = new EpisodeNumbers();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (searchInfo.IndexNumber.HasValue) {
|
|
|
|
searchNumbers.EpisodeNumber = searchInfo.IndexNumber.Value;
|
|
|
|
searchNumbers.EpisodeNumber = searchInfo.IndexNumber.Value;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
searchNumbers.SeasonNumber = searchInfo.ParentIndexNumber;
|
|
|
|
searchNumbers.SeasonNumber = searchInfo.ParentIndexNumber;
|
|
|
|
searchNumbers.EpisodeNumberEnd = searchInfo.IndexNumberEnd ?? searchNumbers.EpisodeNumber;
|
|
|
|
searchNumbers.EpisodeNumberEnd = searchInfo.IndexNumberEnd ?? searchNumbers.EpisodeNumber;
|
|
|
|
|
|
|
|
|
|
|
@ -97,47 +107,17 @@ namespace MediaBrowser.Providers.TV
|
|
|
|
|
|
|
|
|
|
|
|
public async Task<MetadataResult<Episode>> GetMetadata(EpisodeInfo searchInfo, CancellationToken cancellationToken)
|
|
|
|
public async Task<MetadataResult<Episode>> GetMetadata(EpisodeInfo searchInfo, CancellationToken cancellationToken)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
var identity = Identity.ParseIdentity(searchInfo.GetProviderId(FullIdKey));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (identity == null)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
await Identify(searchInfo).ConfigureAwait(false);
|
|
|
|
|
|
|
|
identity = Identity.ParseIdentity(searchInfo.GetProviderId(FullIdKey));
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var result = new MetadataResult<Episode>();
|
|
|
|
var result = new MetadataResult<Episode>();
|
|
|
|
|
|
|
|
|
|
|
|
if (identity != null)
|
|
|
|
if (TvdbSeriesProvider.IsValidSeries(searchInfo.SeriesProviderIds) &&
|
|
|
|
{
|
|
|
|
(searchInfo.IndexNumber.HasValue || searchInfo.PremiereDate.HasValue))
|
|
|
|
var seriesProviderIds = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase);
|
|
|
|
|
|
|
|
seriesProviderIds[MetadataProviders.Tvdb.ToString()] = identity.Value.SeriesId;
|
|
|
|
|
|
|
|
var seriesDataPath = TvdbSeriesProvider.GetSeriesDataPath(_config.ApplicationPaths, seriesProviderIds);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var searchNumbers = new EpisodeNumbers();
|
|
|
|
|
|
|
|
searchNumbers.EpisodeNumber = identity.Value.EpisodeNumber;
|
|
|
|
|
|
|
|
var seasonOffset = TvdbSeriesProvider.GetSeriesOffset(searchInfo.SeriesProviderIds) ?? 0;
|
|
|
|
|
|
|
|
searchNumbers.SeasonNumber = identity.Value.SeasonIndex + seasonOffset;
|
|
|
|
|
|
|
|
searchNumbers.EpisodeNumberEnd = identity.Value.EpisodeNumberEnd ?? searchNumbers.EpisodeNumber;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
try
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
result = FetchEpisodeData(searchInfo, searchNumbers, seriesDataPath, cancellationToken);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
catch (FileNotFoundException)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
// Don't fail the provider because this will just keep on going and going.
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
catch (DirectoryNotFoundException)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
// Don't fail the provider because this will just keep on going and going.
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else if (TvdbSeriesProvider.IsValidSeries(searchInfo.SeriesProviderIds) && searchInfo.IndexNumber.HasValue)
|
|
|
|
|
|
|
|
{
|
|
|
|
{
|
|
|
|
var seriesDataPath = TvdbSeriesProvider.GetSeriesDataPath(_config.ApplicationPaths, searchInfo.SeriesProviderIds);
|
|
|
|
var seriesDataPath = TvdbSeriesProvider.GetSeriesDataPath(_config.ApplicationPaths, searchInfo.SeriesProviderIds);
|
|
|
|
|
|
|
|
|
|
|
|
var searchNumbers = new EpisodeNumbers();
|
|
|
|
var searchNumbers = new EpisodeNumbers();
|
|
|
|
|
|
|
|
if (searchInfo.IndexNumber.HasValue) {
|
|
|
|
searchNumbers.EpisodeNumber = searchInfo.IndexNumber.Value;
|
|
|
|
searchNumbers.EpisodeNumber = searchInfo.IndexNumber.Value;
|
|
|
|
|
|
|
|
}
|
|
|
|
searchNumbers.SeasonNumber = searchInfo.ParentIndexNumber;
|
|
|
|
searchNumbers.SeasonNumber = searchInfo.ParentIndexNumber;
|
|
|
|
searchNumbers.EpisodeNumberEnd = searchInfo.IndexNumberEnd ?? searchNumbers.EpisodeNumber;
|
|
|
|
searchNumbers.EpisodeNumberEnd = searchInfo.IndexNumberEnd ?? searchNumbers.EpisodeNumber;
|
|
|
|
|
|
|
|
|
|
|
@ -176,11 +156,9 @@ namespace MediaBrowser.Providers.TV
|
|
|
|
if (series != null && TvdbSeriesProvider.IsValidSeries(series.ProviderIds))
|
|
|
|
if (series != null && TvdbSeriesProvider.IsValidSeries(series.ProviderIds))
|
|
|
|
{
|
|
|
|
{
|
|
|
|
// Process images
|
|
|
|
// Process images
|
|
|
|
var seriesDataPath = TvdbSeriesProvider.GetSeriesDataPath(_config.ApplicationPaths, series.ProviderIds);
|
|
|
|
var seriesXmlPath = TvdbSeriesProvider.Current.GetSeriesXmlPath(series.ProviderIds, series.GetPreferredMetadataLanguage());
|
|
|
|
|
|
|
|
|
|
|
|
var files = GetEpisodeXmlFiles(episode.ParentIndexNumber, episode.IndexNumber, episode.IndexNumberEnd, seriesDataPath);
|
|
|
|
return _fileSystem.GetLastWriteTimeUtc(seriesXmlPath) > date;
|
|
|
|
|
|
|
|
|
|
|
|
return files.Any(i => _fileSystem.GetLastWriteTimeUtc(i) > date);
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return false;
|
|
|
|
return false;
|
|
|
@ -194,7 +172,85 @@ namespace MediaBrowser.Providers.TV
|
|
|
|
/// <param name="endingEpisodeNumber">The ending episode number.</param>
|
|
|
|
/// <param name="endingEpisodeNumber">The ending episode number.</param>
|
|
|
|
/// <param name="seriesDataPath">The series data path.</param>
|
|
|
|
/// <param name="seriesDataPath">The series data path.</param>
|
|
|
|
/// <returns>List{FileInfo}.</returns>
|
|
|
|
/// <returns>List{FileInfo}.</returns>
|
|
|
|
internal List<FileSystemMetadata> GetEpisodeXmlFiles(int? seasonNumber, int? episodeNumber, int? endingEpisodeNumber, string seriesDataPath)
|
|
|
|
internal List<XmlReader> GetEpisodeXmlNodes(string seriesDataPath, EpisodeInfo searchInfo)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
var seriesXmlPath = TvdbSeriesProvider.Current.GetSeriesXmlPath (searchInfo.SeriesProviderIds, searchInfo.MetadataLanguage);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
try
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
return GetXmlNodes(seriesXmlPath, searchInfo);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
catch (DirectoryNotFoundException)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
return new List<XmlReader> ();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
catch (FileNotFoundException)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
return new List<XmlReader> ();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private class EpisodeNumbers
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
public int EpisodeNumber;
|
|
|
|
|
|
|
|
public int? SeasonNumber;
|
|
|
|
|
|
|
|
public int EpisodeNumberEnd;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
|
|
/// Fetches the episode data.
|
|
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
|
|
/// <param name="id">The identifier.</param>
|
|
|
|
|
|
|
|
/// <param name="searchNumbers">The search numbers.</param>
|
|
|
|
|
|
|
|
/// <param name="seriesDataPath">The series data path.</param>
|
|
|
|
|
|
|
|
/// <param name="cancellationToken">The cancellation token.</param>
|
|
|
|
|
|
|
|
/// <returns>Task{System.Boolean}.</returns>
|
|
|
|
|
|
|
|
private MetadataResult<Episode> FetchEpisodeData(EpisodeInfo id, EpisodeNumbers searchNumbers, string seriesDataPath, CancellationToken cancellationToken)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
var result = new MetadataResult<Episode>()
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
Item = new Episode
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
IndexNumber = id.IndexNumber,
|
|
|
|
|
|
|
|
ParentIndexNumber = id.ParentIndexNumber,
|
|
|
|
|
|
|
|
IndexNumberEnd = id.IndexNumberEnd
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var xmlNodes = GetEpisodeXmlNodes (seriesDataPath, id);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (xmlNodes.Count > 0) {
|
|
|
|
|
|
|
|
FetchMainEpisodeInfo(result, xmlNodes[0], cancellationToken);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
result.HasMetadata = true;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
foreach (var node in xmlNodes.Skip(1)) {
|
|
|
|
|
|
|
|
FetchAdditionalPartInfo(result, node, cancellationToken);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return result;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private List<XmlReader> GetXmlNodes(string xmlFile, EpisodeInfo searchInfo)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
var list = new List<XmlReader> ();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (searchInfo.IndexNumber.HasValue)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
var files = GetEpisodeXmlFiles (searchInfo.ParentIndexNumber, searchInfo.IndexNumber, searchInfo.IndexNumberEnd, Path.GetDirectoryName (xmlFile));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
list = files.Select (GetXmlReader).ToList ();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (list.Count == 0 && searchInfo.PremiereDate.HasValue) {
|
|
|
|
|
|
|
|
list = GetXmlNodesByPremiereDate (xmlFile, searchInfo.PremiereDate.Value);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return list;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private List<FileSystemMetadata> GetEpisodeXmlFiles(int? seasonNumber, int? episodeNumber, int? endingEpisodeNumber, string seriesDataPath)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
var files = new List<FileSystemMetadata>();
|
|
|
|
var files = new List<FileSystemMetadata>();
|
|
|
|
|
|
|
|
|
|
|
@ -258,116 +314,127 @@ namespace MediaBrowser.Providers.TV
|
|
|
|
return files;
|
|
|
|
return files;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private class EpisodeNumbers
|
|
|
|
private XmlReader GetXmlReader(FileSystemMetadata xmlFile)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
public int EpisodeNumber;
|
|
|
|
return GetXmlReader (_fileSystem.ReadAllText(xmlFile.FullName, Encoding.UTF8));
|
|
|
|
public int? SeasonNumber;
|
|
|
|
|
|
|
|
public int EpisodeNumberEnd;
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
private XmlReader GetXmlReader(String xml)
|
|
|
|
/// Fetches the episode data.
|
|
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
|
|
/// <param name="id">The identifier.</param>
|
|
|
|
|
|
|
|
/// <param name="searchNumbers">The search numbers.</param>
|
|
|
|
|
|
|
|
/// <param name="seriesDataPath">The series data path.</param>
|
|
|
|
|
|
|
|
/// <param name="cancellationToken">The cancellation token.</param>
|
|
|
|
|
|
|
|
/// <returns>Task{System.Boolean}.</returns>
|
|
|
|
|
|
|
|
private MetadataResult<Episode> FetchEpisodeData(EpisodeInfo id, EpisodeNumbers searchNumbers, string seriesDataPath, CancellationToken cancellationToken)
|
|
|
|
|
|
|
|
{
|
|
|
|
{
|
|
|
|
var episodeNumber = searchNumbers.EpisodeNumber;
|
|
|
|
var streamReader = new StringReader (xml);
|
|
|
|
var seasonNumber = searchNumbers.SeasonNumber;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
string file;
|
|
|
|
return XmlReader.Create (streamReader, new XmlReaderSettings {
|
|
|
|
var usingAbsoluteData = false;
|
|
|
|
CheckCharacters = false,
|
|
|
|
|
|
|
|
IgnoreProcessingInstructions = true,
|
|
|
|
|
|
|
|
IgnoreComments = true,
|
|
|
|
|
|
|
|
ValidationType = ValidationType.None
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
var result = new MetadataResult<Episode>()
|
|
|
|
private List<XmlReader> GetXmlNodesByPremiereDate(string xmlFile, DateTime premiereDate)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
Item = new Episode
|
|
|
|
var list = new List<XmlReader> ();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
using (var streamReader = new StreamReader (xmlFile, Encoding.UTF8)) {
|
|
|
|
|
|
|
|
// Use XmlReader for best performance
|
|
|
|
|
|
|
|
using (var reader = XmlReader.Create (streamReader, new XmlReaderSettings {
|
|
|
|
|
|
|
|
CheckCharacters = false,
|
|
|
|
|
|
|
|
IgnoreProcessingInstructions = true,
|
|
|
|
|
|
|
|
IgnoreComments = true,
|
|
|
|
|
|
|
|
ValidationType = ValidationType.None
|
|
|
|
|
|
|
|
}))
|
|
|
|
{
|
|
|
|
{
|
|
|
|
IndexNumber = id.IndexNumber,
|
|
|
|
reader.MoveToContent();
|
|
|
|
ParentIndexNumber = id.ParentIndexNumber,
|
|
|
|
|
|
|
|
IndexNumberEnd = id.IndexNumberEnd
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
try
|
|
|
|
// Loop through each element
|
|
|
|
|
|
|
|
while (reader.Read())
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if (seasonNumber != null)
|
|
|
|
if (reader.NodeType == XmlNodeType.Element)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
file = Path.Combine(seriesDataPath, string.Format("episode-{0}-{1}.xml", seasonNumber.Value, episodeNumber));
|
|
|
|
switch (reader.Name)
|
|
|
|
FetchMainEpisodeInfo(result, file, cancellationToken);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
result.HasMetadata = true;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
catch (FileNotFoundException)
|
|
|
|
|
|
|
|
{
|
|
|
|
{
|
|
|
|
// Could be using absolute numbering
|
|
|
|
case "Episode":
|
|
|
|
if (seasonNumber.HasValue && seasonNumber.Value != 1)
|
|
|
|
|
|
|
|
{
|
|
|
|
{
|
|
|
|
throw;
|
|
|
|
var outerXml = reader.ReadOuterXml();
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
var airDate = GetEpisodeAirDate (outerXml);
|
|
|
|
|
|
|
|
|
|
|
|
if (!result.HasMetadata)
|
|
|
|
if (airDate.HasValue && premiereDate.Date == airDate.Value.Date)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
file = Path.Combine(seriesDataPath, string.Format("episode-abs-{0}.xml", episodeNumber));
|
|
|
|
list.Add (GetXmlReader(outerXml));
|
|
|
|
|
|
|
|
return list;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
FetchMainEpisodeInfo(result, file, cancellationToken);
|
|
|
|
break;
|
|
|
|
result.HasMetadata = true;
|
|
|
|
|
|
|
|
usingAbsoluteData = true;
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
var end = searchNumbers.EpisodeNumberEnd;
|
|
|
|
default:
|
|
|
|
episodeNumber++;
|
|
|
|
reader.Skip();
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
while (episodeNumber <= end)
|
|
|
|
return list;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private DateTime? GetEpisodeAirDate(string xml)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if (usingAbsoluteData)
|
|
|
|
using (var streamReader = new StringReader (xml))
|
|
|
|
{
|
|
|
|
{
|
|
|
|
file = Path.Combine(seriesDataPath, string.Format("episode-abs-{0}.xml", episodeNumber));
|
|
|
|
// Use XmlReader for best performance
|
|
|
|
}
|
|
|
|
using (var reader = XmlReader.Create (streamReader, new XmlReaderSettings {
|
|
|
|
else
|
|
|
|
CheckCharacters = false,
|
|
|
|
|
|
|
|
IgnoreProcessingInstructions = true,
|
|
|
|
|
|
|
|
IgnoreComments = true,
|
|
|
|
|
|
|
|
ValidationType = ValidationType.None
|
|
|
|
|
|
|
|
}))
|
|
|
|
{
|
|
|
|
{
|
|
|
|
file = Path.Combine(seriesDataPath, string.Format("episode-{0}-{1}.xml", seasonNumber.Value, episodeNumber));
|
|
|
|
reader.MoveToContent ();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
try
|
|
|
|
// Loop through each element
|
|
|
|
|
|
|
|
while (reader.Read ()) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (reader.NodeType == XmlNodeType.Element) {
|
|
|
|
|
|
|
|
switch (reader.Name) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
case "FirstAired":
|
|
|
|
{
|
|
|
|
{
|
|
|
|
FetchAdditionalPartInfo(result, file, cancellationToken);
|
|
|
|
var val = reader.ReadElementContentAsString ();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (!string.IsNullOrWhiteSpace (val)) {
|
|
|
|
|
|
|
|
DateTime date;
|
|
|
|
|
|
|
|
if (DateTime.TryParse (val, out date)) {
|
|
|
|
|
|
|
|
date = date.ToUniversalTime ();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return date;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
catch (FileNotFoundException)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
catch (DirectoryNotFoundException)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
episodeNumber++;
|
|
|
|
default:
|
|
|
|
|
|
|
|
reader.Skip ();
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private readonly CultureInfo _usCulture = new CultureInfo("en-US");
|
|
|
|
private readonly CultureInfo _usCulture = new CultureInfo("en-US");
|
|
|
|
|
|
|
|
|
|
|
|
private void FetchMainEpisodeInfo(MetadataResult<Episode> result, string xmlFile, CancellationToken cancellationToken)
|
|
|
|
private void FetchMainEpisodeInfo(MetadataResult<Episode> result, XmlReader reader, CancellationToken cancellationToken)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
var item = result.Item;
|
|
|
|
var item = result.Item;
|
|
|
|
|
|
|
|
|
|
|
|
using (var streamReader = new StreamReader(xmlFile, Encoding.UTF8))
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
// Use XmlReader for best performance
|
|
|
|
// Use XmlReader for best performance
|
|
|
|
using (var reader = XmlReader.Create(streamReader, new XmlReaderSettings
|
|
|
|
using (reader)
|
|
|
|
{
|
|
|
|
|
|
|
|
CheckCharacters = false,
|
|
|
|
|
|
|
|
IgnoreProcessingInstructions = true,
|
|
|
|
|
|
|
|
IgnoreComments = true,
|
|
|
|
|
|
|
|
ValidationType = ValidationType.None
|
|
|
|
|
|
|
|
}))
|
|
|
|
|
|
|
|
{
|
|
|
|
{
|
|
|
|
reader.MoveToContent();
|
|
|
|
reader.MoveToContent();
|
|
|
|
|
|
|
|
|
|
|
@ -637,7 +704,6 @@ namespace MediaBrowser.Providers.TV
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private void AddPeople<T>(MetadataResult<T> result, string val, string personType)
|
|
|
|
private void AddPeople<T>(MetadataResult<T> result, string val, string personType)
|
|
|
|
{
|
|
|
|
{
|
|
|
@ -680,20 +746,12 @@ namespace MediaBrowser.Providers.TV
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private void FetchAdditionalPartInfo(MetadataResult<Episode> result, string xmlFile, CancellationToken cancellationToken)
|
|
|
|
private void FetchAdditionalPartInfo(MetadataResult<Episode> result, XmlReader reader, CancellationToken cancellationToken)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
var item = result.Item;
|
|
|
|
var item = result.Item;
|
|
|
|
|
|
|
|
|
|
|
|
using (var streamReader = new StreamReader(xmlFile, Encoding.UTF8))
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
// Use XmlReader for best performance
|
|
|
|
// Use XmlReader for best performance
|
|
|
|
using (var reader = XmlReader.Create(streamReader, new XmlReaderSettings
|
|
|
|
using (reader)
|
|
|
|
{
|
|
|
|
|
|
|
|
CheckCharacters = false,
|
|
|
|
|
|
|
|
IgnoreProcessingInstructions = true,
|
|
|
|
|
|
|
|
IgnoreComments = true,
|
|
|
|
|
|
|
|
ValidationType = ValidationType.None
|
|
|
|
|
|
|
|
}))
|
|
|
|
|
|
|
|
{
|
|
|
|
{
|
|
|
|
reader.MoveToContent();
|
|
|
|
reader.MoveToContent();
|
|
|
|
|
|
|
|
|
|
|
@ -782,7 +840,6 @@ namespace MediaBrowser.Providers.TV
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public Task<HttpResponseInfo> GetImageResponse(string url, CancellationToken cancellationToken)
|
|
|
|
public Task<HttpResponseInfo> GetImageResponse(string url, CancellationToken cancellationToken)
|
|
|
|
{
|
|
|
|
{
|
|
|
|