jellyfin-archive/jellyfin-plugin-autoorganize

Null Reference when organizing

flyer280 opened this issue · 2 comments

Running auto organize fails for all episodes and movies that aren't already in my library. After it does when I try to manually organize choosing Media type of "Series" or "Movie" causes a null exception and the next combobox of series or movie has nothing and clicking the + pulls up an error "No TV libraries are configured in Emby library setup." (the error reads the same for both series and movie).

Attempting to run the same query that this plugin is running (presumably to find the items that are movies or tv shows) jellyfin responds with the same nullreference error.
The offending queries are:

/emby/Items?recursive=true&includeItemTypes=Movie&sortBy=SortName

/emby/Items?recursive=true&includeItemTypes=Series&sortBy=SortName

even just running the command as /emby/Items?includeItemTypes=Series causes the same error.

Text of the actual null exception
Error processing request
System.NullReferenceException: Object reference not set to an instance of an object.
   at MediaBrowser.Api.UserLibrary.ItemsService.GetQueryResult(GetItems request, DtoOptions dtoOptions, User user)
   at MediaBrowser.Api.UserLibrary.ItemsService.GetItems(GetItems request)
   at MediaBrowser.Api.UserLibrary.ItemsService.Get(GetItems request)
   at Emby.Server.Implementations.Services.ServiceExecGeneral.Execute(Type serviceType, IRequest request, Object instance, Object requestDto, String requestName)
   at Emby.Server.Implementations.Services.ServiceController.Execute(HttpListenerHost appHost, Object requestDto, IRequest req)
   at Emby.Server.Implementations.Services.ServiceHandler.ProcessRequestAsync(HttpListenerHost appHost, IRequest httpReq, IResponse httpRes, ILogger logger, String operationName, CancellationToken cancellationToken)
   at Emby.Server.Implementations.HttpServer.HttpListenerHost.RequestHandler(IHttpRequest httpReq, String urlString, String host, String localPath, CancellationToken cancellationToken)

Related log entries with sitename redacted:
[2019-07-10 09:47:41.931 -05:00] [DBG] HTTP "http://jellyfin.REDACT.ED/emby/Items?recursive=true&includeItemTypes=Series&sortBy=SortName" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75.0.3770.100 Safari/537.36" UserAgent: "GET" 
Headers: [KeyValuePair`2 { Key: "Connection", Value: ["close"] }, KeyValuePair`2 { Key: "Accept", Value: ["application/json"] }, KeyValuePair`2 { Key: "Accept-Encoding", Value: ["gzip, deflate, br"] }, KeyValuePair`2 { Key: "Accept-Language", Value: ["en-US,en;q=0.9"] }, KeyValuePair`2 { Key: "Cookie", Value: ["ajs_user_id=null; ajs_group_id=null; _ga=GA1.2.1926447818.1554929819"] }, KeyValuePair`2 { Key: "Host", Value: ["jellyfin.REDACT.ED"] }, KeyValuePair`2 { Key: "Referer", Value: ["https://jellyfin.REDACT.ED/web/index.html"] }, KeyValuePair`2 { Key: "User-Agent", Value: ["Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75.0.3770.100 Safari/537.36"] }, KeyValuePair`2 { Key: "X-Real-IP", Value: ["24.153.235.162"] }, KeyValuePair`2 { Key: "X-Forwarded-For", Value: ["24.153.235.162"] }, KeyValuePair`2 { Key: "dnt", Value: ["1"] }, KeyValuePair`2 { Key: "x-emby-authorization", Value: ["MediaBrowser Client=\"Jellyfin Web\", Device=\"Chrome\", DeviceId=\"TW96aWxsYS81LjAgKFdpbmRvd3MgTlQgMTAuMDsgV2luNjQ7IHg2NCkgQXBwbGVXZWJLaXQvNTM3LjM2IChLSFRNTCwgbGlrZSBHZWNrbykgQ2hyb21lLzcyLjAuMzYyNi4xMjEgU2FmYXJpLzUzNy4zNnwxNTUyNTk4MDc0Nzc5\", Version=\"10.3.6\", Token=\"478a17625bb64c4ea48741ffaf1e65e0\""] }]
[2019-07-10 09:47:41.934 -05:00] [ERR] Error processing request
System.NullReferenceException: Object reference not set to an instance of an object.
   at MediaBrowser.Api.UserLibrary.ItemsService.GetQueryResult(GetItems request, DtoOptions dtoOptions, User user)
   at MediaBrowser.Api.UserLibrary.ItemsService.GetItems(GetItems request)
   at MediaBrowser.Api.UserLibrary.ItemsService.Get(GetItems request)
   at Emby.Server.Implementations.Services.ServiceExecGeneral.Execute(Type serviceType, IRequest request, Object instance, Object requestDto, String requestName)
   at Emby.Server.Implementations.Services.ServiceController.Execute(HttpListenerHost appHost, Object requestDto, IRequest req)
   at Emby.Server.Implementations.Services.ServiceHandler.ProcessRequestAsync(HttpListenerHost appHost, IRequest httpReq, IResponse httpRes, ILogger logger, String operationName, CancellationToken cancellationToken)
   at Emby.Server.Implementations.HttpServer.HttpListenerHost.RequestHandler(IHttpRequest httpReq, String urlString, String host, String localPath, CancellationToken cancellationToken)
[2019-07-10 09:47:41.935 -05:00] [DBG] HTTP Response 500 to "24.153.235.162". Time: 0:00:00.0033701. "http://jellyfin.REDACT.ED/emby/Items?recursive=true&includeItemTypes=Series&sortBy=SortName"

I can confirm the behavior/bug. I can also confirm that if we skip (=remove) the call to the API the plugin seems to work (I got a working version in my server)..

I will have time to work on that this weekend (=make it suits my needs) but I am a little curious what was the idea behind filling the dropdown list with a list of existing movie ? I mean if I already have the movie, it is obvious I will not download it again and even if I do I want a warning, before finalizing, that I am going to overwrite something? Am I missing something?

(I am also wondering what's the goal of the smartmatch, I mean this is just a blank page with no UI)

Should be fixed with v4 - if not please comment!