update episode refresh

pull/702/head
Luke Pulverenti 9 years ago
parent 0e1b6d2e79
commit 7987e2092a

@ -112,6 +112,8 @@ namespace MediaBrowser.Providers.TV
if (TvdbSeriesProvider.IsValidSeries(searchInfo.SeriesProviderIds) && if (TvdbSeriesProvider.IsValidSeries(searchInfo.SeriesProviderIds) &&
(searchInfo.IndexNumber.HasValue || searchInfo.PremiereDate.HasValue)) (searchInfo.IndexNumber.HasValue || searchInfo.PremiereDate.HasValue))
{ {
await TvdbSeriesProvider.Current.EnsureSeriesInfo(searchInfo.SeriesProviderIds, searchInfo.MetadataLanguage, cancellationToken).ConfigureAwait(false);
var seriesDataPath = TvdbSeriesProvider.GetSeriesDataPath(_config.ApplicationPaths, searchInfo.SeriesProviderIds); var seriesDataPath = TvdbSeriesProvider.GetSeriesDataPath(_config.ApplicationPaths, searchInfo.SeriesProviderIds);
var searchNumbers = new EpisodeNumbers(); var searchNumbers = new EpisodeNumbers();

@ -329,7 +329,12 @@ namespace MediaBrowser.Providers.TV
return false; return false;
} }
private SemaphoreSlim _ensureSemaphore = new SemaphoreSlim(1,1);
internal async Task<string> EnsureSeriesInfo(Dictionary<string, string> seriesProviderIds, string preferredMetadataLanguage, CancellationToken cancellationToken) internal async Task<string> EnsureSeriesInfo(Dictionary<string, string> seriesProviderIds, string preferredMetadataLanguage, CancellationToken cancellationToken)
{
await _ensureSemaphore.WaitAsync(cancellationToken).ConfigureAwait(false);
try
{ {
string seriesId; string seriesId;
if (seriesProviderIds.TryGetValue(MetadataProviders.Tvdb.ToString(), out seriesId)) if (seriesProviderIds.TryGetValue(MetadataProviders.Tvdb.ToString(), out seriesId))
@ -362,6 +367,11 @@ namespace MediaBrowser.Providers.TV
return null; return null;
} }
finally
{
_ensureSemaphore.Release();
}
}
private bool IsCacheValid(string seriesDataPath, string preferredMetadataLanguage) private bool IsCacheValid(string seriesDataPath, string preferredMetadataLanguage)
{ {

Loading…
Cancel
Save