本文整理汇总了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));
}
示例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);
}
示例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>();
}
示例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;
}
示例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>();
}
示例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);
}
示例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>();
}
示例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;
}