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


C# IHasImages.GetProviderId方法代码示例

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


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

示例1: 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

示例2: GetImages

        public Task<IEnumerable<RemoteImageInfo>> GetImages(IHasImages item, CancellationToken cancellationToken)
        {
            var imdbId = item.GetProviderId(MetadataProviders.Imdb);

            var list = new List<RemoteImageInfo>();

            if (!string.IsNullOrWhiteSpace(imdbId))
            {
                list.Add(new RemoteImageInfo
                {
                    ProviderName = Name,
                    Url = string.Format("http://img.omdbapi.com/?i={0}&apikey=82e83907", imdbId)
                });
            }

            return Task.FromResult<IEnumerable<RemoteImageInfo>>(list);
        }
开发者ID:dgz,项目名称:Emby,代码行数:17,代码来源:OmdbImageProvider.cs

示例3: GetImages

        public async Task<IEnumerable<RemoteImageInfo>> GetImages(IHasImages item, CancellationToken cancellationToken)
        {
            var adeId = item.GetProviderId("AdultDvdEmpire");

            if (!string.IsNullOrEmpty(adeId))
            {
                using (var stream = await ADEMetadataProvider.Current.GetInfo(adeId, cancellationToken).ConfigureAwait(false))
                {
                    var html = stream.ToStringFromStream();

                    return GetImagesFromHtml(html);
                }

            }

            return new List<RemoteImageInfo>();
        }
开发者ID:Inspirony,项目名称:Emby.Plugins,代码行数:17,代码来源:ADERemoteImageProvider.cs

示例4: GetImages

        public async Task<IEnumerable<RemoteImageInfo>> GetImages(IHasImages item, CancellationToken cancellationToken)
        {
            var volumeId = item.GetProviderId(ComicVineVolumeExternalId.KeyName);

            var images = new List<RemoteImageInfo>();

            if (!string.IsNullOrEmpty(volumeId))
            {
                var issueNumber = ComicVineMetadataProvider.GetIssueNumberFromName(item.Name).ToString(_usCulture);

                await ComicVineMetadataProvider.Current.EnsureCacheFile(volumeId, issueNumber, cancellationToken).ConfigureAwait(false);

                var cachePath = ComicVineMetadataProvider.Current.GetCacheFilePath(volumeId, issueNumber);

                try
                {
                    var issueInfo = _jsonSerializer.DeserializeFromFile<SearchResult>(cachePath);

                    if (issueInfo.results.Count > 0)
                    {
                        var result = issueInfo.results[0].image;

                        if (!string.IsNullOrEmpty(result.medium_url))
                        {
                            images.Add(new RemoteImageInfo
                            {
                                Url = result.medium_url,
                                ProviderName = Name
                            });
                        }
                    }
                }
                catch (FileNotFoundException)
                {
                }
                catch (DirectoryNotFoundException)
                {
                }
            }

            return images;
        }
开发者ID:Inspirony,项目名称:Emby.Plugins,代码行数:42,代码来源:ComicVineImageProvider.cs

示例5: GetImages

        public async Task<IEnumerable<RemoteImageInfo>> GetImages(IHasImages item, CancellationToken cancellationToken)
        {
            var id = item.GetProviderId(MetadataProviders.MusicBrainzArtist);

            if (!string.IsNullOrWhiteSpace(id))
            {
                await AudioDbArtistProvider.Current.EnsureArtistInfo(id, cancellationToken).ConfigureAwait(false);

                var path = AudioDbArtistProvider.GetArtistInfoPath(_config.ApplicationPaths, id);

                var obj = _json.DeserializeFromFile<AudioDbArtistProvider.RootObject>(path);

                if (obj != null && obj.artists != null && obj.artists.Count > 0)
                {
                    return GetImages(obj.artists[0]);
                }
            }

            return new List<RemoteImageInfo>();
        }
开发者ID:jabbera,项目名称:MediaBrowser,代码行数:20,代码来源:AudioDbArtistImageProvider.cs

示例6: GetXmlPath

        private async Task<string> GetXmlPath(IHasImages item, CancellationToken cancellationToken)
        {
            var id = item.GetProviderId(GamesDbExternalId.KeyName);

            if (string.IsNullOrEmpty(id))
            {
                return null;
            }

            if (item is Game)
            {
                await GamesDbGameProvider.Current.EnsureCacheFile(id, cancellationToken).ConfigureAwait(false);

                return GamesDbGameProvider.Current.GetCacheFilePath(id);
            }

            await GamesDbGameSystemProvider.Current.EnsureCacheFile(id, cancellationToken).ConfigureAwait(false);

            return GamesDbGameSystemProvider.Current.GetCacheFilePath(id);
        }
开发者ID:Inspirony,项目名称:Emby.Plugins,代码行数:20,代码来源:GamesDbImageProvider.cs

示例7: GetImages

        public async Task<IEnumerable<RemoteImageInfo>> GetImages(IHasImages item, CancellationToken cancellationToken)
        {
            var tmdbId = item.GetProviderId(MetadataProviders.Tmdb);

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

                var mainResult = await MovieDbBoxSetProvider.Current.GetMovieDbResult(tmdbId, null, cancellationToken).ConfigureAwait(false);

                if (mainResult != null)
                {
                    var tmdbSettings = await MovieDbProvider.Current.GetTmdbSettings(cancellationToken).ConfigureAwait(false);

                    var tmdbImageUrl = tmdbSettings.images.secure_base_url + "original";

                    return GetImages(mainResult, language, tmdbImageUrl);
                }
            }

            return new List<RemoteImageInfo>();
        }
开发者ID:softworkz,项目名称:Emby,代码行数:22,代码来源:MovieDbBoxSetImageProvider.cs

示例8: GetImages

        public async Task<IEnumerable<RemoteImageInfo>> GetImages(IHasImages item, CancellationToken cancellationToken)
        {
            var imdbId = item.GetProviderId(MetadataProviders.Imdb);

            var list = new List<RemoteImageInfo>();

            var provider = new OmdbProvider(_jsonSerializer, _httpClient, _fileSystem, _configurationManager);

            if (!string.IsNullOrWhiteSpace(imdbId))
            {
                OmdbProvider.RootObject rootObject = await provider.GetRootObject(imdbId, cancellationToken).ConfigureAwait(false);

                if (!string.IsNullOrEmpty(rootObject.Poster))
                {
                    list.Add(new RemoteImageInfo
                    {
                        ProviderName = Name,
                        Url = string.Format("https://img.omdbapi.com/?i={0}&apikey=82e83907", imdbId)
                    });
                }
            }

            return list;
        }
开发者ID:softworkz,项目名称:Emby,代码行数:24,代码来源:OmdbImageProvider.cs


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