converted season providers

This commit is contained in:
Luke Pulverenti
2014-02-03 00:35:43 -05:00
parent 6261f157f3
commit 30ebfab8e0
37 changed files with 526 additions and 893 deletions

View File

@@ -784,11 +784,19 @@ namespace MediaBrowser.Controller.Entities
ResetResolveArgs();
}
await BeforeRefreshMetadata(options, cancellationToken).ConfigureAwait(false);
await ProviderManager.RefreshMetadata(this, options, cancellationToken).ConfigureAwait(false);
return false;
}
private readonly Task _cachedTask = Task.FromResult(true);
protected virtual Task BeforeRefreshMetadata(MetadataRefreshOptions options, CancellationToken cancellationToken)
{
return _cachedTask;
}
[Obsolete]
public virtual async Task<bool> RefreshMetadataDirect(CancellationToken cancellationToken, bool forceSave = false, bool forceRefresh = false)
{

View File

@@ -914,11 +914,14 @@ namespace MediaBrowser.Controller.Entities
return item;
}
public override async Task<bool> RefreshMetadataDirect(CancellationToken cancellationToken, bool forceSave = false, bool forceRefresh = false)
protected override Task BeforeRefreshMetadata(MetadataRefreshOptions options, CancellationToken cancellationToken)
{
var changed = await base.RefreshMetadataDirect(cancellationToken, forceSave, forceRefresh).ConfigureAwait(false);
if (SupportsShortcutChildren && LocationType == LocationType.FileSystem)
{
RefreshLinkedChildren();
}
return (SupportsShortcutChildren && LocationType == LocationType.FileSystem && RefreshLinkedChildren()) || changed;
return base.BeforeRefreshMetadata(options, cancellationToken);
}
/// <summary>

View File

@@ -274,33 +274,6 @@ namespace MediaBrowser.Controller.Entities
serializer.SerializeToFile(Configuration, xmlPath);
}
/// <summary>
/// Refresh metadata on us by execution our provider chain
/// The item will be persisted if a change is made by a provider, or if it's new or changed.
/// </summary>
/// <param name="cancellationToken">The cancellation token.</param>
/// <param name="forceSave">if set to <c>true</c> [is new item].</param>
/// <param name="forceRefresh">if set to <c>true</c> [force].</param>
/// <returns>true if a provider reports we changed</returns>
public override async Task<bool> RefreshMetadataDirect(CancellationToken cancellationToken, bool forceSave = false, bool forceRefresh = false)
{
// Reload this
ResetResolveArgs();
var updateReason = await ProviderManager.ExecuteMetadataProviders(this, cancellationToken, forceRefresh).ConfigureAwait(false);
var changed = updateReason.HasValue;
if (changed || forceSave)
{
cancellationToken.ThrowIfCancellationRequested();
await UserManager.UpdateUser(this).ConfigureAwait(false);
}
return changed;
}
/// <summary>
/// Updates the configuration.
/// </summary>