jellyfin / jellyfin-plugin-tmdbboxsets

https://jellyfin.org
MIT License
66 stars 16 forks source link

[bug] NullReferenceException when scanning library #38

Closed jfranki closed 3 years ago

jfranki commented 3 years ago

I get this error when scanning my library for the first time:

[2021-03-21 13:09:27.460 +00:00] [INF] [214] Jellyfin.Plugin.TMDbBoxSets.Api.TMDbBoxSetsController: Starting a manual refresh of TMDb collections
[2021-03-21 13:09:27.995 +00:00] [INF] [214] Jellyfin.Plugin.TMDbBoxSets.TMDbBoxSetManager: Found 390 TMDb collection(s) across all movies
[2021-03-21 13:09:27.996 +00:00] [INF] [214] Jellyfin.Plugin.TMDbBoxSets.TMDbBoxSetManager: Minimum number of movies is 2, but there is/are only 1: "1, 2, 3... Splash"
[2021-03-21 13:09:27.997 +00:00] [INF] [214] Jellyfin.Plugin.TMDbBoxSets.TMDbBoxSetManager: The movies "2 Fast 2 Furious: A todo gas 2, Fast & Furious 5, Fast & Furious 6, Fast & Furious 7, Fast & Furious 8, Fast & Furious: Aún más rápido, A todo gas, A todo gas: Tokyo Race" is/are already in their proper box set, "Fast & Furious - Colección"
[2021-03-21 13:09:27.998 +00:00] [INF] [214] Jellyfin.Plugin.TMDbBoxSets.TMDbBoxSetManager: Minimum number of movies is 2, but there is/are only 1: "3 Pequeños Ninjas"
[2021-03-21 13:09:27.999 +00:00] [INF] [214] Jellyfin.Plugin.TMDbBoxSets.TMDbBoxSetManager: The movies "007: Al servicio secreto de su Majestad, 007: Alta tensión, 007: Casino Royale, 007: contra el Dr. No, 007: Desde Rusia con amor, 007: Diamantes para la eternidad, 007: El hombre de la pistola de oro, 007: El mañana nunca muere, 007: El mundo nunca es suficiente, 007: GoldenEye, 007: James Bond contra Goldfinger, 007: La espía que me amó, 007: Licencia para matar, 007: Moonraker, 007: Muere otro día, 007: Nunca digas nunca jamás, 007: Octopussy, 007: Operación Trueno, 007: Panorama para matar, 007: Quantum of Solace, 007: Skyfall, 007: Spectre, 007: Sólo para sus ojos, 007: Sólo se vive dos veces, 007: Vive y deja morir" is/are already in their proper box set, "James Bond - Colección"
[2021-03-21 13:09:28.000 +00:00] [INF] [214] Jellyfin.Plugin.TMDbBoxSets.TMDbBoxSetManager: Minimum number of movies is 2, but there is/are only 1: "9 semanas y media"
[2021-03-21 13:09:28.001 +00:00] [INF] [214] Jellyfin.Plugin.TMDbBoxSets.TMDbBoxSetManager: The movies "28 días después, 28 semanas después" is/are already in their proper box set, "28 - Colección"
[2021-03-21 13:09:28.002 +00:00] [INF] [214] Jellyfin.Plugin.TMDbBoxSets.TMDbBoxSetManager: Minimum number of movies is 2, but there is/are only 1: "30 días de oscuridad"
[2021-03-21 13:09:28.003 +00:00] [INF] [214] Jellyfin.Plugin.TMDbBoxSets.TMDbBoxSetManager: The movies "300, 300: El origen de un imperio" is/are already in their proper box set, "300 - Colección"
[2021-03-21 13:09:28.004 +00:00] [INF] [214] Jellyfin.Plugin.TMDbBoxSets.TMDbBoxSetManager: Minimum number of movies is 2, but there is/are only 1: "1997: Rescate en Nueva York"
[2021-03-21 13:09:28.006 +00:00] [INF] [214] Jellyfin.Plugin.TMDbBoxSets.TMDbBoxSetManager: Minimum number of movies is 2, but there is/are only 1: "2001: Una odisea del espacio"
[2021-03-21 13:09:28.009 +00:00] [ERR] [214] Jellyfin.Server.Middleware.ExceptionMiddleware: Error processing request. URL "POST" "/TMDbBoxSets/Refresh".
System.NullReferenceException: Object reference not set to an instance of an object.
   at Jellyfin.Plugin.TMDbBoxSets.TMDbBoxSetManager.AddMoviesToCollection(IReadOnlyCollection`1 movies, String tmdbCollectionId, BoxSet boxSet)
   at Jellyfin.Plugin.TMDbBoxSets.TMDbBoxSetManager.ScanLibrary(IProgress`1 progress)
   at Jellyfin.Plugin.TMDbBoxSets.Api.TMDbBoxSetsController.RefreshMetadataRequest()
   at lambda_method884(Closure , Object )
   at Microsoft.AspNetCore.Mvc.Infrastructure.ActionMethodExecutor.TaskOfActionResultExecutor.Execute(IActionResultTypeMapper mapper, ObjectMethodExecutor executor, Object controller, Object[] arguments)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.<InvokeActionMethodAsync>g__Awaited|12_0(ControllerActionInvoker invoker, ValueTask`1 actionResultValueTask)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.<InvokeNextActionFilterAsync>g__Awaited|10_0(ControllerActionInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Rethrow(ActionExecutedContextSealed context)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.InvokeInnerFilterAsync()
--- End of stack trace from previous location ---
   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeNextResourceFilter>g__Awaited|24_0(ResourceInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.Rethrow(ResourceExecutedContextSealed context)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.InvokeFilterPipelineAsync()
--- End of stack trace from previous location ---
   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeAsync>g__Awaited|17_0(ResourceInvoker invoker, Task task, IDisposable scope)
   at Microsoft.AspNetCore.Routing.EndpointMiddleware.<Invoke>g__AwaitRequestTask|6_0(Endpoint endpoint, Task requestTask, ILogger logger)
   at Jellyfin.Server.Middleware.ServerStartupMessageMiddleware.Invoke(HttpContext httpContext, IServerApplicationHost serverApplicationHost, ILocalizationManager localizationManager)
   at Jellyfin.Server.Middleware.WebSocketHandlerMiddleware.Invoke(HttpContext httpContext, IWebSocketManager webSocketManager)
   at Jellyfin.Server.Middleware.IpBasedAccessValidationMiddleware.Invoke(HttpContext httpContext, INetworkManager networkManager, IServerConfigurationManager serverConfigurationManager)
   at Jellyfin.Server.Middleware.LanFilteringMiddleware.Invoke(HttpContext httpContext, INetworkManager networkManager, IServerConfigurationManager serverConfigurationManager)
   at Microsoft.AspNetCore.Authorization.Policy.AuthorizationMiddlewareResultHandler.HandleAsync(RequestDelegate next, HttpContext context, AuthorizationPolicy policy, PolicyAuthorizationResult authorizeResult)
   at Microsoft.AspNetCore.Authorization.AuthorizationMiddleware.Invoke(HttpContext context)
   at Swashbuckle.AspNetCore.ReDoc.ReDocMiddleware.Invoke(HttpContext httpContext)
   at Swashbuckle.AspNetCore.SwaggerUI.SwaggerUIMiddleware.Invoke(HttpContext httpContext)
   at Swashbuckle.AspNetCore.Swagger.SwaggerMiddleware.Invoke(HttpContext httpContext, ISwaggerProvider swaggerProvider)
   at Microsoft.AspNetCore.Authentication.AuthenticationMiddleware.Invoke(HttpContext context)
   at Jellyfin.Server.Middleware.RobotsRedirectionMiddleware.Invoke(HttpContext httpContext)
   at Jellyfin.Server.Middleware.LegacyEmbyRouteRewriteMiddleware.Invoke(HttpContext httpContext)
   at Microsoft.AspNetCore.ResponseCompression.ResponseCompressionMiddleware.Invoke(HttpContext context)
   at Jellyfin.Server.Middleware.ResponseTimeMiddleware.Invoke(HttpContext context)
   at Jellyfin.Server.Middleware.ExceptionMiddleware.Invoke(HttpContext context)

I only have one library containing movies and this is the first time I have used this plugin. The result is that the plugin crashes and only the collections until this crash appear in the collections library.

image

jfranki commented 3 years ago

I have looked into this a little more. The plugin crashes when it encounters a movie or series of movies with a TMDb BoxSet ID that right now is incorrect (it was correct when the movie was added though).

E.g. Dawn of the Dead (2004):

Other example: Blade Runner short movies. They were inside the collection 422837 and the metadata reflects this but they're no longer, crashing the plugin and preventing it continuing with the rest of the library.

I think this NullReferenceException should be catched. Maybe notify with a log warning about the conflicting movie (so that its metadata can be corrected) but still create the collection and most of all continue processing the rest of the library.