Catch any exception thrown during plugin startup

This commit is contained in:
ConfusedPolarBear 2022-06-12 16:08:31 -05:00
parent 2394c03bbe
commit 01d7f570fa

View File

@ -58,23 +58,30 @@ public class Entrypoint : IServerEntryPoint
return Task.CompletedTask;
}
// As soon as a new episode is added, queue it for later analysis.
_libraryManager.ItemAdded += ItemAdded;
// For all TV show libraries, enqueue all contained items.
foreach (var folder in _libraryManager.GetVirtualFolders())
try
{
if (folder.CollectionType != CollectionTypeOptions.TvShows)
// As soon as a new episode is added, queue it for later analysis.
_libraryManager.ItemAdded += ItemAdded;
// For all TV show libraries, enqueue all contained items.
foreach (var folder in _libraryManager.GetVirtualFolders())
{
continue;
if (folder.CollectionType != CollectionTypeOptions.TvShows)
{
continue;
}
_logger.LogInformation(
"Running startup enqueue of items in library {Name} ({ItemId})",
folder.Name,
folder.ItemId);
QueueLibraryContents(folder.ItemId);
}
_logger.LogInformation(
"Running startup enqueue of items in library {Name} ({ItemId})",
folder.Name,
folder.ItemId);
QueueLibraryContents(folder.ItemId);
}
catch (Exception ex)
{
_logger.LogError("Unable to run startup enqueue: {Exception}", ex);
}
return Task.CompletedTask;