コード例 #1
0
        public async Task <MusicArtist> GetArtistById(int id, CancellationToken cancellationToken)
        {
            var response = await _api.GetArtistById(id, cancellationToken);

            if (response == null)
            {
                return(null);
            }

            var artist = new MusicArtist
            {
                ProviderIds =
                {
                    [VgmdbArtistExternalId.ExternalId] = response.Id.ToString()
                },
                Name = response.name
            };

            var image = new ItemImageInfo
            {
                Path = response.picture_full,
                Type = ImageType.Primary
            };

            artist.SetImage(image, 0);

            artist.Overview = response.notes;

            return(artist);
        }
コード例 #2
0
        public async Task <IEnumerable <RemoteImageInfo> > GetImages(BaseItem item, CancellationToken cancellationToken)
        {
            var images = new List <RemoteImageInfo>();

            var id = item.GetProviderId(VgmdbArtistExternalId.ExternalId);

            //todo use a search to find id
            if (id == null)
            {
                return(images);
            }

            var artist = await _api.GetArtistById(int.Parse(id), cancellationToken);

            images.Add(new RemoteImageInfo
            {
                Url          = artist.picture_full,
                ThumbnailUrl = artist.picture_small
            });

            return(images);
        }