fixed validation not refreshing virtual items

This commit is contained in:
Luke Pulverenti 2013-12-26 19:52:36 -05:00
parent 809ed093e8
commit 39e8411594

View File

@ -8,7 +8,6 @@ using MediaBrowser.Model.Entities;
using MoreLinq;
using System;
using System.Collections;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.IO;
using System.Linq;
@ -365,14 +364,12 @@ namespace MediaBrowser.Controller.Entities
{
var locationType = LocationType;
// Nothing to do here
if (locationType == LocationType.Remote || locationType == LocationType.Virtual)
{
return;
}
cancellationToken.ThrowIfCancellationRequested();
var validChildren = new List<Tuple<BaseItem, bool>>();
if (locationType != LocationType.Remote && locationType != LocationType.Virtual)
{
IEnumerable<BaseItem> nonCachedChildren;
try
@ -394,7 +391,6 @@ namespace MediaBrowser.Controller.Entities
var currentChildren = ActualChildren.ToDictionary(i => i.Id);
//create a list for our validated children
var validChildren = new List<Tuple<BaseItem, bool>>();
var newItems = new List<BaseItem>();
cancellationToken.ThrowIfCancellationRequested();
@ -451,10 +447,10 @@ namespace MediaBrowser.Controller.Entities
item.LocationType == LocationType.Remote)
{
// Don't remove these because there's no way to accurately validate them.
continue;
validChildren.Add(new Tuple<BaseItem, bool>(item, false));
}
if (!string.IsNullOrEmpty(item.Path) && IsPathOffline(item.Path))
else if (!string.IsNullOrEmpty(item.Path) && IsPathOffline(item.Path))
{
item.IsOffline = true;
@ -483,6 +479,11 @@ namespace MediaBrowser.Controller.Entities
await ItemRepository.SaveChildren(Id, ActualChildren.Select(i => i.Id).ToList(), cancellationToken).ConfigureAwait(false);
}
}
else
{
validChildren.AddRange(ActualChildren.Select(i => new Tuple<BaseItem, bool>(i, false)));
}
progress.Report(10);