diff --git a/MediaBrowser.Providers/Plugins/Tmdb/TmdbClientManager.cs b/MediaBrowser.Providers/Plugins/Tmdb/TmdbClientManager.cs
index 3aa673274..69f964937 100644
--- a/MediaBrowser.Providers/Plugins/Tmdb/TmdbClientManager.cs
+++ b/MediaBrowser.Providers/Plugins/Tmdb/TmdbClientManager.cs
@@ -145,16 +145,8 @@ namespace MediaBrowser.Providers.Plugins.Tmdb
/// A comma-separated list of image languages.
/// The cancellation token.
/// The TMDb tv show episode group information or null if not found.
- public async Task GetSeriesGroupAsync(int tvShowId, string displayOrder, string language, string imageLanguages, CancellationToken cancellationToken)
+ private async Task GetSeriesGroupAsync(int tvShowId, string displayOrder, string language, string imageLanguages, CancellationToken cancellationToken)
{
- var key = $"group-{tvShowId.ToString(CultureInfo.InvariantCulture)}-{displayOrder}-{language}";
- if (_memoryCache.TryGetValue(key, out TvGroupCollection group))
- {
- return group;
- }
-
- await EnsureClientConfigAsync().ConfigureAwait(false);
-
TvGroupType? groupType =
displayOrder == "absolute" ? TvGroupType.Absolute :
displayOrder == "dvd" ? TvGroupType.DVD :
@@ -165,8 +157,16 @@ namespace MediaBrowser.Providers.Plugins.Tmdb
return null;
}
- var series = await GetSeriesAsync(tvShowId, language, imageLanguages, cancellationToken);
- var episodeGroupId = series.EpisodeGroups.Results.Find(g => g.Type == groupType)?.Id;
+ var key = $"group-{tvShowId.ToString(CultureInfo.InvariantCulture)}-{displayOrder}-{language}";
+ if (_memoryCache.TryGetValue(key, out TvGroupCollection group))
+ {
+ return group;
+ }
+
+ await EnsureClientConfigAsync().ConfigureAwait(false);
+
+ var series = await GetSeriesAsync(tvShowId, language, imageLanguages, cancellationToken).ConfigureAwait(false);
+ var episodeGroupId = series?.EpisodeGroups.Results.Find(g => g.Type == groupType)?.Id;
if (episodeGroupId == null)
{
@@ -246,6 +246,7 @@ namespace MediaBrowser.Providers.Plugins.Tmdb
if (group != null)
{
var season = group.Groups.Find(s => s.Order == seasonNumber);
+ // Episode order starts at 0
var ep = season?.Episodes.Find(e => e.Order == episodeNumber - 1);
if (ep != null)
{