change cast icon state appropriately
This commit is contained in:
parent
88b4a8f6e6
commit
3d4a3c9cb8
|
@ -375,6 +375,28 @@ namespace MediaBrowser.Controller.Entities
|
|||
}
|
||||
}
|
||||
|
||||
private Dictionary<Guid, BaseItem> GetActualChildrenDictionary()
|
||||
{
|
||||
var dictionary = new Dictionary<Guid, BaseItem>();
|
||||
|
||||
foreach (var child in ActualChildren)
|
||||
{
|
||||
var id = child.Id;
|
||||
if (dictionary.ContainsKey(id))
|
||||
{
|
||||
Logger.Error( "Found folder containing items with duplicate id. Path: {0}, Child Name: {1}",
|
||||
Path ?? Name,
|
||||
child.Path ?? child.Name);
|
||||
}
|
||||
else
|
||||
{
|
||||
dictionary[id] = child;
|
||||
}
|
||||
}
|
||||
|
||||
return dictionary;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Validates the children internal.
|
||||
/// </summary>
|
||||
|
@ -413,7 +435,7 @@ namespace MediaBrowser.Controller.Entities
|
|||
progress.Report(5);
|
||||
|
||||
//build a dictionary of the current children we have now by Id so we can compare quickly and easily
|
||||
var currentChildren = ActualChildren.ToDictionary(i => i.Id);
|
||||
var currentChildren = GetActualChildrenDictionary();
|
||||
|
||||
//create a list for our validated children
|
||||
var newItems = new List<BaseItem>();
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
using MediaBrowser.Controller.Library;
|
||||
using MediaBrowser.Controller.Resolvers;
|
||||
using MediaBrowser.Model.Entities;
|
||||
using System;
|
||||
|
||||
namespace MediaBrowser.Server.Implementations.Library.Resolvers.Audio
|
||||
{
|
||||
|
@ -30,7 +32,13 @@ namespace MediaBrowser.Server.Implementations.Library.Resolvers.Audio
|
|||
{
|
||||
if (EntityResolutionHelper.IsAudioFile(args.Path))
|
||||
{
|
||||
return new Controller.Entities.Audio.Audio();
|
||||
var collectionType = args.GetCollectionType();
|
||||
|
||||
if (string.Equals(collectionType, CollectionType.Music, StringComparison.OrdinalIgnoreCase) ||
|
||||
string.IsNullOrEmpty(collectionType))
|
||||
{
|
||||
return new Controller.Entities.Audio.Audio();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -345,26 +345,10 @@ namespace MediaBrowser.ServerApplication
|
|||
|
||||
foreach (var folder in folders)
|
||||
{
|
||||
MigrateUserFolder(folder);
|
||||
Directory.Delete(folder.FullName, true);
|
||||
}
|
||||
}
|
||||
|
||||
private void MigrateUserFolder(DirectoryInfo folder)
|
||||
{
|
||||
var foldersInDefault = new DirectoryInfo(ApplicationPaths.DefaultUserViewsPath).EnumerateDirectories("*", SearchOption.TopDirectoryOnly).ToList();
|
||||
|
||||
var foldersInUserView = folder.EnumerateDirectories("*", SearchOption.TopDirectoryOnly).ToList();
|
||||
|
||||
var foldersToMove = foldersInUserView.Where(i => !foldersInDefault.Any(f => string.Equals(f.Name, i.Name, StringComparison.OrdinalIgnoreCase))).ToList();
|
||||
|
||||
foreach (var folderToMove in foldersToMove)
|
||||
{
|
||||
folderToMove.MoveTo(Path.Combine(ApplicationPaths.DefaultUserViewsPath, folderToMove.Name));
|
||||
}
|
||||
|
||||
Directory.Delete(folder.FullName, true);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Registers resources that classes will depend on
|
||||
/// </summary>
|
||||
|
|
Loading…
Reference in New Issue
Block a user