|
|
|
@ -243,19 +243,17 @@ namespace MediaBrowser.Server.Implementations.EntryPoints
|
|
|
|
|
{
|
|
|
|
|
var user = _userManager.GetUserById(userId);
|
|
|
|
|
|
|
|
|
|
var collections = user.RootFolder.GetChildren(user, true).ToList();
|
|
|
|
|
|
|
|
|
|
return new LibraryUpdateInfo
|
|
|
|
|
{
|
|
|
|
|
ItemsAdded = itemsAdded.SelectMany(i => TranslatePhysicalItemToUserLibrary(i, user, collections)).Select(i => i.Id.ToString("N")).Distinct().ToList(),
|
|
|
|
|
ItemsAdded = itemsAdded.SelectMany(i => TranslatePhysicalItemToUserLibrary(i, user)).Select(i => i.Id.ToString("N")).Distinct().ToList(),
|
|
|
|
|
|
|
|
|
|
ItemsUpdated = itemsUpdated.SelectMany(i => TranslatePhysicalItemToUserLibrary(i, user, collections)).Select(i => i.Id.ToString("N")).Distinct().ToList(),
|
|
|
|
|
ItemsUpdated = itemsUpdated.SelectMany(i => TranslatePhysicalItemToUserLibrary(i, user)).Select(i => i.Id.ToString("N")).Distinct().ToList(),
|
|
|
|
|
|
|
|
|
|
ItemsRemoved = itemsRemoved.SelectMany(i => TranslatePhysicalItemToUserLibrary(i, user, collections, true)).Select(i => i.Id.ToString("N")).Distinct().ToList(),
|
|
|
|
|
ItemsRemoved = itemsRemoved.SelectMany(i => TranslatePhysicalItemToUserLibrary(i, user, true)).Select(i => i.Id.ToString("N")).Distinct().ToList(),
|
|
|
|
|
|
|
|
|
|
FoldersAddedTo = foldersAddedTo.SelectMany(i => TranslatePhysicalItemToUserLibrary(i, user, collections)).Select(i => i.Id.ToString("N")).Distinct().ToList(),
|
|
|
|
|
FoldersAddedTo = foldersAddedTo.SelectMany(i => TranslatePhysicalItemToUserLibrary(i, user)).Select(i => i.Id.ToString("N")).Distinct().ToList(),
|
|
|
|
|
|
|
|
|
|
FoldersRemovedFrom = foldersRemovedFrom.SelectMany(i => TranslatePhysicalItemToUserLibrary(i, user, collections)).Select(i => i.Id.ToString("N")).Distinct().ToList()
|
|
|
|
|
FoldersRemovedFrom = foldersRemovedFrom.SelectMany(i => TranslatePhysicalItemToUserLibrary(i, user)).Select(i => i.Id.ToString("N")).Distinct().ToList()
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -265,10 +263,9 @@ namespace MediaBrowser.Server.Implementations.EntryPoints
|
|
|
|
|
/// <typeparam name="T"></typeparam>
|
|
|
|
|
/// <param name="item">The item.</param>
|
|
|
|
|
/// <param name="user">The user.</param>
|
|
|
|
|
/// <param name="collections">The collections.</param>
|
|
|
|
|
/// <param name="includeIfNotFound">if set to <c>true</c> [include if not found].</param>
|
|
|
|
|
/// <returns>IEnumerable{``0}.</returns>
|
|
|
|
|
private IEnumerable<T> TranslatePhysicalItemToUserLibrary<T>(T item, User user, IEnumerable<BaseItem> collections, bool includeIfNotFound = false)
|
|
|
|
|
private IEnumerable<T> TranslatePhysicalItemToUserLibrary<T>(T item, User user, bool includeIfNotFound = false)
|
|
|
|
|
where T : BaseItem
|
|
|
|
|
{
|
|
|
|
|
// If the physical root changed, return the user root
|
|
|
|
@ -277,15 +274,6 @@ namespace MediaBrowser.Server.Implementations.EntryPoints
|
|
|
|
|
return new[] { user.RootFolder as T };
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Need to find what user collection folder this belongs to
|
|
|
|
|
if (item.Parent is AggregateFolder)
|
|
|
|
|
{
|
|
|
|
|
if (item.LocationType == LocationType.FileSystem)
|
|
|
|
|
{
|
|
|
|
|
return collections.Where(i => i.PhysicalLocations.Contains(item.Path)).Cast<T>();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Return it only if it's in the user's library
|
|
|
|
|
if (includeIfNotFound || item.IsVisibleStandalone(user))
|
|
|
|
|
{
|
|
|
|
|