• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# IHasImages类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中IHasImages的典型用法代码示例。如果您正苦于以下问题:C# IHasImages类的具体用法?C# IHasImages怎么用?C# IHasImages使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



IHasImages类属于命名空间,在下文中一共展示了IHasImages类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: GetImages

        public async Task<IEnumerable<RemoteImageInfo>> GetImages(IHasImages item, CancellationToken cancellationToken)
        {
            if (TvdbSeriesProvider.IsValidSeries(item.ProviderIds))
            {
                var language = item.GetPreferredMetadataLanguage();

                var seriesDataPath = await TvdbSeriesProvider.Current.EnsureSeriesInfo(item.ProviderIds, language, cancellationToken).ConfigureAwait(false);

                var path = Path.Combine(seriesDataPath, "banners.xml");

                try
                {
                    var seriesOffset = TvdbSeriesProvider.GetSeriesOffset(item.ProviderIds);
                    if (seriesOffset != null && seriesOffset.Value != 0)
                        return TvdbSeasonImageProvider.GetImages(path, language, seriesOffset.Value + 1, cancellationToken);
                    
                    return GetImages(path, language, cancellationToken);
                }
                catch (FileNotFoundException)
                {
                    // No tvdb data yet. Don't blow up
                }
                catch (DirectoryNotFoundException)
                {
                    // No tvdb data yet. Don't blow up
                }
            }

            return new RemoteImageInfo[] { };
        }
开发者ID:softworkz,项目名称:Emby,代码行数:30,代码来源:TvdbSeriesImageProvider.cs


示例2: Supports

        public bool Supports(IHasImages item)
        {
            // Save the http requests since we know it's not currently supported
            // TODO: Check again periodically
            if (item is Person)
            {
                return false;
            }

            // Save the http requests since we know it's not currently supported
            if (item is Series || item is Season || item is Episode)
            {
                return false;
            }

            var channelItem = item as IChannelMediaItem;

            if (channelItem != null)
            {
                if (channelItem.ContentType == ChannelMediaContentType.Movie)
                {
                    return true;
                }
                if (channelItem.ContentType == ChannelMediaContentType.MovieExtra)
                {
                    if (channelItem.ExtraType == ExtraType.Trailer)
                    {
                        return true;
                    }
                }
            }

            return item is Movie;
        }
开发者ID:Ceten,项目名称:MediaBrowser,代码行数:34,代码来源:OmdbImageProvider.cs


示例3: GetAllImages

        public Task<IEnumerable<RemoteImageInfo>> GetAllImages(IHasImages item, CancellationToken cancellationToken)
        {
            var season = (Season)item;

            var seriesId = season.Series != null ? season.Series.GetProviderId(MetadataProviders.Tvdb) : null;

            if (!string.IsNullOrEmpty(seriesId) && season.IndexNumber.HasValue)
            {
                // Process images
                var seriesDataPath = TvdbSeriesProvider.GetSeriesDataPath(_config.ApplicationPaths, seriesId);

                var path = Path.Combine(seriesDataPath, "banners.xml");

                try
                {
                    var result = GetImages(path, season.IndexNumber.Value, cancellationToken);

                    return Task.FromResult(result);
                }
                catch (FileNotFoundException)
                {
                    // No tvdb data yet. Don't blow up
                }
            }

            return Task.FromResult<IEnumerable<RemoteImageInfo>>(new RemoteImageInfo[] { });
        }
开发者ID:Brendon-MB3,项目名称:MediaBrowser,代码行数:27,代码来源:ManualTvdbSeasonImageProvider.cs


示例4: GetAllImages

        public Task<IEnumerable<RemoteImageInfo>> GetAllImages(IHasImages item, CancellationToken cancellationToken)
        {
            var list = new List<RemoteImageInfo>();

            RemoteImageInfo info = null;

            var album = item as MusicAlbum;
            if (album != null)
            {
                info = GetInfo(album.LastFmImageUrl, album.LastFmImageSize);
            }

            var musicArtist = item as MusicArtist;
            if (musicArtist != null)
            {
                info = GetInfo(musicArtist.LastFmImageUrl, musicArtist.LastFmImageSize);
            }

            if (info != null)
            {
                list.Add(info);
            }

            // The only info we have is size
            return Task.FromResult<IEnumerable<RemoteImageInfo>>(list.OrderByDescending(i => i.Width ?? 0));
        }
开发者ID:Brendon-MB3,项目名称:MediaBrowser,代码行数:26,代码来源:ManualLastFmImageProvider.cs


示例5: GetSupportedImages

 public IEnumerable<ImageType> GetSupportedImages(IHasImages item)
 {
     return new List<ImageType>
     {
         ImageType.Primary
     };
 }
开发者ID:softworkz,项目名称:Emby,代码行数:7,代码来源:MovieDbEpisodeImageProvider.cs


示例6: GetImages

        public List<LocalImageInfo> GetImages(IHasImages item, IDirectoryService directoryService)
        {
            var parentPath = Path.GetDirectoryName(item.Path);

            var parentPathFiles = directoryService.GetFileSystemEntries(parentPath)
                .ToList();

            var nameWithoutExtension = _fileSystem.GetFileNameWithoutExtension(item.Path);

            var files = GetFilesFromParentFolder(nameWithoutExtension, parentPathFiles);

            if (files.Count > 0)
            {
                return files;
            }

            var metadataPath = Path.Combine(parentPath, "metadata");

            if (parentPathFiles.Any(i => string.Equals(i.FullName, metadataPath, StringComparison.OrdinalIgnoreCase)))
            {
                return GetFilesFromParentFolder(nameWithoutExtension, directoryService.GetFiles(metadataPath));
            }

            return new List<LocalImageInfo>();
        }
开发者ID:NickBolles,项目名称:Emby,代码行数:25,代码来源:EpisodeLocalImageProvider.cs


示例7: GetImage

        public async Task<DynamicImageResponse> GetImage(IHasImages item, ImageType type, CancellationToken cancellationToken)
        {
            var channelItem = (IChannelItem)item;

            var imageResponse = new DynamicImageResponse();

            if (!string.IsNullOrEmpty(channelItem.OriginalImageUrl))
            {
                var options = new HttpRequestOptions
                {
                    CancellationToken = cancellationToken,
                    Url = channelItem.OriginalImageUrl
                };

                var response = await _httpClient.GetResponse(options).ConfigureAwait(false);

                if (response.ContentType.StartsWith("image/", StringComparison.OrdinalIgnoreCase))
                {
                    imageResponse.HasImage = true;
                    imageResponse.Stream = response.Content;
                    imageResponse.SetFormatFromMimeType(response.ContentType);
                }
                else
                {
                    _logger.Error("Provider did not return an image content type.");
                }
            }

            return imageResponse;
        }
开发者ID:Sile626,项目名称:MediaBrowser,代码行数:30,代码来源:ChannelItemImageProvider.cs


示例8: Supports

        public bool Supports(IHasImages item)
        {
            //var channelItem = item as IChannelMediaItem;

            //if (channelItem != null)
            //{
            //    if (channelItem.ContentType == ChannelMediaContentType.Movie)
            //    {
            //        return true;
            //    }
            //    if (channelItem.ContentType == ChannelMediaContentType.MovieExtra)
            //    {
            //        if (channelItem.ExtraType == ExtraType.Trailer)
            //        {
            //            return true;
            //        }
            //    }
            //}

            // Supports images for tv movies
            //var tvProgram = item as LiveTvProgram;
            //if (tvProgram != null && tvProgram.IsMovie)
            //{
            //    return true;
            //}
            
            return item is Movie || item is BoxSet || item is MusicVideo;
        }
开发者ID:rezafouladian,项目名称:Emby,代码行数:28,代码来源:FanartMovieImageProvider.cs


示例9: GetImages

        public async Task<IEnumerable<RemoteImageInfo>> GetImages(IHasImages item, CancellationToken cancellationToken)
        {
            var season = (Season)item;
            var series = season.Series;

            if (series != null && season.IndexNumber.HasValue && TvdbSeriesProvider.IsValidSeries(series.ProviderIds))
            {
                var seriesProviderIds = series.ProviderIds;
                var seasonNumber = season.IndexNumber.Value;

                var seriesDataPath = await TvdbSeriesProvider.Current.EnsureSeriesInfo(seriesProviderIds, series.GetPreferredMetadataLanguage(), cancellationToken).ConfigureAwait(false);

                if (!string.IsNullOrWhiteSpace(seriesDataPath))
                {
                    var path = Path.Combine(seriesDataPath, "banners.xml");

                    try
                    {
                        return GetImages(path, item.GetPreferredMetadataLanguage(), seasonNumber, cancellationToken);
                    }
                    catch (FileNotFoundException)
                    {
                        // No tvdb data yet. Don't blow up
                    }
                    catch (DirectoryNotFoundException)
                    {
                        // No tvdb data yet. Don't blow up
                    }
                }
            }

            return new RemoteImageInfo[] { };
        }
开发者ID:softworkz,项目名称:Emby,代码行数:33,代码来源:TvdbSeasonImageProvider.cs


示例10: Supports

        public bool Supports(IHasImages item)
        {
            if (item is Photo)
            {
                return false;
            }

            if (!item.IsSaveLocalMetadataEnabled())
            {
                return true;
            }

            // Extracted images will be saved in here
            if (item is Audio)
            {
                return true;
            }

            if (item.SupportsLocalMetadata && !item.AlwaysScanInternalMetadataPath)
            {
                return false;
            }

            return true;
        }
开发者ID:rezafouladian,项目名称:Emby,代码行数:25,代码来源:InternalMetadataFolderImageProvider.cs


示例11: GetImages

        public async Task<IEnumerable<RemoteImageInfo>> GetImages(IHasImages item, CancellationToken cancellationToken)
        {
            var season = (Season)item;
            var series = season.Series;

            var identity = season.Identities.OfType<SeasonIdentity>().FirstOrDefault(id => id.Type == MetadataProviders.Tvdb.ToString());
            var seriesId = identity != null ? identity.SeriesId : null;

            if (!string.IsNullOrEmpty(seriesId) && season.IndexNumber.HasValue)
            {
                await TvdbSeriesProvider.Current.EnsureSeriesInfo(seriesId, series.GetPreferredMetadataLanguage(), cancellationToken).ConfigureAwait(false);

                // Process images
                var seriesDataPath = TvdbSeriesProvider.GetSeriesDataPath(_config.ApplicationPaths, seriesId);

                var path = Path.Combine(seriesDataPath, "banners.xml");

                try
                {
                    int seasonNumber = AdjustForSeriesOffset(series, identity.SeasonIndex);
                    return GetImages(path, item.GetPreferredMetadataLanguage(), seasonNumber, cancellationToken);
                }
                catch (FileNotFoundException)
                {
                    // No tvdb data yet. Don't blow up
                }
            }

            return new RemoteImageInfo[] { };
        }
开发者ID:jmarsh0507,项目名称:MediaBrowser,代码行数:30,代码来源:TvdbSeasonImageProvider.cs


示例12: GetImages

        public async Task<IEnumerable<RemoteImageInfo>> GetImages(IHasImages item, CancellationToken cancellationToken)
        {
            var album = (MusicAlbum)item;

            var list = new List<RemoteImageInfo>();

            var artistMusicBrainzId = album.MusicArtist.GetProviderId(MetadataProviders.MusicBrainzArtist);

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

                var artistXmlPath = FanartArtistProvider.GetArtistXmlPath(_config.CommonApplicationPaths, artistMusicBrainzId);

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

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

                try
                {
                    AddImages(list, artistXmlPath, musicBrainzId, musicBrainzReleaseGroupId, cancellationToken);
                }
                catch (FileNotFoundException)
                {

                }
                catch (DirectoryNotFoundException)
                {

                }
            }

            var language = item.GetPreferredMetadataLanguage();

            var isLanguageEn = string.Equals(language, "en", StringComparison.OrdinalIgnoreCase);

            // Sort first by width to prioritize HD versions
            return list.OrderByDescending(i => i.Width ?? 0)
                .ThenByDescending(i =>
                {
                    if (string.Equals(language, i.Language, StringComparison.OrdinalIgnoreCase))
                    {
                        return 3;
                    }
                    if (!isLanguageEn)
                    {
                        if (string.Equals("en", i.Language, StringComparison.OrdinalIgnoreCase))
                        {
                            return 2;
                        }
                    }
                    if (string.IsNullOrEmpty(i.Language))
                    {
                        return isLanguageEn ? 3 : 2;
                    }
                    return 0;
                })
                .ThenByDescending(i => i.CommunityRating ?? 0)
                .ThenByDescending(i => i.VoteCount ?? 0);
        }
开发者ID:jrags56,项目名称:MediaBrowser,代码行数:60,代码来源:FanArtAlbumProvider.cs


示例13: Supports

        public bool Supports(IHasImages item)
        {
            if (item.SupportsLocalMetadata)
            {
                // Episode has it's own provider
                if (item.IsOwnedItem || item is Episode || item is Audio || item is Photo)
                {
                    return false;
                }

                return true;
            }

            if (item.LocationType == LocationType.Virtual)
            {
                var season = item as Season;

                if (season != null)
                {
                    var series = season.Series;

                    if (series != null && series.LocationType == LocationType.FileSystem)
                    {
                        return true;
                    }
                }
            }

            return false;
        }
开发者ID:NickBolles,项目名称:Emby,代码行数:30,代码来源:LocalImageProvider.cs


示例14: GetImages

        public async Task<IEnumerable<RemoteImageInfo>> GetImages(IHasImages item, CancellationToken cancellationToken)
        {
            var series = (Series)item;
            var seriesId = series.GetProviderId(MetadataProviders.Tvdb);

            if (!string.IsNullOrEmpty(seriesId))
            {
                var language = item.GetPreferredMetadataLanguage();

                await TvdbSeriesProvider.Current.EnsureSeriesInfo(seriesId, language, cancellationToken).ConfigureAwait(false);

                // Process images
                var seriesDataPath = TvdbSeriesProvider.GetSeriesDataPath(_config.ApplicationPaths, seriesId);

                var path = Path.Combine(seriesDataPath, "banners.xml");

                try
                {
                    return GetImages(path, language, cancellationToken);
                }
                catch (FileNotFoundException)
                {
                    // No tvdb data yet. Don't blow up
                }
            }

            return new RemoteImageInfo[] { };
        }
开发者ID:Tensre,项目名称:MediaBrowser,代码行数:28,代码来源:TvdbSeriesImageProvider.cs


示例15: GetImages

        private async Task<IEnumerable<RemoteImageInfo>> GetImages(IHasImages item, bool posters, bool thumbs, CancellationToken cancellationToken)
        {
            var list = new List<RemoteImageInfo>();

            if (posters)
            {
                var posterPath = Path.Combine(_config.ApplicationPaths.CachePath, "imagesbyname", "remotestudioposters.txt");

                await EnsurePosterList(posterPath, cancellationToken).ConfigureAwait(false);

                list.Add(GetImage(item, posterPath, ImageType.Primary, "folder"));
            }

            cancellationToken.ThrowIfCancellationRequested();

            if (thumbs)
            {
                var thumbsPath = Path.Combine(_config.ApplicationPaths.CachePath, "imagesbyname", "remotestudiothumbs.txt");

                await EnsureThumbsList(thumbsPath, cancellationToken).ConfigureAwait(false);

                list.Add(GetImage(item, thumbsPath, ImageType.Thumb, "thumb"));
            }

            return list.Where(i => i != null);
        }
开发者ID:paul-777,项目名称:Emby,代码行数:26,代码来源:StudiosImageProvider.cs


示例16: Supports

        public bool Supports(IHasImages item)
        {
            var channelItem = item as IChannelMediaItem;

            if (channelItem != null)
            {
                if (channelItem.ContentType == ChannelMediaContentType.Movie)
                {
                    return true;
                }
                if (channelItem.ContentType == ChannelMediaContentType.MovieExtra)
                {
                    if (channelItem.ExtraType == ExtraType.Trailer)
                    {
                        return true;
                    }
                }
            }

            // Supports images for tv movies
            var tvProgram = item as LiveTvProgram;
            if (tvProgram != null && tvProgram.IsMovie)
            {
                return true;
            }

            return item is Movie || item is MusicVideo;
        }
开发者ID:raven-au,项目名称:Emby,代码行数:28,代码来源:MovieDbImageProvider.cs


示例17: GetImage

        public async Task<DynamicImageResponse> GetImage(IHasImages item, ImageType type, CancellationToken cancellationToken)
        {
            var liveTvItem = (LiveTvChannel)item;

            var imageResponse = new DynamicImageResponse();

            var service = _liveTvManager.Services.FirstOrDefault(i => string.Equals(i.Name, liveTvItem.ServiceName, StringComparison.OrdinalIgnoreCase));

            if (service != null && !item.HasImage(ImageType.Primary))
            {
                try
                {
                    var response = await service.GetChannelImageAsync(liveTvItem.ExternalId, cancellationToken).ConfigureAwait(false);

                    if (response != null)
                    {
                        imageResponse.HasImage = true;
                        imageResponse.Stream = response.Stream;
                        imageResponse.Format = response.Format;
                    }
                }
                catch (NotImplementedException)
                {
                }
            }

            return imageResponse;
        }
开发者ID:softworkz,项目名称:Emby,代码行数:28,代码来源:ChannelImageProvider.cs


示例18: GetImage

        public Task<DynamicImageResponse> GetImage(IHasImages item, ImageType type, CancellationToken cancellationToken)
        {
            var video = (Video)item;

            // No support for this
            if (video.VideoType == VideoType.HdDvd || video.IsPlaceHolder)
            {
                return Task.FromResult(new DynamicImageResponse { HasImage = false });
            }

            // Can't extract from iso's if we weren't unable to determine iso type
            if (video.VideoType == VideoType.Iso && !video.IsoType.HasValue)
            {
                return Task.FromResult(new DynamicImageResponse { HasImage = false });
            }

            // Can't extract if we didn't find a video stream in the file
            if (!video.DefaultVideoStreamIndex.HasValue)
            {
                _logger.Info("Skipping image extraction due to missing DefaultVideoStreamIndex for {0}.", video.Path ?? string.Empty);
                return Task.FromResult(new DynamicImageResponse { HasImage = false });
            }

            return GetVideoImage(video, cancellationToken);
        }
开发者ID:rezafouladian,项目名称:Emby,代码行数:25,代码来源:VideoImageProvider.cs


示例19: GetImages

        public Task<IEnumerable<RemoteImageInfo>> GetImages(IHasImages item, CancellationToken cancellationToken)
        {
            var list = new List<RemoteImageInfo>();

            RemoteImageInfo info = null;

            var musicBrainzId = item is MusicAlbum ?
                item.GetProviderId(MetadataProviders.MusicBrainzAlbum) :
                item.GetProviderId(MetadataProviders.MusicBrainzArtist);

            if (!string.IsNullOrEmpty(musicBrainzId))
            {
                var cachePath = Path.Combine(_config.ApplicationPaths.CachePath, "lastfm", musicBrainzId, "image.txt");

                try
                {
                    var parts = File.ReadAllText(cachePath).Split('|');

                    info = GetInfo(parts.FirstOrDefault(), parts.LastOrDefault());
                }
                catch (DirectoryNotFoundException)
                {
                }
                catch (FileNotFoundException)
                {
                }
            }

            if (info ==  null)
            {
                var musicBrainzReleaseGroupId = item.GetProviderId(MetadataProviders.MusicBrainzReleaseGroup);

                if (!string.IsNullOrEmpty(musicBrainzReleaseGroupId))
                {
                    var cachePath = Path.Combine(_config.ApplicationPaths.CachePath, "lastfm", musicBrainzReleaseGroupId, "image.txt");

                    try
                    {
                        var parts = File.ReadAllText(cachePath).Split('|');

                        info = GetInfo(parts.FirstOrDefault(), parts.LastOrDefault());
                    }
                    catch (DirectoryNotFoundException)
                    {
                    }
                    catch (FileNotFoundException)
                    {
                    }
                }
            }

            if (info != null)
            {
                list.Add(info);
            }

            // The only info we have is size
            return Task.FromResult<IEnumerable<RemoteImageInfo>>(list.OrderByDescending(i => i.Width ?? 0));
        }
开发者ID:Inspirony,项目名称:Emby.Plugins,代码行数:59,代码来源:LastfmImageProvider.cs


示例20: GetImage

        public async Task<DynamicImageResponse> GetImage(IHasImages item, ImageType type, CancellationToken cancellationToken)
        {
            var liveTvItem = (LiveTvProgram)item;

            var imageResponse = new DynamicImageResponse();

            if (!string.IsNullOrEmpty(liveTvItem.ProviderImagePath))
            {
                imageResponse.Path = liveTvItem.ProviderImagePath;
                imageResponse.HasImage = true;
            }
            else if (!string.IsNullOrEmpty(liveTvItem.ProviderImageUrl))
            {
                var options = new HttpRequestOptions
                {
                    CancellationToken = cancellationToken,
                    Url = liveTvItem.ProviderImageUrl
                };

                var response = await _httpClient.GetResponse(options).ConfigureAwait(false);

                if (response.ContentType.StartsWith("image/", StringComparison.OrdinalIgnoreCase))
                {
                    imageResponse.HasImage = true;
                    imageResponse.Stream = response.Content;
                    imageResponse.SetFormatFromMimeType(response.ContentType);
                }
                else
                {
                    _logger.Error("Provider did not return an image content type.");
                }
            }
            else if (liveTvItem.HasProviderImage ?? true)
            {
                var service = _liveTvManager.Services.FirstOrDefault(i => string.Equals(i.Name, liveTvItem.ServiceName, StringComparison.OrdinalIgnoreCase));

                if (service != null)
                {
                    try
                    {
                        var channel = _liveTvManager.GetInternalChannel(liveTvItem.ChannelId);

                        var response = await service.GetProgramImageAsync(liveTvItem.ExternalId, channel.ExternalId, cancellationToken).ConfigureAwait(false);

                        if (response != null)
                        {
                            imageResponse.HasImage = true;
                            imageResponse.Stream = response.Stream;
                            imageResponse.Format = response.Format;
                        }
                    }
                    catch (NotImplementedException)
                    {
                    }
                }
            }

            return imageResponse;
        }
开发者ID:jrags56,项目名称:MediaBrowser,代码行数:59,代码来源:ProgramImageProvider.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# IHasMetadata类代码示例发布时间:2022-05-24
下一篇:
C# IHardwareResources类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap