#712 - group multiple versions

This commit is contained in:
Luke Pulverenti
2014-03-20 11:55:22 -04:00
parent e18e7c2b6e
commit 0d518ebf17
8 changed files with 217 additions and 106 deletions

View File

@@ -130,7 +130,6 @@ namespace MediaBrowser.Controller.Entities
}
private List<LinkedChild> _linkedChildren;
/// <summary>
/// Our children are actually just references to the ones in the physical root...
/// </summary>
@@ -145,21 +144,9 @@ namespace MediaBrowser.Controller.Entities
}
private List<LinkedChild> GetLinkedChildrenInternal()
{
Dictionary<string, string> locationsDicionary;
try
{
locationsDicionary = PhysicalLocations.Distinct(StringComparer.OrdinalIgnoreCase).ToDictionary(i => i, StringComparer.OrdinalIgnoreCase);
}
catch (IOException ex)
{
Logger.ErrorException("Error getting ResolveArgs for {0}", ex, Path);
return new List<LinkedChild>();
}
return LibraryManager.RootFolder.Children
.OfType<Folder>()
.Where(i => i.Path != null && locationsDicionary.ContainsKey(i.Path))
.Where(i => i.Path != null && PhysicalLocations.Contains(i.Path, StringComparer.OrdinalIgnoreCase))
.SelectMany(c => c.LinkedChildren)
.ToList();
}
@@ -177,22 +164,10 @@ namespace MediaBrowser.Controller.Entities
private IEnumerable<BaseItem> GetActualChildren()
{
Dictionary<string, string> locationsDicionary;
try
{
locationsDicionary = PhysicalLocations.Distinct(StringComparer.OrdinalIgnoreCase).ToDictionary(i => i, StringComparer.OrdinalIgnoreCase);
}
catch (IOException ex)
{
Logger.ErrorException("Error getting ResolveArgs for {0}", ex, Path);
return new BaseItem[] { };
}
return
LibraryManager.RootFolder.Children
.OfType<Folder>()
.Where(i => i.Path != null && locationsDicionary.ContainsKey(i.Path))
.Where(i => i.Path != null && PhysicalLocations.Contains(i.Path, StringComparer.OrdinalIgnoreCase))
.SelectMany(c => c.Children)
.ToList();
}

View File

@@ -446,24 +446,31 @@ namespace MediaBrowser.Controller.Entities
{
BaseItem currentChild;
if (currentChildren.TryGetValue(child.Id, out currentChild) && IsValidFromResolver(currentChild, child))
if (currentChildren.TryGetValue(child.Id, out currentChild))
{
var currentChildLocationType = currentChild.LocationType;
if (currentChildLocationType != LocationType.Remote &&
currentChildLocationType != LocationType.Virtual)
if (IsValidFromResolver(currentChild, child))
{
currentChild.DateModified = child.DateModified;
}
var currentChildLocationType = currentChild.LocationType;
if (currentChildLocationType != LocationType.Remote &&
currentChildLocationType != LocationType.Virtual)
{
currentChild.DateModified = child.DateModified;
}
currentChild.IsOffline = false;
currentChild.IsOffline = false;
validChildren.Add(currentChild);
}
else
{
validChildren.Add(child);
}
}
else
{
//brand new item - needs to be added
// Brand new item - needs to be added
newItems.Add(child);
validChildren.Add(child);
}
validChildren.Add(currentChild);
}
// If any items were added or removed....
@@ -736,7 +743,7 @@ namespace MediaBrowser.Controller.Entities
/// <returns>BaseItem.</returns>
private BaseItem RetrieveChild(Guid child)
{
var item = LibraryManager.RetrieveItem(child);
var item = LibraryManager.GetItemById(child);
if (item != null)
{