reduce rescanning due to IsOffline

This commit is contained in:
Luke Pulverenti
2016-08-24 02:13:15 -04:00
parent 2e65c32ede
commit e4851e1b25
16 changed files with 51 additions and 85 deletions

View File

@@ -281,6 +281,20 @@ namespace MediaBrowser.Controller.Entities
}
}
public Task UpdateIsOffline(bool newValue)
{
var item = this;
if (item.IsOffline != newValue)
{
item.IsOffline = newValue;
// this is creating too many repeated db updates
//return item.UpdateToRepository(ItemUpdateType.None, CancellationToken.None);
}
return Task.FromResult(true);
}
/// <summary>
/// Gets or sets the type of the location.
/// </summary>
@@ -290,10 +304,10 @@ namespace MediaBrowser.Controller.Entities
{
get
{
if (IsOffline)
{
return LocationType.Offline;
}
//if (IsOffline)
//{
// return LocationType.Offline;
//}
if (string.IsNullOrWhiteSpace(Path))
{

View File

@@ -375,7 +375,7 @@ namespace MediaBrowser.Controller.Entities
if (currentChildren.TryGetValue(child.Id, out currentChild) && IsValidFromResolver(currentChild, child))
{
await UpdateIsOffline(currentChild, false).ConfigureAwait(false);
await currentChild.UpdateIsOffline(false).ConfigureAwait(false);
validChildren.Add(currentChild);
continue;
@@ -404,7 +404,7 @@ namespace MediaBrowser.Controller.Entities
else if (!string.IsNullOrEmpty(item.Path) && IsPathOffline(item.Path))
{
await UpdateIsOffline(item, true).ConfigureAwait(false);
await item.UpdateIsOffline(true).ConfigureAwait(false);
}
else
{
@@ -461,17 +461,6 @@ namespace MediaBrowser.Controller.Entities
progress.Report(100);
}
private Task UpdateIsOffline(BaseItem item, bool newValue)
{
if (item.IsOffline != newValue)
{
item.IsOffline = newValue;
return item.UpdateToRepository(ItemUpdateType.None, CancellationToken.None);
}
return Task.FromResult(true);
}
private async Task RefreshMetadataRecursive(MetadataRefreshOptions refreshOptions, bool recursive, IProgress<double> progress, CancellationToken cancellationToken)
{
var children = ActualChildren.ToList();

View File

@@ -134,5 +134,6 @@ namespace MediaBrowser.Controller.MediaEncoding
Task UpdateEncoderPath(string path, string pathType);
bool SupportsEncoder(string encoder);
bool IsDefaultEncoderPath { get; }
}
}