コード例 #1
0
        public FanartMovieImageProvider(IServerConfigurationManager config, IHttpClient httpClient, IFileSystem fileSystem, IJsonSerializer json)
        {
            _config     = config;
            _httpClient = httpClient;
            _fileSystem = fileSystem;
            _json       = json;

            Current = this;
        }
コード例 #2
0
        private void PopulateImages(List <RemoteImageInfo> list,
                                    List <FanartSeriesProvider.Image> images,
                                    ImageType type,
                                    int width,
                                    int height,
                                    int seasonNumber)
        {
            if (images == null)
            {
                return;
            }

            list.AddRange(images.Select(i =>
            {
                var url    = i.url;
                var season = i.season;

                int imageSeasonNumber;

                if (!string.IsNullOrEmpty(url) &&
                    !string.IsNullOrEmpty(season) &&
                    int.TryParse(season, NumberStyles.Integer, _usCulture, out imageSeasonNumber) &&
                    seasonNumber == imageSeasonNumber)
                {
                    var likesString = i.likes;
                    int likes;

                    var info = new RemoteImageInfo
                    {
                        RatingType   = RatingType.Likes,
                        Type         = type,
                        Width        = width,
                        Height       = height,
                        ProviderName = Name,
                        Url          = url.Replace("http://", "https://", StringComparison.OrdinalIgnoreCase),
                        Language     = FanartMovieImageProvider.NormalizeLanguage(i.lang)
                    };

                    if (!string.IsNullOrEmpty(likesString) && int.TryParse(likesString, NumberStyles.Integer, _usCulture, out likes))
                    {
                        info.CommunityRating = likes;
                    }

                    return(info);
                }

                return(null);
            }).Where(i => i != null));
        }