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


C# Series.HasImage方法代码示例

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


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

示例1: FetchImages

        /// <summary>
        /// Fetches the images.
        /// </summary>
        /// <param name="series">The series.</param>
        /// <param name="images">The images.</param>
        /// <param name="cancellationToken">The cancellation token.</param>
        /// <returns>Task.</returns>
        private async Task FetchImages(Series series, XmlDocument images, CancellationToken cancellationToken)
        {
            if (!series.HasImage(ImageType.Primary))
            {
                var n = images.SelectSingleNode("//Banner[BannerType='poster']");
                if (n != null)
                {
                    n = n.SelectSingleNode("./BannerPath");
                    if (n != null)
                    {
                        var url = TVUtils.BannerUrl + n.InnerText;

                        await _providerManager.SaveImage(series, url, RemoteSeriesProvider.Current.TvDbResourcePool, ImageType.Primary, null, cancellationToken)
                          .ConfigureAwait(false);
                    }
                }
            }

            if (ConfigurationManager.Configuration.DownloadSeriesImages.Banner && !series.HasImage(ImageType.Banner))
            {
                var n = images.SelectSingleNode("//Banner[BannerType='series']");
                if (n != null)
                {
                    n = n.SelectSingleNode("./BannerPath");
                    if (n != null)
                    {
                        var url = TVUtils.BannerUrl + n.InnerText;

                        await _providerManager.SaveImage(series, url, RemoteSeriesProvider.Current.TvDbResourcePool, ImageType.Banner, null, cancellationToken)
                          .ConfigureAwait(false);
                    }
                }
            }

            if (series.BackdropImagePaths.Count == 0)
            {
                var bdNo = series.BackdropImagePaths.Count;

                var xmlNodeList = images.SelectNodes("//Banner[BannerType='fanart']");
                if (xmlNodeList != null)
                {
                    foreach (XmlNode b in xmlNodeList)
                    {
                        var p = b.SelectSingleNode("./BannerPath");

                        if (p != null)
                        {
                            var url = TVUtils.BannerUrl + p.InnerText;

                            await _providerManager.SaveImage(series, url, RemoteSeriesProvider.Current.TvDbResourcePool, ImageType.Backdrop, bdNo, cancellationToken)
                              .ConfigureAwait(false);
                            
                            bdNo++;
                        }

                        if (series.BackdropImagePaths.Count >= ConfigurationManager.Configuration.MaxBackdrops) break;
                    }
                }
            }
        }
开发者ID:JasoonJ,项目名称:MediaBrowser,代码行数:67,代码来源:TvdbSeriesImageProvider.cs

示例2: FetchImages

        /// <summary>
        /// Fetches the images.
        /// </summary>
        /// <param name="series">The series.</param>
        /// <param name="images">The images.</param>
        /// <param name="cancellationToken">The cancellation token.</param>
        /// <returns>Task.</returns>
        private async Task FetchImages(Series series, XmlDocument images, CancellationToken cancellationToken)
        {
            if (!series.HasImage(ImageType.Primary))
            {
                var n = images.SelectSingleNode("//Banner[BannerType='poster']");
                if (n != null)
                {
                    n = n.SelectSingleNode("./BannerPath");
                    if (n != null)
                    {
                        var path = await _providerManager.DownloadAndSaveImage(series, TVUtils.BannerUrl + n.InnerText, "folder" + Path.GetExtension(n.InnerText), ConfigurationManager.Configuration.SaveLocalMeta, RemoteSeriesProvider.Current.TvDbResourcePool, cancellationToken).ConfigureAwait(false);

                        series.SetImage(ImageType.Primary, path);
                    }
                }
            }

            if (ConfigurationManager.Configuration.DownloadSeriesImages.Banner && !series.HasImage(ImageType.Banner))
            {
                var n = images.SelectSingleNode("//Banner[BannerType='series']");
                if (n != null)
                {
                    n = n.SelectSingleNode("./BannerPath");
                    if (n != null)
                    {
                        var bannerImagePath = await _providerManager.DownloadAndSaveImage(series, TVUtils.BannerUrl + n.InnerText, "banner" + Path.GetExtension(n.InnerText), ConfigurationManager.Configuration.SaveLocalMeta, RemoteSeriesProvider.Current.TvDbResourcePool, cancellationToken);

                        series.SetImage(ImageType.Banner, bannerImagePath);
                    }
                }
            }

            if (series.BackdropImagePaths.Count == 0)
            {
                var bdNo = series.BackdropImagePaths.Count;

                var xmlNodeList = images.SelectNodes("//Banner[BannerType='fanart']");
                if (xmlNodeList != null)
                {
                    foreach (XmlNode b in xmlNodeList)
                    {
                        var p = b.SelectSingleNode("./BannerPath");

                        if (p != null)
                        {
                            var bdName = "backdrop" + (bdNo > 0 ? bdNo.ToString(UsCulture) : "");
                            series.BackdropImagePaths.Add(await _providerManager.DownloadAndSaveImage(series, TVUtils.BannerUrl + p.InnerText, bdName + Path.GetExtension(p.InnerText), ConfigurationManager.Configuration.SaveLocalMeta, RemoteSeriesProvider.Current.TvDbResourcePool, cancellationToken).ConfigureAwait(false));
                            bdNo++;
                        }

                        if (series.BackdropImagePaths.Count >= ConfigurationManager.Configuration.MaxBackdrops) break;
                    }
                }
            }
        }
开发者ID:snap608,项目名称:MediaBrowser,代码行数:62,代码来源:TvdbSeriesImageProvider.cs


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