add separate entry point for new item notifier
This commit is contained in:
parent
58a5ad852b
commit
da7af24fca
|
@ -1,10 +1,9 @@
|
|||
using System.IO;
|
||||
using MediaBrowser.Controller.IO;
|
||||
using MediaBrowser.Controller.Resolvers;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text.RegularExpressions;
|
||||
using MediaBrowser.Controller.Resolvers;
|
||||
|
||||
namespace MediaBrowser.Controller.Library
|
||||
{
|
||||
|
@ -16,7 +15,7 @@ namespace MediaBrowser.Controller.Library
|
|||
/// <summary>
|
||||
/// The TVDB API key
|
||||
/// </summary>
|
||||
public static readonly string TVDBApiKey = "B89CE93890E9419B";
|
||||
public static readonly string TvdbApiKey = "B89CE93890E9419B";
|
||||
/// <summary>
|
||||
/// The banner URL
|
||||
/// </summary>
|
||||
|
@ -93,7 +92,7 @@ namespace MediaBrowser.Controller.Library
|
|||
// Look for one of the season folder names
|
||||
foreach (var name in SeasonFolderNames)
|
||||
{
|
||||
int index = path.IndexOf(name, StringComparison.OrdinalIgnoreCase);
|
||||
var index = path.IndexOf(name, StringComparison.OrdinalIgnoreCase);
|
||||
|
||||
if (index != -1)
|
||||
{
|
||||
|
@ -115,7 +114,7 @@ namespace MediaBrowser.Controller.Library
|
|||
int length = 0;
|
||||
|
||||
// Find out where the numbers start, and then keep going until they end
|
||||
for (int i = 0; i < path.Length; i++)
|
||||
for (var i = 0; i < path.Length; i++)
|
||||
{
|
||||
if (char.IsNumber(path, i))
|
||||
{
|
||||
|
|
|
@ -179,7 +179,7 @@ namespace MediaBrowser.Controller.Providers.TV
|
|||
seasonNumber = "0"; // Specials
|
||||
}
|
||||
|
||||
var url = string.Format(episodeQuery, TVUtils.TVDBApiKey, seriesId, seasonNumber, episodeNumber, ConfigurationManager.Configuration.PreferredMetadataLanguage);
|
||||
var url = string.Format(episodeQuery, TVUtils.TvdbApiKey, seriesId, seasonNumber, episodeNumber, ConfigurationManager.Configuration.PreferredMetadataLanguage);
|
||||
var doc = new XmlDocument();
|
||||
|
||||
try
|
||||
|
@ -205,7 +205,7 @@ namespace MediaBrowser.Controller.Providers.TV
|
|||
//this is basicly just for anime.
|
||||
if (!doc.HasChildNodes && Int32.Parse(seasonNumber) == 1)
|
||||
{
|
||||
url = string.Format(absEpisodeQuery, TVUtils.TVDBApiKey, seriesId, episodeNumber, ConfigurationManager.Configuration.PreferredMetadataLanguage);
|
||||
url = string.Format(absEpisodeQuery, TVUtils.TvdbApiKey, seriesId, episodeNumber, ConfigurationManager.Configuration.PreferredMetadataLanguage);
|
||||
|
||||
try
|
||||
{
|
||||
|
|
|
@ -158,7 +158,7 @@ namespace MediaBrowser.Controller.Providers.TV
|
|||
if ((season.PrimaryImagePath == null) || (!season.HasImage(ImageType.Banner)) || (season.BackdropImagePaths == null))
|
||||
{
|
||||
var images = new XmlDocument();
|
||||
var url = string.Format("http://www.thetvdb.com/api/" + TVUtils.TVDBApiKey + "/series/{0}/banners.xml", seriesId);
|
||||
var url = string.Format("http://www.thetvdb.com/api/" + TVUtils.TvdbApiKey + "/series/{0}/banners.xml", seriesId);
|
||||
|
||||
using (var imgs = await HttpClient.Get(new HttpRequestOptions
|
||||
{
|
||||
|
|
|
@ -197,7 +197,7 @@ namespace MediaBrowser.Controller.Providers.TV
|
|||
if (!string.IsNullOrEmpty(seriesId))
|
||||
{
|
||||
|
||||
string url = string.Format(seriesGet, TVUtils.TVDBApiKey, seriesId, ConfigurationManager.Configuration.PreferredMetadataLanguage);
|
||||
string url = string.Format(seriesGet, TVUtils.TvdbApiKey, seriesId, ConfigurationManager.Configuration.PreferredMetadataLanguage);
|
||||
var doc = new XmlDocument();
|
||||
|
||||
try
|
||||
|
@ -296,7 +296,7 @@ namespace MediaBrowser.Controller.Providers.TV
|
|||
/// <returns>Task.</returns>
|
||||
private async Task FetchActors(Series series, string seriesId, XmlDocument doc, CancellationToken cancellationToken)
|
||||
{
|
||||
string urlActors = string.Format(getActors, TVUtils.TVDBApiKey, seriesId);
|
||||
string urlActors = string.Format(getActors, TVUtils.TvdbApiKey, seriesId);
|
||||
var docActors = new XmlDocument();
|
||||
|
||||
try
|
||||
|
@ -377,7 +377,7 @@ namespace MediaBrowser.Controller.Providers.TV
|
|||
{
|
||||
if ((!string.IsNullOrEmpty(seriesId)) && ((series.PrimaryImagePath == null) || (series.BackdropImagePaths == null)))
|
||||
{
|
||||
string url = string.Format("http://www.thetvdb.com/api/" + TVUtils.TVDBApiKey + "/series/{0}/banners.xml", seriesId);
|
||||
string url = string.Format("http://www.thetvdb.com/api/" + TVUtils.TvdbApiKey + "/series/{0}/banners.xml", seriesId);
|
||||
var images = new XmlDocument();
|
||||
|
||||
try
|
||||
|
|
|
@ -378,19 +378,16 @@ namespace MediaBrowser.ServerApplication
|
|||
RegisterServerWithAdministratorAccess();
|
||||
}
|
||||
|
||||
base.FindParts();
|
||||
|
||||
HttpServer.Init(GetExports<IRestfulService>(false));
|
||||
|
||||
ServerManager.AddWebSocketListeners(GetExports<IWebSocketListener>(false));
|
||||
|
||||
StartServer(true);
|
||||
|
||||
Parallel.Invoke(
|
||||
|
||||
() => base.FindParts(),
|
||||
|
||||
() =>
|
||||
{
|
||||
HttpServer.Init(GetExports<IRestfulService>(false));
|
||||
|
||||
ServerManager.AddWebSocketListeners(GetExports<IWebSocketListener>(false));
|
||||
|
||||
StartServer(true);
|
||||
},
|
||||
|
||||
() => LibraryManager.AddParts(GetExports<IResolverIgnoreRule>(), GetExports<IVirtualFolderCreator>(), GetExports<IItemResolver>(), GetExports<IIntroProvider>(), GetExports<IBaseItemComparer>()),
|
||||
|
||||
() => ProviderManager.AddMetadataProviders(GetExports<BaseMetadataProvider>().ToArray()),
|
||||
|
|
|
@ -0,0 +1,210 @@
|
|||
using MediaBrowser.Common.Net;
|
||||
using MediaBrowser.Controller.Library;
|
||||
using MediaBrowser.Controller.Plugins;
|
||||
using MediaBrowser.Controller.Session;
|
||||
using MediaBrowser.Model.Entities;
|
||||
using System.Linq;
|
||||
using System.Threading;
|
||||
|
||||
namespace MediaBrowser.ServerApplication.EntryPoints
|
||||
{
|
||||
public class LibraryChangedNotifier : IServerEntryPoint
|
||||
{
|
||||
/// <summary>
|
||||
/// The _library manager
|
||||
/// </summary>
|
||||
private readonly ILibraryManager _libraryManager;
|
||||
|
||||
private readonly ISessionManager _sessionManager;
|
||||
private readonly IServerManager _serverManager;
|
||||
|
||||
/// <summary>
|
||||
/// The _library changed sync lock
|
||||
/// </summary>
|
||||
private readonly object _libraryChangedSyncLock = new object();
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the library update info.
|
||||
/// </summary>
|
||||
/// <value>The library update info.</value>
|
||||
private LibraryUpdateInfo LibraryUpdateInfo { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the library update timer.
|
||||
/// </summary>
|
||||
/// <value>The library update timer.</value>
|
||||
private Timer LibraryUpdateTimer { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The library update duration
|
||||
/// </summary>
|
||||
private const int LibraryUpdateDuration = 60000;
|
||||
|
||||
public LibraryChangedNotifier(ILibraryManager libraryManager, ISessionManager sessionManager, IServerManager serverManager)
|
||||
{
|
||||
_libraryManager = libraryManager;
|
||||
_sessionManager = sessionManager;
|
||||
_serverManager = serverManager;
|
||||
}
|
||||
|
||||
public void Run()
|
||||
{
|
||||
_libraryManager.ItemAdded += libraryManager_ItemAdded;
|
||||
_libraryManager.ItemUpdated += libraryManager_ItemUpdated;
|
||||
_libraryManager.ItemRemoved += libraryManager_ItemRemoved;
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Handles the ItemAdded event of the libraryManager control.
|
||||
/// </summary>
|
||||
/// <param name="sender">The source of the event.</param>
|
||||
/// <param name="e">The <see cref="ItemChangeEventArgs"/> instance containing the event data.</param>
|
||||
void libraryManager_ItemAdded(object sender, ItemChangeEventArgs e)
|
||||
{
|
||||
lock (_libraryChangedSyncLock)
|
||||
{
|
||||
if (LibraryUpdateInfo == null)
|
||||
{
|
||||
LibraryUpdateInfo = new LibraryUpdateInfo();
|
||||
}
|
||||
|
||||
if (LibraryUpdateTimer == null)
|
||||
{
|
||||
LibraryUpdateTimer = new Timer(LibraryUpdateTimerCallback, null, LibraryUpdateDuration,
|
||||
Timeout.Infinite);
|
||||
}
|
||||
else
|
||||
{
|
||||
LibraryUpdateTimer.Change(LibraryUpdateDuration, Timeout.Infinite);
|
||||
}
|
||||
|
||||
if (e.Item.Parent != null)
|
||||
{
|
||||
LibraryUpdateInfo.FoldersAddedTo.Add(e.Item.Parent.Id);
|
||||
}
|
||||
|
||||
LibraryUpdateInfo.ItemsAdded.Add(e.Item.Id);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Handles the ItemUpdated event of the libraryManager control.
|
||||
/// </summary>
|
||||
/// <param name="sender">The source of the event.</param>
|
||||
/// <param name="e">The <see cref="ItemChangeEventArgs"/> instance containing the event data.</param>
|
||||
void libraryManager_ItemUpdated(object sender, ItemChangeEventArgs e)
|
||||
{
|
||||
lock (_libraryChangedSyncLock)
|
||||
{
|
||||
if (LibraryUpdateInfo == null)
|
||||
{
|
||||
LibraryUpdateInfo = new LibraryUpdateInfo();
|
||||
}
|
||||
|
||||
if (LibraryUpdateTimer == null)
|
||||
{
|
||||
LibraryUpdateTimer = new Timer(LibraryUpdateTimerCallback, null, LibraryUpdateDuration,
|
||||
Timeout.Infinite);
|
||||
}
|
||||
else
|
||||
{
|
||||
LibraryUpdateTimer.Change(LibraryUpdateDuration, Timeout.Infinite);
|
||||
}
|
||||
|
||||
LibraryUpdateInfo.ItemsUpdated.Add(e.Item.Id);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Handles the ItemRemoved event of the libraryManager control.
|
||||
/// </summary>
|
||||
/// <param name="sender">The source of the event.</param>
|
||||
/// <param name="e">The <see cref="ItemChangeEventArgs"/> instance containing the event data.</param>
|
||||
void libraryManager_ItemRemoved(object sender, ItemChangeEventArgs e)
|
||||
{
|
||||
lock (_libraryChangedSyncLock)
|
||||
{
|
||||
if (LibraryUpdateInfo == null)
|
||||
{
|
||||
LibraryUpdateInfo = new LibraryUpdateInfo();
|
||||
}
|
||||
|
||||
if (LibraryUpdateTimer == null)
|
||||
{
|
||||
LibraryUpdateTimer = new Timer(LibraryUpdateTimerCallback, null, LibraryUpdateDuration,
|
||||
Timeout.Infinite);
|
||||
}
|
||||
else
|
||||
{
|
||||
LibraryUpdateTimer.Change(LibraryUpdateDuration, Timeout.Infinite);
|
||||
}
|
||||
|
||||
if (e.Item.Parent != null)
|
||||
{
|
||||
LibraryUpdateInfo.FoldersRemovedFrom.Add(e.Item.Parent.Id);
|
||||
}
|
||||
|
||||
LibraryUpdateInfo.ItemsRemoved.Add(e.Item.Id);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Libraries the update timer callback.
|
||||
/// </summary>
|
||||
/// <param name="state">The state.</param>
|
||||
private void LibraryUpdateTimerCallback(object state)
|
||||
{
|
||||
lock (_libraryChangedSyncLock)
|
||||
{
|
||||
// Remove dupes in case some were saved multiple times
|
||||
LibraryUpdateInfo.FoldersAddedTo = LibraryUpdateInfo.FoldersAddedTo.Distinct().ToList();
|
||||
|
||||
LibraryUpdateInfo.FoldersRemovedFrom = LibraryUpdateInfo.FoldersRemovedFrom.Distinct().ToList();
|
||||
|
||||
LibraryUpdateInfo.ItemsUpdated = LibraryUpdateInfo.ItemsUpdated
|
||||
.Where(i => !LibraryUpdateInfo.ItemsAdded.Contains(i))
|
||||
.Distinct()
|
||||
.ToList();
|
||||
|
||||
_serverManager.SendWebSocketMessage("LibraryChanged", LibraryUpdateInfo);
|
||||
|
||||
if (LibraryUpdateTimer != null)
|
||||
{
|
||||
LibraryUpdateTimer.Dispose();
|
||||
LibraryUpdateTimer = null;
|
||||
}
|
||||
|
||||
LibraryUpdateInfo = null;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
|
||||
/// </summary>
|
||||
public void Dispose()
|
||||
{
|
||||
Dispose(true);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Releases unmanaged and - optionally - managed resources.
|
||||
/// </summary>
|
||||
/// <param name="dispose"><c>true</c> to release both managed and unmanaged resources; <c>false</c> to release only unmanaged resources.</param>
|
||||
protected virtual void Dispose(bool dispose)
|
||||
{
|
||||
if (dispose)
|
||||
{
|
||||
if (LibraryUpdateTimer != null)
|
||||
{
|
||||
LibraryUpdateTimer.Dispose();
|
||||
LibraryUpdateTimer = null;
|
||||
}
|
||||
|
||||
_libraryManager.ItemAdded -= libraryManager_ItemAdded;
|
||||
_libraryManager.ItemUpdated -= libraryManager_ItemUpdated;
|
||||
_libraryManager.ItemRemoved -= libraryManager_ItemRemoved;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -8,13 +8,10 @@ using MediaBrowser.Controller.Entities;
|
|||
using MediaBrowser.Controller.Library;
|
||||
using MediaBrowser.Controller.Plugins;
|
||||
using MediaBrowser.Controller.Updates;
|
||||
using MediaBrowser.Model.Entities;
|
||||
using MediaBrowser.Model.Logging;
|
||||
using MediaBrowser.Model.Tasks;
|
||||
using MediaBrowser.Model.Updates;
|
||||
using System;
|
||||
using System.Linq;
|
||||
using System.Threading;
|
||||
|
||||
namespace MediaBrowser.ServerApplication.EntryPoints
|
||||
{
|
||||
|
@ -37,11 +34,6 @@ namespace MediaBrowser.ServerApplication.EntryPoints
|
|||
/// </summary>
|
||||
private readonly IUserManager _userManager;
|
||||
|
||||
/// <summary>
|
||||
/// The _library manager
|
||||
/// </summary>
|
||||
private readonly ILibraryManager _libraryManager;
|
||||
|
||||
/// <summary>
|
||||
/// The _installation manager
|
||||
/// </summary>
|
||||
|
@ -57,40 +49,17 @@ namespace MediaBrowser.ServerApplication.EntryPoints
|
|||
/// </summary>
|
||||
private readonly ITaskManager _taskManager;
|
||||
|
||||
/// <summary>
|
||||
/// The _library changed sync lock
|
||||
/// </summary>
|
||||
private readonly object _libraryChangedSyncLock = new object();
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the library update info.
|
||||
/// </summary>
|
||||
/// <value>The library update info.</value>
|
||||
private LibraryUpdateInfo LibraryUpdateInfo { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the library update timer.
|
||||
/// </summary>
|
||||
/// <value>The library update timer.</value>
|
||||
private Timer LibraryUpdateTimer { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The library update duration
|
||||
/// </summary>
|
||||
private const int LibraryUpdateDuration = 60000;
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="WebSocketEvents" /> class.
|
||||
/// </summary>
|
||||
/// <param name="serverManager">The server manager.</param>
|
||||
/// <param name="logger">The logger.</param>
|
||||
/// <param name="userManager">The user manager.</param>
|
||||
public WebSocketEvents(IServerManager serverManager, IServerApplicationHost appHost, ILogger logger, IUserManager userManager, ILibraryManager libraryManager, IInstallationManager installationManager, ITaskManager taskManager)
|
||||
public WebSocketEvents(IServerManager serverManager, IServerApplicationHost appHost, ILogger logger, IUserManager userManager, IInstallationManager installationManager, ITaskManager taskManager)
|
||||
{
|
||||
_serverManager = serverManager;
|
||||
_logger = logger;
|
||||
_userManager = userManager;
|
||||
_libraryManager = libraryManager;
|
||||
_installationManager = installationManager;
|
||||
_appHost = appHost;
|
||||
_taskManager = taskManager;
|
||||
|
@ -103,10 +72,6 @@ namespace MediaBrowser.ServerApplication.EntryPoints
|
|||
|
||||
_appHost.HasPendingRestartChanged += kernel_HasPendingRestartChanged;
|
||||
|
||||
_libraryManager.ItemAdded += libraryManager_ItemAdded;
|
||||
_libraryManager.ItemUpdated += libraryManager_ItemUpdated;
|
||||
_libraryManager.ItemRemoved += libraryManager_ItemRemoved;
|
||||
|
||||
_installationManager.PluginUninstalled += InstallationManager_PluginUninstalled;
|
||||
_installationManager.PackageInstalling += installationManager_PackageInstalling;
|
||||
_installationManager.PackageInstallationCancelled += installationManager_PackageInstallationCancelled;
|
||||
|
@ -168,130 +133,6 @@ namespace MediaBrowser.ServerApplication.EntryPoints
|
|||
_serverManager.SendWebSocketMessage("PackageInstalling", e.Argument);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Handles the ItemAdded event of the libraryManager control.
|
||||
/// </summary>
|
||||
/// <param name="sender">The source of the event.</param>
|
||||
/// <param name="e">The <see cref="ItemChangeEventArgs"/> instance containing the event data.</param>
|
||||
void libraryManager_ItemAdded(object sender, ItemChangeEventArgs e)
|
||||
{
|
||||
lock (_libraryChangedSyncLock)
|
||||
{
|
||||
if (LibraryUpdateInfo == null)
|
||||
{
|
||||
LibraryUpdateInfo = new LibraryUpdateInfo();
|
||||
}
|
||||
|
||||
if (LibraryUpdateTimer == null)
|
||||
{
|
||||
LibraryUpdateTimer = new Timer(LibraryUpdateTimerCallback, null, LibraryUpdateDuration,
|
||||
Timeout.Infinite);
|
||||
}
|
||||
else
|
||||
{
|
||||
LibraryUpdateTimer.Change(LibraryUpdateDuration, Timeout.Infinite);
|
||||
}
|
||||
|
||||
if (e.Item.Parent != null)
|
||||
{
|
||||
LibraryUpdateInfo.FoldersAddedTo.Add(e.Item.Parent.Id);
|
||||
}
|
||||
|
||||
LibraryUpdateInfo.ItemsAdded.Add(e.Item.Id);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Handles the ItemUpdated event of the libraryManager control.
|
||||
/// </summary>
|
||||
/// <param name="sender">The source of the event.</param>
|
||||
/// <param name="e">The <see cref="ItemChangeEventArgs"/> instance containing the event data.</param>
|
||||
void libraryManager_ItemUpdated(object sender, ItemChangeEventArgs e)
|
||||
{
|
||||
lock (_libraryChangedSyncLock)
|
||||
{
|
||||
if (LibraryUpdateInfo == null)
|
||||
{
|
||||
LibraryUpdateInfo = new LibraryUpdateInfo();
|
||||
}
|
||||
|
||||
if (LibraryUpdateTimer == null)
|
||||
{
|
||||
LibraryUpdateTimer = new Timer(LibraryUpdateTimerCallback, null, LibraryUpdateDuration,
|
||||
Timeout.Infinite);
|
||||
}
|
||||
else
|
||||
{
|
||||
LibraryUpdateTimer.Change(LibraryUpdateDuration, Timeout.Infinite);
|
||||
}
|
||||
|
||||
LibraryUpdateInfo.ItemsUpdated.Add(e.Item.Id);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Handles the ItemRemoved event of the libraryManager control.
|
||||
/// </summary>
|
||||
/// <param name="sender">The source of the event.</param>
|
||||
/// <param name="e">The <see cref="ItemChangeEventArgs"/> instance containing the event data.</param>
|
||||
void libraryManager_ItemRemoved(object sender, ItemChangeEventArgs e)
|
||||
{
|
||||
lock (_libraryChangedSyncLock)
|
||||
{
|
||||
if (LibraryUpdateInfo == null)
|
||||
{
|
||||
LibraryUpdateInfo = new LibraryUpdateInfo();
|
||||
}
|
||||
|
||||
if (LibraryUpdateTimer == null)
|
||||
{
|
||||
LibraryUpdateTimer = new Timer(LibraryUpdateTimerCallback, null, LibraryUpdateDuration,
|
||||
Timeout.Infinite);
|
||||
}
|
||||
else
|
||||
{
|
||||
LibraryUpdateTimer.Change(LibraryUpdateDuration, Timeout.Infinite);
|
||||
}
|
||||
|
||||
if (e.Item.Parent != null)
|
||||
{
|
||||
LibraryUpdateInfo.FoldersRemovedFrom.Add(e.Item.Parent.Id);
|
||||
}
|
||||
|
||||
LibraryUpdateInfo.ItemsRemoved.Add(e.Item.Id);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Libraries the update timer callback.
|
||||
/// </summary>
|
||||
/// <param name="state">The state.</param>
|
||||
private void LibraryUpdateTimerCallback(object state)
|
||||
{
|
||||
lock (_libraryChangedSyncLock)
|
||||
{
|
||||
// Remove dupes in case some were saved multiple times
|
||||
LibraryUpdateInfo.FoldersAddedTo = LibraryUpdateInfo.FoldersAddedTo.Distinct().ToList();
|
||||
|
||||
LibraryUpdateInfo.FoldersRemovedFrom = LibraryUpdateInfo.FoldersRemovedFrom.Distinct().ToList();
|
||||
|
||||
LibraryUpdateInfo.ItemsUpdated = LibraryUpdateInfo.ItemsUpdated
|
||||
.Where(i => !LibraryUpdateInfo.ItemsAdded.Contains(i))
|
||||
.Distinct()
|
||||
.ToList();
|
||||
|
||||
_serverManager.SendWebSocketMessage("LibraryChanged", LibraryUpdateInfo);
|
||||
|
||||
if (LibraryUpdateTimer != null)
|
||||
{
|
||||
LibraryUpdateTimer.Dispose();
|
||||
LibraryUpdateTimer = null;
|
||||
}
|
||||
|
||||
LibraryUpdateInfo = null;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Installations the manager_ plugin uninstalled.
|
||||
/// </summary>
|
||||
|
@ -350,16 +191,6 @@ namespace MediaBrowser.ServerApplication.EntryPoints
|
|||
{
|
||||
if (dispose)
|
||||
{
|
||||
if (LibraryUpdateTimer != null)
|
||||
{
|
||||
LibraryUpdateTimer.Dispose();
|
||||
LibraryUpdateTimer = null;
|
||||
}
|
||||
|
||||
_libraryManager.ItemAdded -= libraryManager_ItemAdded;
|
||||
_libraryManager.ItemUpdated -= libraryManager_ItemUpdated;
|
||||
_libraryManager.ItemRemoved -= libraryManager_ItemRemoved;
|
||||
|
||||
_userManager.UserDeleted -= userManager_UserDeleted;
|
||||
_userManager.UserUpdated -= userManager_UserUpdated;
|
||||
|
||||
|
|
|
@ -192,6 +192,7 @@
|
|||
<Reference Include="PresentationFramework" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="EntryPoints\LibraryChangedNotifier.cs" />
|
||||
<Compile Include="EntryPoints\LoadRegistrations.cs" />
|
||||
<Compile Include="EntryPoints\RefreshUsersMetadata.cs" />
|
||||
<Compile Include="EntryPoints\StartupWizard.cs" />
|
||||
|
|
Loading…
Reference in New Issue
Block a user