aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVasily <JustAMan@users.noreply.github.com>2019-12-13 19:56:41 +0300
committerGitHub <noreply@github.com>2019-12-13 19:56:41 +0300
commit54dbdc695a1c4d3b987f9fd91be55ff109975a43 (patch)
treef672a5c3526faed8d69fd6eb765d3168a69ac216
parentdc32050a2ee04c76a4dff00716b4a096f33dcfad (diff)
parenta2462704d111095d57838b78694d755f298b890c (diff)
Merge pull request #2138 from mark-monteiro/fix-episode-search
Fix Tvdb Provider Episode Search
-rw-r--r--CONTRIBUTORS.md1
-rw-r--r--MediaBrowser.Providers/TV/TheTVDB/TvdbEpisodeProvider.cs5
-rw-r--r--MediaBrowser.Providers/TV/TheTVDB/TvdbSeriesProvider.cs11
3 files changed, 11 insertions, 6 deletions
diff --git a/CONTRIBUTORS.md b/CONTRIBUTORS.md
index f22944a8b..d69e6330b 100644
--- a/CONTRIBUTORS.md
+++ b/CONTRIBUTORS.md
@@ -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
diff --git a/MediaBrowser.Providers/TV/TheTVDB/TvdbEpisodeProvider.cs b/MediaBrowser.Providers/TV/TheTVDB/TvdbEpisodeProvider.cs
index e5287048d..4269d3420 100644
--- a/MediaBrowser.Providers/TV/TheTVDB/TvdbEpisodeProvider.cs
+++ b/MediaBrowser.Providers/TV/TheTVDB/TvdbEpisodeProvider.cs
@@ -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;
diff --git a/MediaBrowser.Providers/TV/TheTVDB/TvdbSeriesProvider.cs b/MediaBrowser.Providers/TV/TheTVDB/TvdbSeriesProvider.cs
index 10ed4f073..72ceadaf1 100644
--- a/MediaBrowser.Providers/TV/TheTVDB/TvdbSeriesProvider.cs
+++ b/MediaBrowser.Providers/TV/TheTVDB/TvdbSeriesProvider.cs
@@ -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>