update based on suggestions

pull/4221/head
Gary Wilber 4 years ago
parent 303eccaffe
commit 881a7fa908

@ -2,6 +2,7 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Globalization;
using System.Linq; using System.Linq;
using System.Net.Http; using System.Net.Http;
using System.Text; using System.Text;
@ -342,9 +343,9 @@ namespace MediaBrowser.Providers.Plugins.TheTvdb
{ {
var episodeSummary = await _tvdbClientManager.GetSeriesEpisodeSummaryAsync(tvdbSeries.Id, metadataLanguage, CancellationToken.None).ConfigureAwait(false); var episodeSummary = await _tvdbClientManager.GetSeriesEpisodeSummaryAsync(tvdbSeries.Id, metadataLanguage, CancellationToken.None).ConfigureAwait(false);
if (episodeSummary.Data.AiredSeasons.Length > 0) if (episodeSummary.Data.AiredSeasons.Length != 0)
{ {
var maxSeasonNumber = episodeSummary.Data.AiredSeasons.Select(s => Convert.ToInt32(s)).Max(); var maxSeasonNumber = episodeSummary.Data.AiredSeasons.Max(s => Convert.ToInt32(s, CultureInfo.InvariantCulture));
var episodeQuery = new EpisodeQuery var episodeQuery = new EpisodeQuery
{ {
AiredSeason = maxSeasonNumber AiredSeason = maxSeasonNumber
@ -353,10 +354,11 @@ namespace MediaBrowser.Providers.Plugins.TheTvdb
var episodeDates = episodesPage.Data var episodeDates = episodesPage.Data
.Select(e => DateTime.TryParse(e.FirstAired, out var firstAired) ? firstAired : (DateTime?)null) .Select(e => DateTime.TryParse(e.FirstAired, out var firstAired) ? firstAired : (DateTime?)null)
.Where(dt => dt.HasValue); .Where(dt => dt.HasValue)
if (episodeDates.Any()) .ToList();
if (episodeDates.Count != 0)
{ {
result.Item.EndDate = episodeDates.Max().Value; result.Item.EndDate = episodeDates.Max();
} }
} }
} }

Loading…
Cancel
Save