ShokoAnime / Shokofin

Repository for Shokofin, a plugin that brings Shoko to Jellyfin.
https://shokoanime.com
MIT License
149 stars 18 forks source link

Shokofin throws JSON Exception, which halts import of metadata #69

Closed t0815 closed 3 months ago

t0815 commented 3 months ago

Jellyfin version.

10.9.9

Shokofin version.

4.1.1.0

Shoko Server version, release channel, and commit hash.

4.2.2

File structure of your Media Library Folder in Jellyfin/Import Folder in Shoko Server.

./Anime Name/episode_xx.

Screenshot of the "library settings" section of the plugin settings.

grafik

Library Type(s).

Shows

Do the issue persists after creating a library with Shoko set as the only metadata provider? (Now is your time to check if you haven't already.)

Issue

When importing hentai shows, import cancels at certain show with json exception. Since import is alphabetical it either breaks at last show i posted in log or at next show, which would be "Kisaku" (anidb: 1348).

Stack Trace

[2024-08-16 10:03:05.776 +02:00] [INF] [31] Shokofin.Resolvers.ShokoIgnoreRule: Found shoko group "Kiriya Hakushakuke no Roku Shimai" (Series="990",ExtraSeries=[],Group="834")
[2024-08-16 10:03:06.071 +02:00] [ERR] [31] Shokofin.Resolvers.ShokoIgnoreRule: Threw unexpectedly; "One or more errors occurred. (The JSON value could not be converted to System.Int32. Path: $.List[0].TvDB[0].AbsoluteNumber | LineNumber: 0 | BytePositionInLine: 789.)"
System.AggregateException: One or more errors occurred. (The JSON value could not be converted to System.Int32. Path: $.List[0].TvDB[0].AbsoluteNumber | LineNumber: 0 | BytePositionInLine: 789.)
 ---> System.Text.Json.JsonException: The JSON value could not be converted to System.Int32. Path: $.List[0].TvDB[0].AbsoluteNumber | LineNumber: 0 | BytePositionInLine: 789.
 ---> System.InvalidOperationException: Cannot get the value of a token type 'Null' as a number.
   at System.Text.Json.ThrowHelper.ThrowInvalidOperationException_ExpectedNumber(JsonTokenType tokenType)
   at System.Text.Json.Utf8JsonReader.TryGetInt32(Int32& value)
   at System.Text.Json.Serialization.Converters.Int32Converter.Read(Utf8JsonReader& reader, Type typeToConvert, JsonSerializerOptions options)
   at System.Text.Json.Serialization.Metadata.JsonPropertyInfo`1.ReadJsonAndSetMember(Object obj, ReadStack& state, Utf8JsonReader& reader)
   at System.Text.Json.Serialization.Converters.ObjectDefaultConverter`1.OnTryRead(Utf8JsonReader& reader, Type typeToConvert, JsonSerializerOptions options, ReadStack& state, T& value)
   at System.Text.Json.Serialization.JsonConverter`1.TryRead(Utf8JsonReader& reader, Type typeToConvert, JsonSerializerOptions options, ReadStack& state, T& value, Boolean& isPopulatedValue)
   at System.Text.Json.Serialization.JsonCollectionConverter`2.OnTryRead(Utf8JsonReader& reader, Type typeToConvert, JsonSerializerOptions options, ReadStack& state, TCollection& value)
   at System.Text.Json.Serialization.JsonConverter`1.TryRead(Utf8JsonReader& reader, Type typeToConvert, JsonSerializerOptions options, ReadStack& state, T& value, Boolean& isPopulatedValue)
   at System.Text.Json.Serialization.Metadata.JsonPropertyInfo`1.ReadJsonAndSetMember(Object obj, ReadStack& state, Utf8JsonReader& reader)
   at System.Text.Json.Serialization.Converters.ObjectDefaultConverter`1.OnTryRead(Utf8JsonReader& reader, Type typeToConvert, JsonSerializerOptions options, ReadStack& state, T& value)
   at System.Text.Json.Serialization.JsonConverter`1.TryRead(Utf8JsonReader& reader, Type typeToConvert, JsonSerializerOptions options, ReadStack& state, T& value, Boolean& isPopulatedValue)
   at System.Text.Json.Serialization.JsonCollectionConverter`2.OnTryRead(Utf8JsonReader& reader, Type typeToConvert, JsonSerializerOptions options, ReadStack& state, TCollection& value)
   at System.Text.Json.Serialization.JsonConverter`1.TryRead(Utf8JsonReader& reader, Type typeToConvert, JsonSerializerOptions options, ReadStack& state, T& value, Boolean& isPopulatedValue)
   at System.Text.Json.Serialization.Metadata.JsonPropertyInfo`1.ReadJsonAndSetMember(Object obj, ReadStack& state, Utf8JsonReader& reader)
   at System.Text.Json.Serialization.Converters.ObjectDefaultConverter`1.OnTryRead(Utf8JsonReader& reader, Type typeToConvert, JsonSerializerOptions options, ReadStack& state, T& value)
   at System.Text.Json.Serialization.JsonConverter`1.TryRead(Utf8JsonReader& reader, Type typeToConvert, JsonSerializerOptions options, ReadStack& state, T& value, Boolean& isPopulatedValue)
   at System.Text.Json.Serialization.JsonConverter`1.ReadCore(Utf8JsonReader& reader, JsonSerializerOptions options, ReadStack& state)
   --- End of inner exception stack trace ---
   at System.Text.Json.ThrowHelper.ReThrowWithPath(ReadStack& state, Utf8JsonReader& reader, Exception ex)
   at System.Text.Json.Serialization.JsonConverter`1.ReadCore(Utf8JsonReader& reader, JsonSerializerOptions options, ReadStack& state)
   at System.Text.Json.Serialization.Metadata.JsonTypeInfo`1.DeserializeAsync(Stream utf8Json, CancellationToken cancellationToken)
   at Shokofin.API.ShokoAPIClient.<>c__DisplayClass17_0`1.<<Get>b__1>d.MoveNext()
--- End of stack trace from previous location ---
   at Shokofin.Utils.GuardedMemoryCache.GetOrCreateAsync[TItem](Object key, Action`1 foundAction, Func`1 createFactory, MemoryCacheEntryOptions createOptions)
   at Shokofin.API.ShokoAPIClient.Get[ReturnType](String url, HttpMethod method, String apiKey, Boolean skipCache)
   --- End of inner exception stack trace ---
   at System.Threading.Tasks.Task.ThrowIfExceptional(Boolean includeTaskCanceledExceptions)
   at Shokofin.API.ShokoAPIManager.<>c__DisplayClass48_0.<CreateSeasonInfo>b__5(Task`1 task)
   at System.Threading.Tasks.ContinuationResultTaskFromResultTask`2.InnerInvoke()
   at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state)
--- End of stack trace from previous location ---
   at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state)
   at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread)
--- End of stack trace from previous location ---
   at Shokofin.API.ShokoAPIManager.<>c__DisplayClass48_0.<<CreateSeasonInfo>b__1>d.MoveNext()
--- End of stack trace from previous location ---
   at Shokofin.Utils.GuardedMemoryCache.GetOrCreateAsync[TItem](Object key, Action`1 foundAction, Func`1 createFactory, MemoryCacheEntryOptions createOptions)
   at Shokofin.API.ShokoAPIManager.CreateSeasonInfo(Series series)
   at Shokofin.API.ShokoAPIManager.GetSeasonInfoByPath(String path)
   at Shokofin.Resolvers.ShokoIgnoreRule.ShouldFilterDirectory(String partialPath, String fullPath, Nullable`1 collectionType, Boolean shouldIgnore)
   at Shokofin.Resolvers.ShokoIgnoreRule.ShouldFilterItem(Folder parent, FileSystemMetadata fileInfo)
   at Shokofin.Resolvers.ShokoIgnoreRule.MediaBrowser.Controller.Resolvers.IResolverIgnoreRule.ShouldIgnore(FileSystemMetadata fileInfo, BaseItem parent)
   at System.Linq.Enumerable.Any[TSource](IEnumerable`1 source, Func`2 predicate)
   at System.Linq.Enumerable.WhereArrayIterator`1.ToList()
   at Emby.Server.Implementations.Library.LibraryManager.ResolvePaths(IEnumerable`1 files, IDirectoryService directoryService, Folder parent, LibraryOptions libraryOptions, Nullable`1 collectionType, IItemResolver[] resolvers)
   at MediaBrowser.Controller.Entities.Folder.GetNonCachedChildren(IDirectoryService directoryService)
   at MediaBrowser.Controller.Entities.Folder.ValidateChildrenInternal2(IProgress`1 progress, Boolean recursive, Boolean refreshChildMetadata, Boolean allowRemoveRoot, MetadataRefreshOptions refreshOptions, IDirectoryService directoryService, CancellationToken cancellationToken)
[2024-08-16 10:03:06.077 +02:00] [ERR] [34] MediaBrowser.Controller.Entities.BaseItem: Error retrieving children
System.AggregateException: One or more errors occurred. (The JSON value could not be converted to System.Int32. Path: $.List[0].TvDB[0].AbsoluteNumber | LineNumber: 0 | BytePositionInLine: 789.)
 ---> System.Text.Json.JsonException: The JSON value could not be converted to System.Int32. Path: $.List[0].TvDB[0].AbsoluteNumber | LineNumber: 0 | BytePositionInLine: 789.
 ---> System.InvalidOperationException: Cannot get the value of a token type 'Null' as a number.
   at System.Text.Json.ThrowHelper.ThrowInvalidOperationException_ExpectedNumber(JsonTokenType tokenType)
   at System.Text.Json.Utf8JsonReader.TryGetInt32(Int32& value)
   at System.Text.Json.Serialization.Converters.Int32Converter.Read(Utf8JsonReader& reader, Type typeToConvert, JsonSerializerOptions options)
   at System.Text.Json.Serialization.Metadata.JsonPropertyInfo`1.ReadJsonAndSetMember(Object obj, ReadStack& state, Utf8JsonReader& reader)
   at System.Text.Json.Serialization.Converters.ObjectDefaultConverter`1.OnTryRead(Utf8JsonReader& reader, Type typeToConvert, JsonSerializerOptions options, ReadStack& state, T& value)
   at System.Text.Json.Serialization.JsonConverter`1.TryRead(Utf8JsonReader& reader, Type typeToConvert, JsonSerializerOptions options, ReadStack& state, T& value, Boolean& isPopulatedValue)
   at System.Text.Json.Serialization.JsonCollectionConverter`2.OnTryRead(Utf8JsonReader& reader, Type typeToConvert, JsonSerializerOptions options, ReadStack& state, TCollection& value)
   at System.Text.Json.Serialization.JsonConverter`1.TryRead(Utf8JsonReader& reader, Type typeToConvert, JsonSerializerOptions options, ReadStack& state, T& value, Boolean& isPopulatedValue)
   at System.Text.Json.Serialization.Metadata.JsonPropertyInfo`1.ReadJsonAndSetMember(Object obj, ReadStack& state, Utf8JsonReader& reader)
   at System.Text.Json.Serialization.Converters.ObjectDefaultConverter`1.OnTryRead(Utf8JsonReader& reader, Type typeToConvert, JsonSerializerOptions options, ReadStack& state, T& value)
   at System.Text.Json.Serialization.JsonConverter`1.TryRead(Utf8JsonReader& reader, Type typeToConvert, JsonSerializerOptions options, ReadStack& state, T& value, Boolean& isPopulatedValue)
   at System.Text.Json.Serialization.JsonCollectionConverter`2.OnTryRead(Utf8JsonReader& reader, Type typeToConvert, JsonSerializerOptions options, ReadStack& state, TCollection& value)
   at System.Text.Json.Serialization.JsonConverter`1.TryRead(Utf8JsonReader& reader, Type typeToConvert, JsonSerializerOptions options, ReadStack& state, T& value, Boolean& isPopulatedValue)
   at System.Text.Json.Serialization.Metadata.JsonPropertyInfo`1.ReadJsonAndSetMember(Object obj, ReadStack& state, Utf8JsonReader& reader)
   at System.Text.Json.Serialization.Converters.ObjectDefaultConverter`1.OnTryRead(Utf8JsonReader& reader, Type typeToConvert, JsonSerializerOptions options, ReadStack& state, T& value)
   at System.Text.Json.Serialization.JsonConverter`1.TryRead(Utf8JsonReader& reader, Type typeToConvert, JsonSerializerOptions options, ReadStack& state, T& value, Boolean& isPopulatedValue)
   at System.Text.Json.Serialization.JsonConverter`1.ReadCore(Utf8JsonReader& reader, JsonSerializerOptions options, ReadStack& state)
   --- End of inner exception stack trace ---
   at System.Text.Json.ThrowHelper.ReThrowWithPath(ReadStack& state, Utf8JsonReader& reader, Exception ex)
   at System.Text.Json.Serialization.JsonConverter`1.ReadCore(Utf8JsonReader& reader, JsonSerializerOptions options, ReadStack& state)
   at System.Text.Json.Serialization.Metadata.JsonTypeInfo`1.DeserializeAsync(Stream utf8Json, CancellationToken cancellationToken)
   at Shokofin.API.ShokoAPIClient.<>c__DisplayClass17_0`1.<<Get>b__1>d.MoveNext()
--- End of stack trace from previous location ---
   at Shokofin.Utils.GuardedMemoryCache.GetOrCreateAsync[TItem](Object key, Action`1 foundAction, Func`1 createFactory, MemoryCacheEntryOptions createOptions)
   at Shokofin.API.ShokoAPIClient.Get[ReturnType](String url, HttpMethod method, String apiKey, Boolean skipCache)
   --- End of inner exception stack trace ---
   at System.Threading.Tasks.Task.ThrowIfExceptional(Boolean includeTaskCanceledExceptions)
   at Shokofin.API.ShokoAPIManager.<>c__DisplayClass48_0.<CreateSeasonInfo>b__5(Task`1 task)
   at System.Threading.Tasks.ContinuationResultTaskFromResultTask`2.InnerInvoke()
   at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state)
--- End of stack trace from previous location ---
   at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state)
   at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread)
--- End of stack trace from previous location ---
   at Shokofin.API.ShokoAPIManager.<>c__DisplayClass48_0.<<CreateSeasonInfo>b__1>d.MoveNext()
--- End of stack trace from previous location ---
   at Shokofin.Utils.GuardedMemoryCache.GetOrCreateAsync[TItem](Object key, Action`1 foundAction, Func`1 createFactory, MemoryCacheEntryOptions createOptions)
   at Shokofin.API.ShokoAPIManager.CreateSeasonInfo(Series series)
   at Shokofin.API.ShokoAPIManager.GetSeasonInfoByPath(String path)
   at Shokofin.Resolvers.ShokoIgnoreRule.ShouldFilterDirectory(String partialPath, String fullPath, Nullable`1 collectionType, Boolean shouldIgnore)
   at Shokofin.Resolvers.ShokoIgnoreRule.ShouldFilterItem(Folder parent, FileSystemMetadata fileInfo)
   at Shokofin.Resolvers.ShokoIgnoreRule.MediaBrowser.Controller.Resolvers.IResolverIgnoreRule.ShouldIgnore(FileSystemMetadata fileInfo, BaseItem parent)
   at System.Linq.Enumerable.Any[TSource](IEnumerable`1 source, Func`2 predicate)
   at System.Linq.Enumerable.WhereArrayIterator`1.ToList()
   at Emby.Server.Implementations.Library.LibraryManager.ResolvePaths(IEnumerable`1 files, IDirectoryService directoryService, Folder parent, LibraryOptions libraryOptions, Nullable`1 collectionType, IItemResolver[] resolvers)
   at MediaBrowser.Controller.Entities.Folder.GetNonCachedChildren(IDirectoryService directoryService)
   at MediaBrowser.Controller.Entities.Folder.ValidateChildrenInternal2(IProgress`1 progress, Boolean recursive, Boolean refreshChildMetadata, Boolean allowRemoveRoot, MetadataRefreshOptions refreshOptions, IDirectoryService directoryService, CancellationToken cancellationToken)
revam commented 3 months ago

I'll just remove the TvDB data altogether. Also, you should check your TvDB data in the server if it's borked.

revam commented 3 months ago

Update to the dev channel or wait for the next stable plugin release @t0815.

t0815 commented 3 months ago

ah ok, i found the problem... TVDb doesnt allow hentai, but for some reason, there once was an entry for this series present on TVDb. Shoko still had that link cached. So import of that item failed to get non present tvdb-entry.