Merge pull request #2138 from mark-monteiro/fix-episode-search

Fix Tvdb Provider Episode Search
This commit is contained in:
Vasily 2019-12-13 19:56:41 +03:00 committed by GitHub
commit 54dbdc695a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 11 additions and 6 deletions

View File

@ -30,6 +30,7 @@
- [Khinenw](https://github.com/HelloWorld017)
- [fhriley](https://github.com/fhriley)
- [nevado](https://github.com/nevado)
- [mark-monteiro](https://github.com/mark-monteiro)
# Emby Contributors

View File

@ -35,9 +35,8 @@ namespace MediaBrowser.Providers.TV.TheTVDB
{
var list = new List<RemoteSearchResult>();
// The search query must either provide an episode number or date
if (!searchInfo.IndexNumber.HasValue
|| !searchInfo.PremiereDate.HasValue
// Either an episode number or date must be provided; and the dictionary of provider ids must be valid
if ((searchInfo.IndexNumber == null && searchInfo.PremiereDate == null)
|| !TvdbSeriesProvider.IsValidSeries(searchInfo.SeriesProviderIds))
{
return list;

View File

@ -170,11 +170,16 @@ namespace MediaBrowser.Providers.TV.TheTVDB
return result?.Data.First().Id.ToString();
}
/// <summary>
/// Check whether a dictionary of provider IDs includes an entry for a valid TV metadata provider.
/// </summary>
/// <param name="seriesProviderIds">The dictionary to check.</param>
/// <returns>True, if the dictionary contains a valid TV provider ID, otherwise false.</returns>
internal static bool IsValidSeries(Dictionary<string, string> seriesProviderIds)
{
return seriesProviderIds.TryGetValue(MetadataProviders.Tvdb.ToString(), out _) ||
seriesProviderIds.TryGetValue(MetadataProviders.Imdb.ToString(), out _) ||
seriesProviderIds.TryGetValue(MetadataProviders.Zap2It.ToString(), out _);
return seriesProviderIds.ContainsKey(MetadataProviders.Tvdb.ToString()) ||
seriesProviderIds.ContainsKey(MetadataProviders.Imdb.ToString()) ||
seriesProviderIds.ContainsKey(MetadataProviders.Zap2It.ToString());
}
/// <summary>