Merge pull request #2208 from Bond-009/todo

Fix a couple of TODOs
This commit is contained in:
dkanada 2019-12-31 03:03:42 -08:00 committed by GitHub
commit e476125cf8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 23 additions and 64 deletions

View File

@ -29,25 +29,15 @@ namespace Emby.Dlna.Eventing
{ {
var subscription = GetSubscription(subscriptionId, false); var subscription = GetSubscription(subscriptionId, false);
int timeoutSeconds; subscription.TimeoutSeconds = ParseTimeout(requestedTimeoutString) ?? 300;
int timeoutSeconds = subscription.TimeoutSeconds;
subscription.SubscriptionTime = DateTime.UtcNow;
// Remove logging for now because some devices are sending this very frequently _logger.LogDebug(
// TODO re-enable with dlna debug logging setting "Renewing event subscription for {0} with timeout of {1} to {2}",
//_logger.LogDebug("Renewing event subscription for {0} with timeout of {1} to {2}", subscription.NotificationType,
// subscription.NotificationType, timeoutSeconds,
// timeout, subscription.CallbackUrl);
// subscription.CallbackUrl);
if (subscription != null)
{
subscription.TimeoutSeconds = ParseTimeout(requestedTimeoutString) ?? 300;
timeoutSeconds = subscription.TimeoutSeconds;
subscription.SubscriptionTime = DateTime.UtcNow;
}
else
{
timeoutSeconds = 300;
}
return GetEventSubscriptionResponse(subscriptionId, requestedTimeoutString, timeoutSeconds); return GetEventSubscriptionResponse(subscriptionId, requestedTimeoutString, timeoutSeconds);
} }
@ -57,12 +47,10 @@ namespace Emby.Dlna.Eventing
var timeout = ParseTimeout(requestedTimeoutString) ?? 300; var timeout = ParseTimeout(requestedTimeoutString) ?? 300;
var id = "uuid:" + Guid.NewGuid().ToString("N", CultureInfo.InvariantCulture); var id = "uuid:" + Guid.NewGuid().ToString("N", CultureInfo.InvariantCulture);
// Remove logging for now because some devices are sending this very frequently _logger.LogDebug("Creating event subscription for {0} with timeout of {1} to {2}",
// TODO re-enable with dlna debug logging setting notificationType,
//_logger.LogDebug("Creating event subscription for {0} with timeout of {1} to {2}", timeout,
// notificationType, callbackUrl);
// timeout,
// callbackUrl);
_subscriptions.TryAdd(id, new EventSubscription _subscriptions.TryAdd(id, new EventSubscription
{ {

View File

@ -764,9 +764,8 @@ namespace Emby.Server.Implementations
LibraryManager = new LibraryManager(this, LoggerFactory, TaskManager, UserManager, ServerConfigurationManager, UserDataManager, () => LibraryMonitor, FileSystemManager, () => ProviderManager, () => UserViewManager); LibraryManager = new LibraryManager(this, LoggerFactory, TaskManager, UserManager, ServerConfigurationManager, UserDataManager, () => LibraryMonitor, FileSystemManager, () => ProviderManager, () => UserViewManager);
serviceCollection.AddSingleton(LibraryManager); serviceCollection.AddSingleton(LibraryManager);
// TODO wtaylor: investigate use of second music manager
var musicManager = new MusicManager(LibraryManager); var musicManager = new MusicManager(LibraryManager);
serviceCollection.AddSingleton<IMusicManager>(new MusicManager(LibraryManager)); serviceCollection.AddSingleton<IMusicManager>(musicManager);
LibraryMonitor = new LibraryMonitor(LoggerFactory, LibraryManager, ServerConfigurationManager, FileSystemManager); LibraryMonitor = new LibraryMonitor(LoggerFactory, LibraryManager, ServerConfigurationManager, FileSystemManager);
serviceCollection.AddSingleton(LibraryMonitor); serviceCollection.AddSingleton(LibraryMonitor);

View File

@ -31,11 +31,7 @@ namespace Emby.Server.Implementations.Collections
private readonly ILogger _logger; private readonly ILogger _logger;
private readonly IProviderManager _providerManager; private readonly IProviderManager _providerManager;
private readonly ILocalizationManager _localizationManager; private readonly ILocalizationManager _localizationManager;
private IApplicationPaths _appPaths; private readonly IApplicationPaths _appPaths;
public event EventHandler<CollectionCreatedEventArgs> CollectionCreated;
public event EventHandler<CollectionModifiedEventArgs> ItemsAddedToCollection;
public event EventHandler<CollectionModifiedEventArgs> ItemsRemovedFromCollection;
public CollectionManager( public CollectionManager(
ILibraryManager libraryManager, ILibraryManager libraryManager,
@ -55,6 +51,10 @@ namespace Emby.Server.Implementations.Collections
_appPaths = appPaths; _appPaths = appPaths;
} }
public event EventHandler<CollectionCreatedEventArgs> CollectionCreated;
public event EventHandler<CollectionModifiedEventArgs> ItemsAddedToCollection;
public event EventHandler<CollectionModifiedEventArgs> ItemsRemovedFromCollection;
private IEnumerable<Folder> FindFolders(string path) private IEnumerable<Folder> FindFolders(string path)
{ {
return _libraryManager return _libraryManager
@ -341,11 +341,11 @@ namespace Emby.Server.Implementations.Collections
} }
} }
public class CollectionManagerEntryPoint : IServerEntryPoint public sealed class CollectionManagerEntryPoint : IServerEntryPoint
{ {
private readonly CollectionManager _collectionManager; private readonly CollectionManager _collectionManager;
private readonly IServerConfigurationManager _config; private readonly IServerConfigurationManager _config;
private ILogger _logger; private readonly ILogger _logger;
public CollectionManagerEntryPoint(ICollectionManager collectionManager, IServerConfigurationManager config, ILogger logger) public CollectionManagerEntryPoint(ICollectionManager collectionManager, IServerConfigurationManager config, ILogger logger)
{ {
@ -354,6 +354,7 @@ namespace Emby.Server.Implementations.Collections
_logger = logger; _logger = logger;
} }
/// <inheritdoc />
public async Task RunAsync() public async Task RunAsync()
{ {
if (!_config.Configuration.CollectionsUpgraded && _config.Configuration.IsStartupWizardCompleted) if (!_config.Configuration.CollectionsUpgraded && _config.Configuration.IsStartupWizardCompleted)
@ -377,39 +378,10 @@ namespace Emby.Server.Implementations.Collections
} }
} }
#region IDisposable Support /// <inheritdoc />
private bool disposedValue = false; // To detect redundant calls
protected virtual void Dispose(bool disposing)
{
if (!disposedValue)
{
if (disposing)
{
// TODO: dispose managed state (managed objects).
}
// TODO: free unmanaged resources (unmanaged objects) and override a finalizer below.
// TODO: set large fields to null.
disposedValue = true;
}
}
// TODO: override a finalizer only if Dispose(bool disposing) above has code to free unmanaged resources.
// ~CollectionManagerEntryPoint() {
// // Do not change this code. Put cleanup code in Dispose(bool disposing) above.
// Dispose(false);
// }
// This code added to correctly implement the disposable pattern.
public void Dispose() public void Dispose()
{ {
// Do not change this code. Put cleanup code in Dispose(bool disposing) above. // Nothing to dispose
Dispose(true);
// TODO: uncomment the following line if the finalizer is overridden above.
// GC.SuppressFinalize(this);
} }
#endregion
} }
} }