本文整理汇总了C#中MediaBrowser.Controller.Providers.BaseProviderInfo类的典型用法代码示例。如果您正苦于以下问题:C# BaseProviderInfo类的具体用法?C# BaseProviderInfo怎么用?C# BaseProviderInfo使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
BaseProviderInfo类属于MediaBrowser.Controller.Providers命名空间,在下文中一共展示了BaseProviderInfo类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: FetchAsync
public override async Task<bool> FetchAsync(BaseItem item, bool force, BaseProviderInfo providerInfo, CancellationToken cancellationToken)
{
if (item.HasImage(ImageType.Primary))
{
SetLastRefreshed(item, DateTime.UtcNow, providerInfo);
return true;
}
var changed = true;
try
{
changed = await DownloadImage((LiveTvProgram)item, cancellationToken).ConfigureAwait(false);
}
catch (HttpException ex)
{
// Don't fail the provider on a 404
if (!ex.StatusCode.HasValue || ex.StatusCode.Value != HttpStatusCode.NotFound)
{
throw;
}
}
if (changed)
{
SetLastRefreshed(item, DateTime.UtcNow, providerInfo);
}
return changed;
}
示例2: NeedsRefreshInternal
/// <summary>
/// Needses the refresh internal.
/// </summary>
/// <param name="item">The item.</param>
/// <param name="providerInfo">The provider info.</param>
/// <returns><c>true</c> if XXXX, <c>false</c> otherwise</returns>
protected override bool NeedsRefreshInternal(BaseItem item, BaseProviderInfo providerInfo)
{
if (string.IsNullOrEmpty(item.GetProviderId(MetadataProviders.Tvdb)))
{
return false;
}
if (!ConfigurationManager.Configuration.DownloadSeriesImages.Art &&
!ConfigurationManager.Configuration.DownloadSeriesImages.Logo &&
!ConfigurationManager.Configuration.DownloadSeriesImages.Thumb &&
!ConfigurationManager.Configuration.DownloadSeriesImages.Backdrops &&
!ConfigurationManager.Configuration.DownloadSeriesImages.Banner)
{
return false;
}
if (item.HasImage(ImageType.Art) &&
item.HasImage(ImageType.Logo) &&
item.HasImage(ImageType.Banner) &&
item.HasImage(ImageType.Thumb) &&
item.BackdropImagePaths.Count > 0)
{
return false;
}
return base.NeedsRefreshInternal(item, providerInfo);
}
示例3: FetchAsync
public override Task<bool> FetchAsync(BaseItem item, bool force, CancellationToken cancellationToken)
{
var artist = (MusicArtist)item;
BaseProviderInfo data;
if (!item.ProviderData.TryGetValue(Id, out data))
{
data = new BaseProviderInfo();
item.ProviderData[Id] = data;
}
var songs = artist.RecursiveChildren.OfType<Audio>().ToList();
if (!item.LockedFields.Contains(MetadataFields.Genres))
{
artist.Genres = songs.SelectMany(i => i.Genres)
.Distinct(StringComparer.OrdinalIgnoreCase)
.ToList();
}
data.FileStamp = GetComparisonData(songs);
SetLastRefreshed(item, DateTime.UtcNow);
return TrueTaskResult;
}
示例4: FetchLastfmData
protected override async Task FetchLastfmData(BaseItem item, string id, CancellationToken cancellationToken)
{
var result = await GetAlbumResult(item, cancellationToken).ConfigureAwait(false);
if (result != null && result.album != null)
{
LastfmHelper.ProcessAlbumData(item, result.album);
//And save locally if indicated
if (ConfigurationManager.Configuration.SaveLocalMeta)
{
var ms = new MemoryStream();
JsonSerializer.SerializeToStream(result.album, ms);
cancellationToken.ThrowIfCancellationRequested();
await _providerManager.SaveToLibraryFilesystem(item, Path.Combine(item.MetaLocation, LocalMetaFileName), ms, cancellationToken).ConfigureAwait(false);
}
}
BaseProviderInfo data;
if (!item.ProviderData.TryGetValue(Id, out data))
{
data = new BaseProviderInfo();
item.ProviderData[Id] = data;
}
data.Data = GetComparisonData(item as MusicAlbum);
}
示例5: FetchAsync
public override async Task<bool> FetchAsync(BaseItem item, bool force, BaseProviderInfo providerInfo, CancellationToken cancellationToken)
{
var releaseId = item.GetProviderId(MetadataProviders.Musicbrainz);
var releaseGroupId = item.GetProviderId(MetadataProviders.MusicBrainzReleaseGroup);
if (string.IsNullOrEmpty(releaseId))
{
var result = await GetReleaseResult((MusicAlbum)item, cancellationToken).ConfigureAwait(false);
if (!string.IsNullOrEmpty(result.ReleaseId))
{
releaseId = result.ReleaseId;
item.SetProviderId(MetadataProviders.Musicbrainz, releaseId);
}
if (!string.IsNullOrEmpty(result.ReleaseGroupId))
{
releaseGroupId = result.ReleaseGroupId;
item.SetProviderId(MetadataProviders.MusicBrainzReleaseGroup, releaseGroupId);
}
}
// If we have a release Id but not a release group Id...
if (!string.IsNullOrEmpty(releaseId) && string.IsNullOrEmpty(releaseGroupId))
{
releaseGroupId = await GetReleaseGroupId(releaseId, cancellationToken).ConfigureAwait(false);
item.SetProviderId(MetadataProviders.MusicBrainzReleaseGroup, releaseGroupId);
}
SetLastRefreshed(item, DateTime.UtcNow, providerInfo);
return true;
}
示例6: FetchAsync
/// <summary>
/// Fetches metadata and returns true or false indicating if any work that requires persistence was done
/// </summary>
/// <param name="item">The item.</param>
/// <param name="force">if set to <c>true</c> [force].</param>
/// <param name="cancellationToken">The cancellation token.</param>
/// <returns>Task{System.Boolean}.</returns>
public override async Task<bool> FetchAsync(BaseItem item, bool force, BaseProviderInfo providerInfo, CancellationToken cancellationToken)
{
cancellationToken.ThrowIfCancellationRequested();
var metadataFile = item.ResolveArgs.GetMetaFileByPath(Path.Combine(item.MetaLocation, XmlFileName));
if (metadataFile != null)
{
var path = metadataFile.FullName;
await XmlParsingResourcePool.WaitAsync(cancellationToken).ConfigureAwait(false);
try
{
new BaseItemXmlParser<Person>(Logger).Fetch((Person)item, path, cancellationToken);
}
finally
{
XmlParsingResourcePool.Release();
}
SetLastRefreshed(item, DateTime.UtcNow, providerInfo);
return true;
}
return false;
}
示例7: FetchAsync
/// <summary>
/// Fetches metadata and returns true or false indicating if any work that requires persistence was done
/// </summary>
/// <param name="item">The item.</param>
/// <param name="force">if set to <c>true</c> [force].</param>
/// <param name="cancellationToken">The cancellation token.</param>
/// <returns>Task{System.Boolean}.</returns>
public override async Task<bool> FetchAsync(BaseItem item, bool force, BaseProviderInfo providerInfo, CancellationToken cancellationToken)
{
cancellationToken.ThrowIfCancellationRequested();
var path = MovieXmlSaver.GetMovieSavePath(item);
if (File.Exists(path))
{
await XmlParsingResourcePool.WaitAsync(cancellationToken).ConfigureAwait(false);
try
{
var video = (Video)item;
await new MovieXmlParser(Logger, _itemRepo).FetchAsync(video, path, cancellationToken).ConfigureAwait(false);
}
finally
{
XmlParsingResourcePool.Release();
}
}
SetLastRefreshed(item, DateTime.UtcNow, providerInfo);
return true;
}
示例8: FetchAsync
/// <summary>
/// Fetches metadata and returns true or false indicating if any work that requires persistence was done
/// </summary>
/// <param name="item">The item.</param>
/// <param name="force">if set to <c>true</c> [force].</param>
/// <param name="cancellationToken">The cancellation token.</param>
/// <returns>Task{System.Boolean}.</returns>
public override async Task<bool> FetchAsync(BaseItem item, bool force, BaseProviderInfo providerInfo, CancellationToken cancellationToken)
{
cancellationToken.ThrowIfCancellationRequested();
var metadataFile = Path.Combine(item.MetaLocation, Path.ChangeExtension(Path.GetFileName(item.Path), ".xml"));
var file = item.ResolveArgs.Parent.ResolveArgs.GetMetaFileByPath(metadataFile);
if (file != null)
{
await XmlParsingResourcePool.WaitAsync(cancellationToken).ConfigureAwait(false);
try
{
await new EpisodeXmlParser(Logger, _itemRepo).FetchAsync((Episode)item, metadataFile, cancellationToken).ConfigureAwait(false);
}
finally
{
XmlParsingResourcePool.Release();
}
}
SetLastRefreshed(item, DateTime.UtcNow, providerInfo);
return true;
}
示例9: NeedsRefreshInternal
protected override bool NeedsRefreshInternal(BaseItem item, BaseProviderInfo providerInfo)
{
if (HasAltMeta(item))
return false;
return base.NeedsRefreshInternal(item, providerInfo);
}
示例10: FetchAsync
/// <summary>
///
/// </summary>
/// <param name="item"></param>
/// <param name="force"></param>
/// <param name="providerInfo"></param>
/// <param name="cancellationToken"></param>
/// <returns></returns>
public override async Task<bool> FetchAsync(BaseItem item, bool force, BaseProviderInfo providerInfo, CancellationToken cancellationToken)
{
await Fetch(item, providerInfo, cancellationToken).ConfigureAwait(false);
SetLastRefreshed(item, DateTime.UtcNow, providerInfo);
return true;
}
示例11: FetchAsync
/// <summary>
/// Fetches metadata and returns true or false indicating if any work that requires persistence was done
/// </summary>
/// <param name="item">The item.</param>
/// <param name="force">if set to <c>true</c> [force].</param>
/// <param name="providerInfo">The provider information.</param>
/// <param name="cancellationToken">The cancellation token.</param>
/// <returns>Task{System.Boolean}.</returns>
public override Task<bool> FetchAsync(BaseItem item, bool force, BaseProviderInfo providerInfo, CancellationToken cancellationToken)
{
item.IndexNumber = TVUtils.GetSeasonNumberFromPath(item.Path);
SetLastRefreshed(item, DateTime.UtcNow, providerInfo);
return TrueTaskResult;
}
示例12: NeedsRefreshInternal
protected override bool NeedsRefreshInternal(BaseItem item, BaseProviderInfo providerInfo)
{
//if (HasLocalMeta(item))
// return false;
//return base.NeedsRefreshInternal(item, providerInfo);
return false;
}
示例13: NeedsRefreshInternal
/// <summary>
/// Needses the refresh internal.
/// </summary>
/// <param name="item">The item.</param>
/// <param name="providerInfo">The provider info.</param>
/// <returns><c>true</c> if XXXX, <c>false</c> otherwise</returns>
protected override bool NeedsRefreshInternal(BaseItem item, BaseProviderInfo providerInfo)
{
if (GetComparisonData(item) != providerInfo.Data)
{
return true;
}
return base.NeedsRefreshInternal(item, providerInfo);
}
示例14: NeedsRefreshInternal
/// <summary>
/// Needses the refresh internal.
/// </summary>
/// <param name="item">The item.</param>
/// <param name="providerInfo">The provider info.</param>
/// <returns><c>true</c> if XXXX, <c>false</c> otherwise</returns>
protected override bool NeedsRefreshInternal(BaseItem item, BaseProviderInfo providerInfo)
{
if (string.IsNullOrEmpty(item.GetProviderId(MetadataProviders.Tvdb)))
{
return false;
}
return base.NeedsRefreshInternal(item, providerInfo);
}
示例15: NeedsRefreshInternal
// Need to re-override to jump over intermediate implementation
/// <summary>
/// Needses the refresh internal.
/// </summary>
/// <param name="item">The item.</param>
/// <param name="providerInfo">The provider info.</param>
/// <returns><c>true</c> if XXXX, <c>false</c> otherwise</returns>
protected override bool NeedsRefreshInternal(BaseItem item, BaseProviderInfo providerInfo)
{
if (!item.ResolveArgs.ContainsMetaFileByName(MetaFileName))
{
return false;
}
return CompareDate(item) > providerInfo.LastRefreshed;
}