create collections from movies page

This commit is contained in:
Luke Pulverenti
2014-06-03 23:34:36 -04:00
parent 71351344d7
commit 3640f62086
16 changed files with 182 additions and 31 deletions

View File

@@ -121,11 +121,16 @@ namespace MediaBrowser.Controller.Entities
/// <param name="refreshOptions">The refresh options.</param>
/// <param name="directoryService">The directory service.</param>
/// <returns>Task.</returns>
protected override Task ValidateChildrenInternal(IProgress<double> progress, CancellationToken cancellationToken, bool recursive, bool refreshChildMetadata, MetadataRefreshOptions refreshOptions, IDirectoryService directoryService)
protected override async Task ValidateChildrenInternal(IProgress<double> progress, CancellationToken cancellationToken, bool recursive, bool refreshChildMetadata, MetadataRefreshOptions refreshOptions, IDirectoryService directoryService)
{
var list = PhysicalLocationsList.ToList();
CreateResolveArgs(directoryService);
return NullTaskResult;
if (!list.SequenceEqual(PhysicalLocationsList))
{
await UpdateToRepository(ItemUpdateType.MetadataImport, cancellationToken).ConfigureAwait(false);
}
}
/// <summary>
@@ -164,8 +169,7 @@ namespace MediaBrowser.Controller.Entities
LibraryManager.RootFolder.Children
.OfType<Folder>()
.Where(i => i.Path != null && PhysicalLocations.Contains(i.Path, StringComparer.OrdinalIgnoreCase))
.SelectMany(c => c.Children)
.ToList();
.SelectMany(c => c.Children);
}
}
}

View File

@@ -445,6 +445,11 @@ namespace MediaBrowser.Controller.Entities
cancellationToken.ThrowIfCancellationRequested();
if (this is UserRootFolder)
{
var b = true;
}
foreach (var child in nonCachedChildren)
{
BaseItem currentChild;

View File

@@ -2,6 +2,8 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
namespace MediaBrowser.Controller.Entities
{
@@ -32,5 +34,22 @@ namespace MediaBrowser.Controller.Entities
return hasChanges;
}
protected override async Task ValidateChildrenInternal(IProgress<double> progress, CancellationToken cancellationToken, bool recursive, bool refreshChildMetadata, MetadataRefreshOptions refreshOptions, IDirectoryService directoryService)
{
await base.ValidateChildrenInternal(progress, cancellationToken, recursive, refreshChildMetadata, refreshOptions, directoryService)
.ConfigureAwait(false);
// Not the best way to handle this, but it solves an issue
// CollectionFolders aren't always getting saved after changes
// This means that grabbing the item by Id may end up returning the old one
// Fix is in two places - make sure the folder gets saved
// And here to remedy it for affected users.
// In theory this can be removed eventually.
foreach (var item in Children)
{
LibraryManager.RegisterItem(item);
}
}
}
}