当前位置: 首页>>代码示例>>C#>>正文


C# IApiClient.GetImageUrl方法代码示例

本文整理汇总了C#中IApiClient.GetImageUrl方法的典型用法代码示例。如果您正苦于以下问题:C# IApiClient.GetImageUrl方法的具体用法?C# IApiClient.GetImageUrl怎么用?C# IApiClient.GetImageUrl使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在IApiClient的用法示例。


在下文中一共展示了IApiClient.GetImageUrl方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: GetImages

        /// <summary>
        /// Gets the images.
        /// </summary>
        /// <param name="item">The item.</param>
        /// <param name="apiClient">The API client.</param>
        /// <param name="imageWidth">Width of the image.</param>
        /// <param name="imageHeight">Height of the image.</param>
        /// <param name="includeNonBackdrops">if set to <c>true</c> [include non backdrops].</param>
        /// <returns>List{System.String}.</returns>
        public static List<string> GetImages(BaseItemDto item, IApiClient apiClient, int? imageWidth, int? imageHeight, bool includeNonBackdrops)
        {
            var images = new List<string> { };

            if (item.BackdropCount > 0)
            {
                for (var i = 0; i < item.BackdropCount; i++)
                {
                    images.Add(apiClient.GetImageUrl(item, new ImageOptions
                    {
                        ImageType = ImageType.Backdrop,
                        ImageIndex = i,
                        Width = imageWidth,
                        Height = imageHeight
                    }));
                }
            }

            if (includeNonBackdrops)
            {
                if (item.HasThumb)
                {
                    images.Add(apiClient.GetImageUrl(item, new ImageOptions
                    {
                        ImageType = ImageType.Thumb,
                        Width = imageWidth,
                        Height = imageHeight
                    }));
                }

                if (item.HasArtImage)
                {
                    images.Add(apiClient.GetImageUrl(item, new ImageOptions
                    {
                        ImageType = ImageType.Art,
                        Width = imageWidth,
                        Height = imageHeight
                    }));
                }

                if (item.HasDiscImage)
                {
                    images.Add(apiClient.GetImageUrl(item, new ImageOptions
                    {
                        ImageType = ImageType.Disc,
                        Width = imageWidth,
                        Height = imageHeight
                    }));
                }

                if (item.HasMenuImage)
                {
                    images.Add(apiClient.GetImageUrl(item, new ImageOptions
                    {
                        ImageType = ImageType.Menu,
                        Width = imageWidth,
                        Height = imageHeight
                    }));
                }

                if (item.HasBoxImage)
                {
                    images.Add(apiClient.GetImageUrl(item, new ImageOptions
                    {
                        ImageType = ImageType.Box,
                        Width = imageWidth,
                        Height = imageHeight
                    }));
                }

                if (item.HasBoxImage)
                {
                    images.Add(apiClient.GetImageUrl(item, new ImageOptions
                    {
                        ImageType = ImageType.Box,
                        Width = imageWidth,
                        Height = imageHeight
                    }));
                }

                if (item.HasBoxRearImage)
                {
                    images.Add(apiClient.GetImageUrl(item, new ImageOptions
                    {
                        ImageType = ImageType.BoxRear,
                        Width = imageWidth,
                        Height = imageHeight
                    }));
                }
            }

//.........这里部分代码省略.........
开发者ID:jfrankelp,项目名称:MediaBrowser.Theater,代码行数:101,代码来源:GalleryViewModel.cs

示例2: GetImageAddToList

 private async Task GetImageAddToList(BaseItemDto item, IApiClient apiClient, List<Stream> list)
 {
     try
     {
         var options = new ImageOptions
         {
             ImageType = ImageType.Primary,
             MaxWidth = 112,
             Quality = Constants.ImageQuality,
             EnableImageEnhancers = false
         };
         var url = apiClient.GetImageUrl(item, options);
         using (var client = CreateClient())
         {
             var response = await client.GetAsync(url);
             var stream = await response.Content.ReadAsStreamAsync();
             list.Add(stream);
         }
     }
     catch (HttpException ex)
     {
         _logger.ErrorException("CreateNewWideTileAsync()", ex);
     }
 }
开发者ID:Austin503,项目名称:Emby.WindowsPhone,代码行数:24,代码来源:TileService.cs

示例3: GetDtoImage

        private static object GetDtoImage(BaseItemDto item, string imageType, IApiClient apiClient)
        {
            if (item.ImageTags.IsNullOrEmpty() && item.BackdropImageTags.IsNullOrEmpty())
            {
                return "";
            }

            var imageOptions = new ImageOptions
            {
                EnableImageEnhancers = App.SpecificSettings.EnableImageEnhancers,
                Quality = Constants.ImageQuality,
                MaxHeight = 336,
                ImageType = ImageType.Primary
            };

            if (item.Type == "Recording")
            {
                imageOptions.MaxHeight = 250;
            }
            else if (item.Type == "Program")
            {
                imageOptions.MaxHeight = 250;
            }
            else if (imageType.Equals("logo", StringComparison.OrdinalIgnoreCase))
            {
                imageOptions.ImageType = ImageType.Logo;
            }
            else if (imageType.Equals("backdrop"))
            {
                imageOptions.MaxHeight = 800;
                imageOptions.ImageType = ImageType.Backdrop;

                var images = apiClient.GetBackdropImageUrls(item, imageOptions);
                if (!images.IsNullOrEmpty())
                {
                    return images.FirstOrDefault();
                }
            }
            else if (imageType.Equals("primaryorbackdrop"))
            {
                if (!item.HasPrimaryImage)
                {
                    imageOptions.MaxHeight = 800;
                    imageOptions.ImageType = ImageType.Backdrop; 

                    var images = apiClient.GetBackdropImageUrls(item, imageOptions);
                    if (!images.IsNullOrEmpty())
                    {
                        return images.FirstOrDefault();
                    }
                }
            }
            else if (imageType.Equals("backdropsmall", StringComparison.OrdinalIgnoreCase))
            {
                imageOptions.MaxHeight = 336;
                imageOptions.ImageType = ImageType.Backdrop;

                var images = apiClient.GetBackdropImageUrls(item, imageOptions);
                if (!images.IsNullOrEmpty())
                {
                    return images.FirstOrDefault();
                }
            }
            else if (imageType.Equals("banner", StringComparison.OrdinalIgnoreCase))
            {
                imageOptions.MaxHeight = 140;
                imageOptions.ImageType = ImageType.Banner;
            }
            else if (imageType.Equals("art", StringComparison.OrdinalIgnoreCase))
            {
                imageOptions.ImageType = ImageType.Art;
            }
            else if (imageType.Equals("thumbnail", StringComparison.OrdinalIgnoreCase))
            {
                imageOptions.ImageType = ImageType.Thumb;
            }
            else if (imageType.Equals("icon", StringComparison.OrdinalIgnoreCase))
            {
                imageOptions.MaxHeight = 159;
            }
            else if (imageType.Equals("poster", StringComparison.OrdinalIgnoreCase))
            {
                imageOptions.MaxHeight = 675;
            }
            else if (imageType.Equals("episode", StringComparison.OrdinalIgnoreCase))
            {
                imageOptions.MaxHeight = 382;
            }
            else
            {
                imageOptions.MaxHeight = 300;
            }
            try
            {
                string url = item.Type == "Series" ? apiClient.GetImageUrl(item.Id, imageOptions) : apiClient.GetImageUrl(item, imageOptions);
                return url;
            }
            catch
            {
                return "";
//.........这里部分代码省略.........
开发者ID:timextreasures,项目名称:Emby.WindowsPhone,代码行数:101,代码来源:ImageUrlConverter.cs

示例4: GetImageStream

        private async Task GetImageStream(IApiClient apiClient, BaseItemDto item, List<Stream> list)
        {
            var url = apiClient.GetImageUrl(item, CollageOptions);
            try
            {
                using (var client = TileService.CreateClient())
                {
                    var response = await client.GetAsync(url);
                    if (response.IsSuccessStatusCode)
                    {
                        var stream = await response.Content.ReadAsStreamAsync();
                        list.Add(stream);
                    }
                }
            }
            catch (HttpException ex)
            {
                _logger.ErrorException("GetImageStream()", ex);
            }

            list = null;
        }
开发者ID:gep13,项目名称:Emby.WindowsPhone,代码行数:22,代码来源:LockScreenService.cs

示例5: DownloadImage

        private async Task DownloadImage(IApiClient apiClient,
            string serverId,
            string itemId,
            string imageTag,
            ImageType imageType,
            CancellationToken cancellationToken)
        {
            var hasImage = await _localAssetManager.HasImage(serverId, itemId, imageTag).ConfigureAwait(false);

            if (hasImage)
            {
                return;
            }

            var url = apiClient.GetImageUrl(itemId, new ImageOptions
            {
                ImageType = imageType,
                Tag = imageTag
            });

            using (var response = await apiClient.GetResponse(url, cancellationToken).ConfigureAwait(false))
            {
                await _localAssetManager.SaveImage(serverId, itemId, imageTag, response.Content).ConfigureAwait(false);
            }
        }
开发者ID:daltekkie,项目名称:Emby.ApiClient,代码行数:25,代码来源:MediaSync.cs


注:本文中的IApiClient.GetImageUrl方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。