@ -229,6 +229,51 @@ namespace MediaBrowser.Providers.Plugins.TheTvdb
return GetEpisodesPageAsync ( tvdbId , 1 , episodeQuery , language , cancellationToken ) ;
}
public async Task < IEnumerable < KeyType > > GetImageKeyTypesForSeriesAsync ( int tvdbId , string language , CancellationToken cancellationToken )
{
var cacheKey = GenerateKey ( nameof ( TvDbClient . Series . GetImagesSummaryAsync ) , tvdbId ) ;
var imagesSummary = await TryGetValue ( cacheKey , language , ( ) = > TvDbClient . Series . GetImagesSummaryAsync ( tvdbId , cancellationToken ) ) . ConfigureAwait ( false ) ;
var keyTypes = new List < KeyType > ( ) ;
if ( imagesSummary . Data . Fanart > 0 )
{
keyTypes . Add ( KeyType . Fanart ) ;
}
if ( imagesSummary . Data . Series > 0 )
{
keyTypes . Add ( KeyType . Series ) ;
}
if ( imagesSummary . Data . Poster > 0 )
{
keyTypes . Add ( KeyType . Poster ) ;
}
return keyTypes ;
}
public async Task < IEnumerable < KeyType > > GetImageKeyTypesForSeasonAsync ( int tvdbId , string language , CancellationToken cancellationToken )
{
var cacheKey = GenerateKey ( nameof ( TvDbClient . Series . GetImagesSummaryAsync ) , tvdbId ) ;
var imagesSummary = await TryGetValue ( cacheKey , language , ( ) = > TvDbClient . Series . GetImagesSummaryAsync ( tvdbId , cancellationToken ) ) . ConfigureAwait ( false ) ;
var keyTypes = new List < KeyType > ( ) ;
if ( imagesSummary . Data . Season > 0 )
{
keyTypes . Add ( KeyType . Season ) ;
}
if ( imagesSummary . Data . Fanart > 0 )
{
keyTypes . Add ( KeyType . Fanart ) ;
}
// TODO seasonwide is not supported in TvDbSharper
return keyTypes ;
}
private async Task < T > TryGetValue < T > ( string key , string language , Func < Task < T > > resultFactory )
{
if ( _cache . TryGetValue ( key , out T cachedValue ) )