Exemplo n.º 1
0
        public async Task <IEnumerable <RemoteImageInfo> > GetImages(BaseItem item, LibraryOptions libraryOptions, CancellationToken cancellationToken)
        {
            var list = new List <RemoteImageInfo>();

            var artistMusicBrainzId = item.GetProviderId(MetadataProviders.MusicBrainzAlbumArtist);

            if (!string.IsNullOrEmpty(artistMusicBrainzId))
            {
                await FanartArtistProvider.Current.EnsureArtistJson(artistMusicBrainzId, cancellationToken).ConfigureAwait(false);

                var artistJsonPath = FanartArtistProvider.GetArtistJsonPath(_config.CommonApplicationPaths, artistMusicBrainzId);

                var musicBrainzReleaseGroupId = item.GetProviderId(MetadataProviders.MusicBrainzReleaseGroup);

                var musicBrainzId = item.GetProviderId(MetadataProviders.MusicBrainzAlbum);

                try
                {
                    await AddImages(list, artistJsonPath, musicBrainzId, musicBrainzReleaseGroupId, cancellationToken).ConfigureAwait(false);
                }
                catch (FileNotFoundException)
                {
                }
                catch (IOException)
                {
                }
            }

            return(list);
        }
Exemplo n.º 2
0
        public FanartArtistProvider(IServerConfigurationManager config, IHttpClient httpClient, IFileSystem fileSystem, IJsonSerializer jsonSerializer)
        {
            _config         = config;
            _httpClient     = httpClient;
            _fileSystem     = fileSystem;
            _jsonSerializer = jsonSerializer;

            Current = this;
        }