Skip to content

Commit

Permalink
Don't retrieve tvdbId for episode if there is tvdbid already provided
Browse files Browse the repository at this point in the history
  • Loading branch information
scampower3 committed Mar 22, 2024
1 parent f5fec33 commit fc7b8fe
Showing 1 changed file with 15 additions and 12 deletions.
27 changes: 15 additions & 12 deletions Jellyfin.Plugin.Tvdb/Providers/TvdbEpisodeProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -157,21 +157,24 @@ private async Task<MetadataResult<Episode>> GetEpisode(EpisodeInfo searchInfo, C
QueriedById = true
};

string? episodeTvdbId = null;
var episodeTvdbId = searchInfo.GetTvdbId().ToString(CultureInfo.InvariantCulture);
try
{
episodeTvdbId = await _tvdbClientManager
.GetEpisodeTvdbId(searchInfo, searchInfo.MetadataLanguage, cancellationToken)
.ConfigureAwait(false);
if (string.IsNullOrEmpty(episodeTvdbId))
if (string.Equals(episodeTvdbId, "0", StringComparison.OrdinalIgnoreCase))
{
_logger.LogError(
"Episode S{Season:00}E{Episode:00} not found for series {SeriesTvdbId}:{Name}",
searchInfo.ParentIndexNumber,
searchInfo.IndexNumber,
searchInfo.GetTvdbId(),
searchInfo.Name);
return result;
episodeTvdbId = await _tvdbClientManager
.GetEpisodeTvdbId(searchInfo, searchInfo.MetadataLanguage, cancellationToken)
.ConfigureAwait(false);
if (string.IsNullOrEmpty(episodeTvdbId))
{
_logger.LogError(
"Episode S{Season:00}E{Episode:00} not found for series {SeriesTvdbId}:{Name}",
searchInfo.ParentIndexNumber,
searchInfo.IndexNumber,
searchInfo.GetTvdbId(),
searchInfo.Name);
return result;
}
}

var episodeResult = await _tvdbClientManager.GetEpisodesAsync(
Expand Down

0 comments on commit fc7b8fe

Please sign in to comment.