added FoldersAddedTo, FoldersRemovedFrom to library change info

This commit is contained in:
Luke Pulverenti 2013-05-09 16:52:37 -04:00
parent f233f9c4e5
commit 0bc15061ce
2 changed files with 14 additions and 12 deletions

View File

@ -9,10 +9,15 @@ namespace MediaBrowser.Model.Entities
public class LibraryUpdateInfo
{
/// <summary>
/// Gets or sets the folders.
/// Gets or sets the folders added to.
/// </summary>
/// <value>The folders.</value>
public List<Guid> Folders { get; set; }
/// <value>The folders added to.</value>
public List<Guid> FoldersAddedTo { get; set; }
/// <summary>
/// Gets or sets the folders removed from.
/// </summary>
/// <value>The folders removed from.</value>
public List<Guid> FoldersRemovedFrom { get; set; }
/// <summary>
/// Gets or sets the items added.
@ -37,7 +42,8 @@ namespace MediaBrowser.Model.Entities
/// </summary>
public LibraryUpdateInfo()
{
Folders = new List<Guid>();
FoldersAddedTo = new List<Guid>();
FoldersRemovedFrom = new List<Guid>();
ItemsAdded = new List<Guid>();
ItemsRemoved = new List<Guid>();
ItemsUpdated = new List<Guid>();

View File

@ -194,7 +194,7 @@ namespace MediaBrowser.ServerApplication.EntryPoints
if (e.Item.Parent != null)
{
LibraryUpdateInfo.Folders.Add(e.Item.Parent.Id);
LibraryUpdateInfo.FoldersAddedTo.Add(e.Item.Parent.Id);
}
LibraryUpdateInfo.ItemsAdded.Add(e.Item.Id);
@ -225,11 +225,6 @@ namespace MediaBrowser.ServerApplication.EntryPoints
LibraryUpdateTimer.Change(LibraryUpdateDuration, Timeout.Infinite);
}
if (e.Item.Parent != null)
{
LibraryUpdateInfo.Folders.Add(e.Item.Parent.Id);
}
LibraryUpdateInfo.ItemsUpdated.Add(e.Item.Id);
}
}
@ -260,7 +255,7 @@ namespace MediaBrowser.ServerApplication.EntryPoints
if (e.Item.Parent != null)
{
LibraryUpdateInfo.Folders.Add(e.Item.Parent.Id);
LibraryUpdateInfo.FoldersRemovedFrom.Add(e.Item.Parent.Id);
}
LibraryUpdateInfo.ItemsRemoved.Add(e.Item.Id);
@ -276,7 +271,8 @@ namespace MediaBrowser.ServerApplication.EntryPoints
lock (_libraryChangedSyncLock)
{
// Remove dupes in case some were saved multiple times
LibraryUpdateInfo.Folders = LibraryUpdateInfo.Folders.Distinct().ToList();
LibraryUpdateInfo.FoldersAddedTo = LibraryUpdateInfo.FoldersAddedTo.Distinct().ToList();
LibraryUpdateInfo.FoldersRemovedFrom = LibraryUpdateInfo.FoldersRemovedFrom.Distinct().ToList();
LibraryUpdateInfo.ItemsUpdated = LibraryUpdateInfo.ItemsUpdated.Distinct().ToList();
_serverManager.SendWebSocketMessage("LibraryChanged", LibraryUpdateInfo);