Code Monkey home page Code Monkey logo

shokofin's Issues

System.NullReferenceExceptions blocking 10.8.0 stable

Running latest unstable on the recently released jellyfin version, got sparse errors on library refresh. Noticed these two in particular:

System.NullReferenceException: Object reference not set to an instance of an object.
   at Shokofin.Providers.ExtraMetadataProvider.RemoveDuplicateEpisodes(Episode episode, String episodeId)
   at Shokofin.Providers.ExtraMetadataProvider.OnLibraryManagerItemUpdated(Object sender, ItemChangeEventArgs e)
   at Emby.Server.Implementations.Library.LibraryManager.UpdateItemsAsync(IReadOnlyList`1 items, BaseItem parent, ItemUpdateType updateReason, CancellationToken cancellationToken)
[2022-06-11 14:28:12.837 -04:00] [INF] Found episode for "Fate/Kaleid Liner Prisma Illya" (Series="171",Episode="3403",File="1898")
[2022-06-11 14:28:12.839 -04:00] [INF] Removing item, Type: "Episode", Name: "S2 World at Peace", Path: "/mnt/ryzenshokoshow/Durarara!!/Durarara!! - 00x02 - World at Peace.mkv", Id: c548788b-56d4-5857-bfb0-26848341c1d2

and

[2022-06-11 14:28:16.218 -04:00] [INF] Found episode for "Ansatsu Kyoushitsu (2015)" (Series="255",Episode="6047",File="3165")
[2022-06-11 14:28:17.005 -04:00] [ERR] Error in ItemUpdated event handler
System.NullReferenceException: Object reference not set to an instance of an object.
   at Shokofin.Providers.ExtraMetadataProvider.EpisodeExists(String episodeId, String seriesId, String groupId)
   at Shokofin.Providers.ExtraMetadataProvider.AddVirtualEpisode(GroupInfo groupInfo, SeriesInfo seriesInfo, EpisodeInfo episodeInfo, Season season)
   at Shokofin.Providers.ExtraMetadataProvider.UpdateSeries(Series series, String seriesId)
   at Shokofin.Providers.ExtraMetadataProvider.OnLibraryManagerItemUpdated(Object sender, ItemChangeEventArgs e)
   at Emby.Server.Implementations.Library.LibraryManager.UpdateItemsAsync(IReadOnlyList`1 items, BaseItem parent, ItemUpdateType updateReason, CancellationToken cancellationToken)

Some browsing of the changelog from beta 3 led me to jellyfin/jellyfin#7867 and jellyfin/jellyfin#7802 as possible culprits, but i'm not exactly familiar enough with the api to debug myself.

Problem when using real time monitoring in library

I have both Shoko and the Jellyfin library for my anime configured with real-time monitoring ("Watch for new files" in the import folder in Shoko and "Enable real time monitoring" in the library in Jellyfin). This usually works quite well as I don't have to scan the whole library when I add new files. Unfortunately, since Shoko and Jellyfin are both processing these files when they are added to the filesystem, Shokofin will almost certainly find no metadata for those files. Due to hashing in Shoko, it practically always takes longer. So Jellyfin will have added the files to the library but without any metadata. To fix this, I have to refresh the metadata on the entire show, after Shoko is finished. If possible, I'd rather have Shokofin wait for the metadata to become available, ideally checking its progress so it can start right after it's finished.

Reproduction

  1. Add an import folder in Shoko and configure it to watch for new files.
  2. Add a library in Jellyfin that uses the same folder as the import folder in Shoko
  3. Configure the library with real-time monitoring and only Shokofin for its metadata
  4. Add a new anime series (or episode) to the import folder

Current behavior

  1. Both Shoko and Jellyfin see the new files that have been added for the anime series (or episode).
  2. Shoko starts hashing it to get the corresponding metadata
  3. At the same time, Jellyfin asks Shoko for metadata for that file through Shokofin
  4. Shokofin cannot find any metadata for the file
  5. Jellyfin adds the file to the library without any metadata
    Steps 3-5 are repeated for every file added.
    This can be fixed by manually refreshing the metadata for the files that were added, after you confirm that Shoko has finished processing them.

Expected behavior

  1. Both Shoko and Jellyfin see the new files that have been added for the anime series (or episode).
  2. Shoko starts hashing it to get the corresponding metadata
  3. At the same time, Jellyfin asks Shoko for metadata for that file through Shokofin
  4. Shokofin finds no metadata for that file
  5. Shokofin checks whether Shoko is working on that file (repeatedly for a few minutes, as it may take Shoko some time to queue up all the newly added files)
  6. Shokofin monitors the queue to wait for that file to be fully processed
  7. Once fully processed, Shokofin again tries to retrieve metadata for that file, which should now be available in Shoko.
  8. Jellyfin adds the file, with correct metadata to the library
    Steps 3-8 are repeated for every file added.

Alternative

If it's not possible to monitor the queue in Shoko, Shokofin could also just wait a predetermined amount of time before trying to get the metadata again. However, since hashing may take a long time and many files could have been added at the same time, it's hard to predict how long would be reasonable to wait. Because it may also just be the case that Shoko has no metadata at all and is not working on it. In which case you don't want Shokofin to wait at all.

Additional information

With the reproduction, you may run into another problem, with Shoko itself. If you watch for new files in Shoko, it seems to start processing them as soon as the file entry is added to the file system. At this time, the file may still be transferring to the file system. So with large files or slower transfers (like over a network connection) Shoko may be hashing a partially-transferred file. This will obviously not match anything and it will be considered unrecognized. A workaround for this is to first transfer the file(s) to the same disk/partition as the import folder but outside of that folder. If you then move it to the import folder (move, not copy), it should be an instant transfer and Shoko will hash the whole file.

Handle Path Changes after Group Recreation and Metadata Refresh

Description

If groups are not created correctly in Shoko (due to the order of import) and Jellyfin receives the incorrect grouping metadata, Jellyfin will produce an error due to the path changing when recreating groups and then updating series metadata in JF. As a result, the show entry will not display any seasons or episodes until a scan of all libraries is performed manually or by a scheduled task. This is on JF 10.9 with the pre-release 4.0.0.22 version and VFS enabled.

Suggested Solution

Ideally, if possible, it would be helpful for Shokofin to handle the file path changing in the VFS and notify Jellyfin of the change or be able to force a scan of the library. Revam mentioned there might be a way to detect a change using signalr.

Additional Information

Relevant Error:

[2024-06-14 02:32:02.585 +00:00] [INF] [21] Shokofin.Providers.SeriesProvider: Found series "Spy x Family" (Series="214",Group="2276")
[2024-06-14 02:32:02.602 +00:00] [INF] [21] Shokofin.Providers.CustomSeriesProvider: Adding virtual Season 2 to Series "Spy x Family". (Series="215",ExtraSeries=[])
[2024-06-14 02:32:02.612 +00:00] [INF] [21] Shokofin.Providers.CustomSeriesProvider: Adding virtual Season 3 to Series "Spy x Family". (Series="213",ExtraSeries=[])
[2024-06-14 02:32:02.616 +00:00] [INF] [21] Shokofin.Providers.CustomSeriesProvider: Adding virtual Episode 1 in Season 0 for Series "Spy x Family". (Episode="7248",Series="214",ExtraSeries=[],Group="2276")
[2024-06-14 02:32:02.622 +00:00] [INF] [21] Shokofin.Providers.CustomSeriesProvider: Adding virtual Episode 2 in Season 0 for Series "Spy x Family". (Episode="7246",Series="214",ExtraSeries=[],Group="2276")
[2024-06-14 02:32:02.625 +00:00] [INF] [21] Shokofin.Providers.CustomSeriesProvider: Adding virtual Episode 3 in Season 0 for Series "Spy x Family". (Episode="7247",Series="214",ExtraSeries=[],Group="2276")
[2024-06-14 02:32:02.628 +00:00] [INF] [21] Shokofin.Providers.CustomSeriesProvider: Adding virtual Episode 4 in Season 0 for Series "Spy x Family". (Episode="7249",Series="214",ExtraSeries=[],Group="2276")
[2024-06-14 02:32:02.631 +00:00] [INF] [21] Shokofin.Providers.CustomSeriesProvider: Adding virtual Episode 5 in Season 0 for Series "Spy x Family". (Episode="7253",Series="214",ExtraSeries=[],Group="2276")
[2024-06-14 02:32:02.633 +00:00] [INF] [21] Shokofin.Providers.CustomSeriesProvider: Adding virtual Episode 6 in Season 0 for Series "Spy x Family". (Episode="7254",Series="214",ExtraSeries=[],Group="2276")
[2024-06-14 02:32:02.637 +00:00] [INF] [21] Shokofin.Providers.CustomSeriesProvider: Adding virtual Episode 7 in Season 0 for Series "Spy x Family". (Episode="7255",Series="214",ExtraSeries=[],Group="2276")
[2024-06-14 02:32:02.639 +00:00] [INF] [21] Shokofin.Providers.CustomSeriesProvider: Adding virtual Episode 8 in Season 0 for Series "Spy x Family". (Episode="7256",Series="214",ExtraSeries=[],Group="2276")
[2024-06-14 02:32:02.641 +00:00] [INF] [21] Shokofin.Providers.CustomSeriesProvider: Adding virtual Episode 9 in Season 0 for Series "Spy x Family". (Episode="7257",Series="214",ExtraSeries=[],Group="2276")
[2024-06-14 02:32:02.659 +00:00] [INF] [21] Shokofin.Providers.CustomSeriesProvider: Adding virtual Episode 10 in Season 0 for Series "Spy x Family". (Episode="7258",Series="214",ExtraSeries=[],Group="2276")
[2024-06-14 02:32:02.663 +00:00] [INF] [21] Shokofin.Providers.CustomSeriesProvider: Adding virtual Episode 11 in Season 0 for Series "Spy x Family". (Episode="7277",Series="215",ExtraSeries=[],Group="2276")
[2024-06-14 02:32:02.666 +00:00] [INF] [21] Shokofin.Providers.CustomSeriesProvider: Adding virtual Episode 12 in Season 0 for Series "Spy x Family". (Episode="7276",Series="215",ExtraSeries=[],Group="2276")
[2024-06-14 02:32:02.669 +00:00] [INF] [21] Shokofin.Providers.CustomSeriesProvider: Adding virtual Episode 13 in Season 0 for Series "Spy x Family". (Episode="7263",Series="215",ExtraSeries=[],Group="2276")
[2024-06-14 02:32:02.673 +00:00] [INF] [21] Shokofin.Providers.CustomSeriesProvider: Adding virtual Episode 14 in Season 0 for Series "Spy x Family". (Episode="7270",Series="215",ExtraSeries=[],Group="2276")
[2024-06-14 02:32:02.677 +00:00] [INF] [21] Emby.Server.Implementations.Library.LibraryManager: Removing item, Type: "Episode", Name: "Bond's Strategy to Stay Alive / Damian's Field Research Trip", Path: "", Id: 2912b1a0-fc4b-e097-0a8f-762c1aea651a
[2024-06-14 02:32:02.679 +00:00] [INF] [21] Emby.Server.Implementations.Library.LibraryManager: Removing item, Type: "Episode", Name: "Mission and Family / The Elegant Bondman / The Heart of a Child I / The Heart of a Child II / Waking Up", Path: "", Id: f6a01c70-afd0-9984-f1d4-2e170758b843
[2024-06-14 02:32:02.681 +00:00] [INF] [21] Emby.Server.Implementations.Library.LibraryManager: Removing item, Type: "Episode", Name: "The Pastry of Knowledge / The Informant's Great Romance Plan II", Path: "", Id: 7dc67597-50c0-08a1-c475-499f2357a451
[2024-06-14 02:32:02.682 +00:00] [INF] [21] Emby.Server.Implementations.Library.LibraryManager: Removing item, Type: "Episode", Name: "Plan to Cross the Border", Path: "", Id: 8adaf7b9-0792-4e28-9465-24be1c0f574b
[2024-06-14 02:32:02.683 +00:00] [INF] [21] Emby.Server.Implementations.Library.LibraryManager: Removing item, Type: "Episode", Name: "The Fearsome Luxury Cruise Ship", Path: "", Id: f1c8a2ba-6195-7b9a-b223-c7976b6510a3
[2024-06-14 02:32:02.684 +00:00] [INF] [21] Emby.Server.Implementations.Library.LibraryManager: Removing item, Type: "Episode", Name: "Who Is This Mission For?", Path: "", Id: 347acd65-092c-5b98-cd3c-22960e8fbaaa
[2024-06-14 02:32:02.685 +00:00] [INF] [21] Emby.Server.Implementations.Library.LibraryManager: Removing item, Type: "Episode", Name: "The Symphony Upon the Ship / Sis's Herb Tea", Path: "", Id: 8a524b87-39de-d295-f4e8-ef506cd53ad3
[2024-06-14 02:32:02.687 +00:00] [INF] [21] Emby.Server.Implementations.Library.LibraryManager: Removing item, Type: "Episode", Name: "The Hand That Connects to the Future", Path: "", Id: 391eb4a0-d17d-fdda-1592-435578d20b36
[2024-06-14 02:32:02.687 +00:00] [INF] [21] Emby.Server.Implementations.Library.LibraryManager: Removing item, Type: "Episode", Name: "Enjoy the Resort to the Fullest / Bragging About Vacation", Path: "", Id: 008f176f-9f49-7118-aa01-4e8c321770ae
[2024-06-14 02:32:02.703 +00:00] [INF] [21] Emby.Server.Implementations.Library.LibraryManager: Removing item, Type: "Episode", Name: "Berlint in Love / Nightfall's Daily Life", Path: "", Id: cd3dd30d-3e56-94aa-7f50-a66a571e66bf
[2024-06-14 02:32:02.705 +00:00] [INF] [21] Emby.Server.Implementations.Library.LibraryManager: Removing item, Type: "Episode", Name: "Part of the Family", Path: "", Id: fc120086-9eba-6090-4030-829d30e0a369
[2024-06-14 02:32:02.709 +00:00] [INF] [32] Shokofin.Providers.ImageProvider: Getting 3 images for series "Spy x Family" (Series="214")
[2024-06-14 02:32:02.762 +00:00] [INF] [21] MediaBrowser.Providers.TV.SeriesMetadataService: Removing virtual season 2 in series "Spy x Family"
[2024-06-14 02:32:02.762 +00:00] [INF] [21] Emby.Server.Implementations.Library.LibraryManager: Removing item, Type: "Season", Name: "Spy x Family (2022)", Path: "", Id: ae275995-d9a0-c356-9a3e-271797d366ea
[2024-06-14 02:32:02.763 +00:00] [INF] [21] MediaBrowser.Providers.TV.SeriesMetadataService: Removing virtual season 3 in series "Spy x Family"
[2024-06-14 02:32:02.763 +00:00] [INF] [21] Emby.Server.Implementations.Library.LibraryManager: Removing item, Type: "Season", Name: "Spy x Family (2023)", Path: "", Id: 71a4bae7-038e-dc92-5343-3fd6ac01c524
[2024-06-14 02:32:02.802 +00:00] [INF] [27] Shokofin.Resolvers.VirtualFileSystemService: Created 37 (37,0), fixed 0 (0,0), skipped 0 (0,0), and removed 37 (37,0,0) entries in folder at "/config/data/Shokofin/VFS/64e60291-3e81-de63-d7e4-21e0ed8e0652/Spy x Family _2023_ [Shoko Series=213]" in 00:00:00.0298973 (Total=37)
[2024-06-14 02:32:02.804 +00:00] [ERR] [21] Emby.Server.Implementations.Library.LibraryManager: Error resolving path "/config/data/Shokofin/VFS/64e60291-3e81-de63-d7e4-21e0ed8e0652/Spy x Family _2023_ [Shoko Series=213]/Season 01"
System.IO.DirectoryNotFoundException: Could not find a part of the path '/config/data/Shokofin/VFS/64e60291-3e81-de63-d7e4-21e0ed8e0652/Spy x Family _2023_ [Shoko Series=213]/Season 01'.
   at System.IO.Enumeration.FileSystemEnumerator`1.Init()
   at System.IO.DirectoryInfo.InternalEnumerateInfos(String path, String searchPattern, SearchTarget searchTarget, EnumerationOptions options)
   at MediaBrowser.Controller.Providers.DirectoryService.<>c.<GetFileSystemEntries>b__5_0(String p, IFileSystem fileSystem)
   at MediaBrowser.Controller.IO.FileData.GetFilteredFileSystemEntries(IDirectoryService directoryService, String path, IFileSystem fileSystem, IServerApplicationHost appHost, ILogger logger, ItemResolveArgs args, Int32 flattenFolderDepth, Boolean resolveShortcuts)
   at Emby.Server.Implementations.Library.LibraryManager.ResolvePath(FileSystemMetadata fileInfo, IDirectoryService directoryService, IItemResolver[] resolvers, Folder parent, Nullable`1 collectionType, LibraryOptions libraryOptions)
   at Emby.Server.Implementations.Library.LibraryManager.ResolveFileList(IReadOnlyList`1 fileList, IDirectoryService directoryService, Folder parent, Nullable`1 collectionType, IItemResolver[] resolvers, LibraryOptions libraryOptions)+MoveNext()
[2024-06-14 02:32:02.811 +00:00] [ERR] [21] Emby.Server.Implementations.Library.LibraryManager: Error resolving path "/config/data/Shokofin/VFS/64e60291-3e81-de63-d7e4-21e0ed8e0652/Spy x Family _2023_ [Shoko Series=213]/Season 00"
System.IO.DirectoryNotFoundException: Could not find a part of the path '/config/data/Shokofin/VFS/64e60291-3e81-de63-d7e4-21e0ed8e0652/Spy x Family _2023_ [Shoko Series=213]/Season 00'.
   at System.IO.Enumeration.FileSystemEnumerator`1.Init()
   at System.IO.DirectoryInfo.InternalEnumerateInfos(String path, String searchPattern, SearchTarget searchTarget, EnumerationOptions options)
   at MediaBrowser.Controller.Providers.DirectoryService.<>c.<GetFileSystemEntries>b__5_0(String p, IFileSystem fileSystem)
   at MediaBrowser.Controller.IO.FileData.GetFilteredFileSystemEntries(IDirectoryService directoryService, String path, IFileSystem fileSystem, IServerApplicationHost appHost, ILogger logger, ItemResolveArgs args, Int32 flattenFolderDepth, Boolean resolveShortcuts)
   at Emby.Server.Implementations.Library.LibraryManager.ResolvePath(FileSystemMetadata fileInfo, IDirectoryService directoryService, IItemResolver[] resolvers, Folder parent, Nullable`1 collectionType, LibraryOptions libraryOptions)
   at Emby.Server.Implementations.Library.LibraryManager.ResolveFileList(IReadOnlyList`1 fileList, IDirectoryService directoryService, Folder parent, Nullable`1 collectionType, IItemResolver[] resolvers, LibraryOptions libraryOptions)+MoveNext()
[2024-06-14 02:32:02.811 +00:00] [INF] [21] Emby.Server.Implementations.Library.LibraryManager: Removing item, Type: "Season", Name: "Spy x Family (2023)", Path: "/config/data/Shokofin/VFS/64e60291-3e81-de63-d7e4-21e0ed8e0652/Spy x Family _2023_ [Shoko Series=213]/Season 01", Id: 9f5570b4-460a-c674-9e12-42b5374c7785
[2024-06-14 02:32:02.848 +00:00] [INF] [21] Emby.Server.Implementations.Library.LibraryManager: Removing item, Type: "Season", Name: "Specials", Path: "/config/data/Shokofin/VFS/64e60291-3e81-de63-d7e4-21e0ed8e0652/Spy x Family _2023_ [Shoko Series=213]/Season 00", Id: 44f5dfc1-9c05-657d-3da3-98f1ba42b533
[2024-06-14 02:32:02.944 +00:00] [INF] [27] Shokofin.Providers.SeriesProvider: Found series "Spy x Family" (Series="214",Group="2276")
[2024-06-14 02:32:02.945 +00:00] [INF] [27] Shokofin.Providers.CustomSeriesProvider: Adding virtual Season 1 to Series "Spy x Family". (Series="214",ExtraSeries=[])
[2024-06-14 02:32:02.948 +00:00] [INF] [27] Shokofin.Providers.CustomSeriesProvider: Adding virtual Season 2 to Series "Spy x Family". (Series="215",ExtraSeries=[])
[2024-06-14 02:32:02.950 +00:00] [INF] [27] Shokofin.Providers.CustomSeriesProvider: Adding virtual Season 3 to Series "Spy x Family". (Series="213",ExtraSeries=[])
[2024-06-14 02:32:02.951 +00:00] [INF] [27] Shokofin.Providers.CustomSeriesProvider: Adding virtual Season 0 to Series "Spy x Family".
[2024-06-14 02:32:02.953 +00:00] [INF] [27] Shokofin.Providers.CustomSeriesProvider: Adding virtual Episode 1 in Season 0 for Series "Spy x Family". (Episode="7248",Series="214",ExtraSeries=[],Group="2276")
[2024-06-14 02:32:02.955 +00:00] [INF] [27] Shokofin.Providers.CustomSeriesProvider: Adding virtual Episode 2 in Season 0 for Series "Spy x Family". (Episode="7246",Series="214",ExtraSeries=[],Group="2276")
[2024-06-14 02:32:02.956 +00:00] [INF] [27] Shokofin.Providers.CustomSeriesProvider: Adding virtual Episode 3 in Season 0 for Series "Spy x Family". (Episode="7247",Series="214",ExtraSeries=[],Group="2276")
[2024-06-14 02:32:02.958 +00:00] [INF] [27] Shokofin.Providers.CustomSeriesProvider: Adding virtual Episode 4 in Season 0 for Series "Spy x Family". (Episode="7249",Series="214",ExtraSeries=[],Group="2276")
[2024-06-14 02:32:02.959 +00:00] [INF] [27] Shokofin.Providers.CustomSeriesProvider: Adding virtual Episode 5 in Season 0 for Series "Spy x Family". (Episode="7253",Series="214",ExtraSeries=[],Group="2276")
[2024-06-14 02:32:02.960 +00:00] [INF] [27] Shokofin.Providers.CustomSeriesProvider: Adding virtual Episode 6 in Season 0 for Series "Spy x Family". (Episode="7254",Series="214",ExtraSeries=[],Group="2276")
[2024-06-14 02:32:02.961 +00:00] [INF] [27] Shokofin.Providers.CustomSeriesProvider: Adding virtual Episode 7 in Season 0 for Series "Spy x Family". (Episode="7255",Series="214",ExtraSeries=[],Group="2276")
[2024-06-14 02:32:02.963 +00:00] [INF] [27] Shokofin.Providers.CustomSeriesProvider: Adding virtual Episode 8 in Season 0 for Series "Spy x Family". (Episode="7256",Series="214",ExtraSeries=[],Group="2276")
[2024-06-14 02:32:02.965 +00:00] [INF] [27] Shokofin.Providers.CustomSeriesProvider: Adding virtual Episode 9 in Season 0 for Series "Spy x Family". (Episode="7257",Series="214",ExtraSeries=[],Group="2276")
[2024-06-14 02:32:02.981 +00:00] [INF] [27] Shokofin.Providers.CustomSeriesProvider: Adding virtual Episode 10 in Season 0 for Series "Spy x Family". (Episode="7258",Series="214",ExtraSeries=[],Group="2276")
[2024-06-14 02:32:02.983 +00:00] [INF] [27] Shokofin.Providers.CustomSeriesProvider: Adding virtual Episode 11 in Season 0 for Series "Spy x Family". (Episode="7277",Series="215",ExtraSeries=[],Group="2276")
[2024-06-14 02:32:02.984 +00:00] [INF] [27] Shokofin.Providers.CustomSeriesProvider: Adding virtual Episode 12 in Season 0 for Series "Spy x Family". (Episode="7276",Series="215",ExtraSeries=[],Group="2276")
[2024-06-14 02:32:02.986 +00:00] [INF] [27] Shokofin.Providers.CustomSeriesProvider: Adding virtual Episode 13 in Season 0 for Series "Spy x Family". (Episode="7263",Series="215",ExtraSeries=[],Group="2276")
[2024-06-14 02:32:02.987 +00:00] [INF] [27] Shokofin.Providers.CustomSeriesProvider: Adding virtual Episode 14 in Season 0 for Series "Spy x Family". (Episode="7270",Series="215",ExtraSeries=[],Group="2276")
[2024-06-14 02:32:02.989 +00:00] [INF] [27] Shokofin.Providers.CustomSeriesProvider: Adding virtual Episode 15 in Season 0 for Series "Spy x Family". (Episode="7219",Series="213",ExtraSeries=[],Group="2276")
[2024-06-14 02:32:02.990 +00:00] [INF] [27] Shokofin.Providers.CustomSeriesProvider: Adding virtual Episode 16 in Season 0 for Series "Spy x Family". (Episode="7230",Series="213",ExtraSeries=[],Group="2276")
[2024-06-14 02:32:02.992 +00:00] [INF] [27] Shokofin.Providers.CustomSeriesProvider: Adding virtual Episode 17 in Season 0 for Series "Spy x Family". (Episode="7231",Series="213",ExtraSeries=[],Group="2276")
[2024-06-14 02:32:02.994 +00:00] [INF] [27] Shokofin.Providers.ImageProvider: Getting 3 images for series "Spy x Family" (Series="214")
[2024-06-14 02:32:03.025 +00:00] [INF] [11] Shokofin.Providers.SeasonProvider: Found info for Season 1 in Series "Spy x Family" (Series="214",Group="2276")
[2024-06-14 02:32:03.025 +00:00] [INF] [11] Shokofin.Providers.ImageProvider: Getting 1 images for season 1 in "Spy x Family" (Series="214")
[2024-06-14 02:32:03.077 +00:00] [INF] [11] Shokofin.Providers.SeasonProvider: Found info for Season 2 in Series "Spy x Family" (Series="214",Group="2276")
[2024-06-14 02:32:03.078 +00:00] [INF] [11] Shokofin.Providers.ImageProvider: Getting 1 images for season 2 in "Spy x Family" (Series="215")
[2024-06-14 02:32:03.105 +00:00] [INF] [27] Shokofin.Providers.SeasonProvider: Found info for Season 3 in Series "Spy x Family" (Series="214",Group="2276")
[2024-06-14 02:32:03.106 +00:00] [INF] [27] Shokofin.Providers.ImageProvider: Getting 1 images for season 3 in "Spy x Family" (Series="213")
[2024-06-14 02:32:03.136 +00:00] [INF] [27] Shokofin.Providers.EpisodeProvider: Found episode "S1 TBD Music Video" (File=null,Episode="7248",Series="214",ExtraSeries=[],Group="2276")
[2024-06-14 02:32:03.138 +00:00] [INF] [27] Shokofin.Providers.EpisodeProvider: Found episode "S2 Episode S2" (File=null,Episode="7246",Series="214",ExtraSeries=[],Group="2276")
[2024-06-14 02:32:03.140 +00:00] [INF] [27] Shokofin.Providers.EpisodeProvider: Found episode "S3 Episode S3" (File=null,Episode="7247",Series="214",ExtraSeries=[],Group="2276")
[2024-06-14 02:32:03.141 +00:00] [INF] [27] Shokofin.Providers.EpisodeProvider: Found episode "S4 Episode S4" (File=null,Episode="7249",Series="214",ExtraSeries=[],Group="2276")
[2024-06-14 02:32:03.143 +00:00] [INF] [27] Shokofin.Providers.EpisodeProvider: Found episode "S5 Mission 03 Stage Reading" (File=null,Episode="7253",Series="214",ExtraSeries=[],Group="2276")
[2024-06-14 02:32:03.144 +00:00] [INF] [27] Shokofin.Providers.EpisodeProvider: Found episode "S6 Mission 08 Stage Reading" (File=null,Episode="7254",Series="214",ExtraSeries=[],Group="2276")
[2024-06-14 02:32:03.146 +00:00] [INF] [27] Shokofin.Providers.EpisodeProvider: Found episode "S7 Mission 12 Stage Reading" (File=null,Episode="7255",Series="214",ExtraSeries=[],Group="2276")
[2024-06-14 02:32:03.160 +00:00] [INF] [27] Shokofin.Providers.EpisodeProvider: Found episode "S8 Talking Session 1" (File=null,Episode="7256",Series="214",ExtraSeries=[],Group="2276")
[2024-06-14 02:32:03.162 +00:00] [INF] [27] Shokofin.Providers.EpisodeProvider: Found episode "S9 Talking Session 2" (File=null,Episode="7257",Series="214",ExtraSeries=[],Group="2276")
[2024-06-14 02:32:03.164 +00:00] [INF] [27] Shokofin.Providers.EpisodeProvider: Found episode "S10 Spy x Family Award" (File=null,Episode="7258",Series="214",ExtraSeries=[],Group="2276")
[2024-06-14 02:32:03.166 +00:00] [INF] [27] Shokofin.Providers.EpisodeProvider: Found episode "S1 Good Day Music Video" (File=null,Episode="7277",Series="215",ExtraSeries=[],Group="2276")
[2024-06-14 02:32:03.168 +00:00] [INF] [27] Shokofin.Providers.EpisodeProvider: Found episode "S2 Breeze Music Video" (File=null,Episode="7276",Series="215",ExtraSeries=[],Group="2276")
[2024-06-14 02:32:03.170 +00:00] [INF] [27] Shokofin.Providers.EpisodeProvider: Found episode "S3 Second Cour Commemoration Special" (File=null,Episode="7263",Series="215",ExtraSeries=[],Group="2276")
[2024-06-14 02:32:03.172 +00:00] [INF] [27] Shokofin.Providers.EpisodeProvider: Found episode "S4 Episode S4" (File=null,Episode="7270",Series="215",ExtraSeries=[],Group="2276")
[2024-06-14 02:32:03.173 +00:00] [INF] [27] Shokofin.Providers.EpisodeProvider: Found episode "S1 Episode S1" (File=null,Episode="7219",Series="213",ExtraSeries=[],Group="2276")
[2024-06-14 02:32:03.175 +00:00] [INF] [27] Shokofin.Providers.EpisodeProvider: Found episode "S2 Episode S2" (File=null,Episode="7230",Series="213",ExtraSeries=[],Group="2276")
[2024-06-14 02:32:03.177 +00:00] [INF] [27] Shokofin.Providers.EpisodeProvider: Found episode "S3 Episode S3" (File=null,Episode="7231",Series="213",ExtraSeries=[],Group="2276")
[2024-06-14 02:32:03.180 +00:00] [INF] [27] Shokofin.Providers.SeriesProvider: Found series "Spy x Family" (Series="214",Group="2276")
[2024-06-14 02:32:03.182 +00:00] [INF] [27] Shokofin.Providers.ImageProvider: Getting 3 images for series "Spy x Family" (Series="214")

Duplicate Shoko Groups

I am getting a few duplicates for anime groups that have more than one series.
shoko

They have the same metadata and their contents are the same with all of the grouped series.
This is a clean Library with no metadata .nfo and only Shoko is providing metadata.
The anime series are in separate folders. E.g. "Fate/Stay Night" and "Fate/Zero" are in their own folders inside the library folder "anime".

The issue is not to do with actual seasons of an anime, but related series that are part of the same group.

I believe the issue could be jelly/shokofin sees the individual series folders, finds their group and then applies the group information to each series folder.

Any suggestions?

Feature: Link local trailers to series/movies

Abstract

Jellyfin supports trailers items, and trailers may be available locally with metadata stored in Shoko, so link them together if a series/season/movie has trailers.

To-do

  • Check if a new provider needs to be made to add Trailers, or if it is possible to re-use an existing provider.

  • Modify the series/season/movie provider to add the trailers for that series/season/movie.

Shokofin 4 Plugin throws unhandled exception

Jellyfin version.

10.9.1

Shokofin version.

4.0.0.0

Shoko Server version, release channel, and commit hash.

4.2.2 stable

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

../anime/Anime A/Season A/Episode.mkv

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

Screenshot 2024-07-05 at 18-42-25 Jellyfin

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.)

  • Yes, I hereby confirm that the issue persists after creating a library with Shoko set as the only metadata provider.

Issue

In trying to use the new 4.0 release of shokofin but it throws an exception.
I removed the old v3 plugin and the old library built with version 3, rebooted jellyfin and then tried to add back a new library.

Stack Trace

from shokoserver log:
shokoserver | 16:34:09| SentryMiddleware --- Sending event 'Sentry.SentryEvent' to Sentry.
shokoserver | 16:34:09| SentryMiddleware --- Event '00000000000000000000000000000000' queued.
shokoserver | 16:34:09| Kestrel --- Connection id "0HN4T16NPFC0I", Request id "0HN4T16NPFC0I:00000004": An unhandled exception was thrown by the application.

from jellyfin.log:
[2024-07-05 18:34:09.909 +02:00] [ERR] Threw unexpectedly; "InternalServerErrorException"
Shokofin.API.Models.ApiException: InternalServerErrorException
at Shokofin.API.ShokoAPIClient.Get[ReturnType](String url, HttpMethod method, String apiKey, Boolean skipCache)
at Shokofin.API.ShokoAPIClient.GetFilesForImportFolder(Int32 importFolderId, String subPath, Int32 page)
at Shokofin.Resolvers.VirtualFileSystemService.GetFilesForImportFolder(IReadOnlyList1 mediaConfigs, HashSet1 fileSet)+MoveNext()
at System.Linq.Enumerable.SelectEnumerableIterator2.MoveNext() at System.Threading.Tasks.Task.WhenAll(IEnumerable1 tasks)
at Shokofin.Resolvers.VirtualFileSystemService.GenerateStructure(Nullable1 collectionType, String vfsPath, IEnumerable1 allFiles)
at Shokofin.Resolvers.VirtualFileSystemService.<>c__DisplayClass16_0.<b__2>d.MoveNext()
--- End of stack trace from previous location ---
at Shokofin.Utils.GuardedMemoryCache.GetOrCreateAsync[TItem](Object key, Func1 createFactory, MemoryCacheEntryOptions createOptions) at Shokofin.Resolvers.VirtualFileSystemService.GenerateStructureInVFS(Folder mediaFolder, String path) at Shokofin.Resolvers.ShokoResolver.ResolveMultiple(Folder parent, Nullable1 collectionType, List1 fileInfoList) [2024-07-05 18:34:09.911 +02:00] [ERR] Error retrieving children folder Shokofin.API.Models.ApiException: InternalServerErrorException at Shokofin.API.ShokoAPIClient.Get[ReturnType](String url, HttpMethod method, String apiKey, Boolean skipCache) at Shokofin.API.ShokoAPIClient.GetFilesForImportFolder(Int32 importFolderId, String subPath, Int32 page) at Shokofin.Resolvers.VirtualFileSystemService.GetFilesForImportFolder(IReadOnlyList1 mediaConfigs, HashSet1 fileSet)+MoveNext() at System.Linq.Enumerable.SelectEnumerableIterator2.MoveNext()
at System.Threading.Tasks.Task.WhenAll(IEnumerable1 tasks) at Shokofin.Resolvers.VirtualFileSystemService.GenerateStructure(Nullable1 collectionType, String vfsPath, IEnumerable1 allFiles) at Shokofin.Resolvers.VirtualFileSystemService.<>c__DisplayClass16_0.<<GenerateStructureInVFS>b__2>d.MoveNext() --- End of stack trace from previous location --- at Shokofin.Utils.GuardedMemoryCache.GetOrCreateAsync[TItem](Object key, Func1 createFactory, MemoryCacheEntryOptions createOptions)
at Shokofin.Resolvers.VirtualFileSystemService.GenerateStructureInVFS(Folder mediaFolder, String path)
at Shokofin.Resolvers.ShokoResolver.ResolveMultiple(Folder parent, Nullable1 collectionType, List1 fileInfoList)
at Shokofin.Resolvers.ShokoResolver.MediaBrowser.Controller.Resolvers.IMultiItemResolver.ResolveMultiple(Folder parent, List1 files, Nullable1 collectionType, IDirectoryService directoryService)
at Emby.Server.Implementations.Library.LibraryManager.ResolvePaths(IEnumerable1 files, IDirectoryService directoryService, Folder parent, LibraryOptions libraryOptions, Nullable1 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)

Feature: Add Genre support

Abstract

Somehow link Genres in Jellyfin to Shoko.

To-do

  • Find out what the data and how it should map to Genres in Jellyfin.

  • Implement a IRemoteMetadataProvider<Genre> to get the information from Shoko.

  • Add genres to series/seasons/movies.

Bug: Image fetching is broken and possibly more?

Had a discussion on #shokofin on discord a while back. I didn't file a bug, but since this has recently been updated, I figured I'd leave this here.

I initially started looking into this when my thumbnails would never show up for new anime... so I started looking into it more.

I'm pretty sure everything is broken out of the box (at least for people who don't use the "auto group" in shoko. Not sure if this applies to people who have the library structured differently).

I did a patch on my own build back in february (disclaimer, I don't know .NET, but I just did some quick googling to figure it out)

diff --git a/Shokofin/Providers/SeriesProvider.cs b/Shokofin/Providers/SeriesProvider.cs
index e18a62d..1de4146 100644
--- a/Shokofin/Providers/SeriesProvider.cs
+++ b/Shokofin/Providers/SeriesProvider.cs
@@ -34,12 +34,17 @@ namespace Shokofin.Providers
             {
                 var result = new MetadataResult<Series>();
 
-                var dirname = Path.DirectorySeparatorChar + info.Path.Split(Path.DirectorySeparatorChar).Last();
+                var dirname = info.Path.Split(Path.DirectorySeparatorChar).Last();
 
                 _logger.LogInformation($"Shoko Scanner... Getting series ID ({dirname})");
 
                 var apiResponse = await ShokoAPI.GetSeriesPathEndsWith(dirname);
-                var seriesIDs = apiResponse.FirstOrDefault()?.IDs;
+                // if an exact match shows up, use that one.
+                var seriesIDs = apiResponse?.FirstOrDefault(series => series.Name == dirname)?.IDs;
+                if (seriesIDs is null)
+                {
+                    seriesIDs = apiResponse.FirstOrDefault()?.IDs;
+                }
                 var seriesId = seriesIDs?.ID.ToString();
 
                 if (string.IsNullOrEmpty(seriesId))

The main problem here is the var apiResponse = await ShokoAPI.GetSeriesPathEndsWith(dirname); which the URL currently ends with /, so you end up searching for /api/v3/Series/PathEndsWith//Senryuu Shoujo (double slash is intentional) for example, and this returns empty because there's no show that ends with /Senryuu Shoujo in my shoko instance.

At least for my case, this patch works perfectly. It simply checks to make sure the name is exactly the same as Shoko (since shoko is also managing the library anyways).

Without the Exact check (but with the / fix), you run into some scenarios that are unfixable even with the "Identify" feature

Eiga K-On! vs K-On! - When you Identify as K-On!, the problem is both of these shows show up in the shoko api. Since Eiga K-On! comes first, K-On! is now impossible to label as K-On!

I didn't want to think I was crazy, So i spun up 2 more jellyfin instances fresh, but using my existing library, 1 using 1.4.0 and 1 using my patched "1.3.1-dev"

No shows appeared on 1.4.0 at all - but 1.3.1-patched showed my shows with the metadata.

I don't think my patch is perfect, but this problem is there and should probably be fixed?

Shoko: 4.1.0.0 - daily build
Shokofin: 1.4.0
Jellyfin - 10.7.0

Shoko Settings:
Autogroup Series - Off
Determine Main Series... - Off

On Shokofin:
All default settings.

Jellyfin Library settings:
All Default except changing all fetchers to use Shoko only.

Subsequent scans split shows apart even is group merging is enabled

Jellyfin version.

10.9.7

Shokofin version.

4.0.1.0

Shoko Server version, release channel, and commit hash.

Version 4.2.2.0 (Dev, 2cd0a0f)

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

./Anime/Episode 1.avi

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

image
Rest is all unchecked in this section

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.)

  • Yes, I hereby confirm that the issue persists after creating a library with Shoko set as the only metadata provider.

Issue

Initial scan correctly creates shows with the Shoko groups (also seems to work if you use "Replace metadata"), subsequent normal (automated scan) splits the shows apart again.

The logs do seem to report the same group for two series:

[2024-07-11 08:11:08.015 +00:00] [INF] [79] Shokofin.Resolvers.ShokoIgnoreRule: Found shoko group "Hagane no Renkinjutsushi" (Series="9",ExtraSeries=[],Group="120")
[2024-07-11 08:11:08.034 +00:00] [INF] [79] Shokofin.Resolvers.ShokoIgnoreRule: Found shoko group "Hagane no Renkinjutsushi" (Series="20",ExtraSeries=[],Group="120")

But they still end up split up.

Stack Trace

No response

Shokofin - no connection to shokoserver in jellyfin

Trying to connect to shokoserver, but no connection could be established.

Running jellyfin in docker, added the repo from shokofin. shokoserver also run in docker. Same ip address range.

Log entries in jellyfin thrown this info:

11.04.2024
12:26:16
[12:26:16] [ERR] [13] Shokofin.Web.WebController: Failed to create an API-key for user skalcore — unable to complete the request.
11.04.2024
12:26:16
System.Net.Http.HttpRequestException: Connection timed out (192.168.178.20:8111)
11.04.2024
12:26:16
---> System.Net.Sockets.SocketException (110): Connection timed out
11.04.2024
12:26:16
at System.Net.Sockets.Socket.AwaitableSocketAsyncEventArgs.ThrowException(SocketError error, CancellationToken cancellationToken)
11.04.2024
12:26:16
at System.Net.Sockets.Socket.AwaitableSocketAsyncEventArgs.System.Threading.Tasks.Sources.IValueTaskSource.GetResult(Int16 token)
11.04.2024
12:26:16
at System.Net.Sockets.Socket.g__WaitForConnectWithCancellation|277_0(AwaitableSocketAsyncEventArgs saea, ValueTask connectTask, CancellationToken cancellationToken)
11.04.2024
12:26:16
at System.Net.Http.HttpConnectionPool.ConnectToTcpHostAsync(String host, Int32 port, HttpRequestMessage initialRequest, Boolean async, CancellationToken cancellationToken)
11.04.2024
12:26:16
--- End of inner exception stack trace ---
11.04.2024
12:26:16
at System.Net.Http.HttpConnectionPool.ConnectToTcpHostAsync(String host, Int32 port, HttpRequestMessage initialRequest, Boolean async, CancellationToken cancellationToken)
11.04.2024
12:26:16
at System.Net.Http.HttpConnectionPool.ConnectAsync(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken)
11.04.2024
12:26:16
at System.Net.Http.HttpConnectionPool.CreateHttp11ConnectionAsync(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken)
11.04.2024
12:26:16
at System.Net.Http.HttpConnectionPool.AddHttp11ConnectionAsync(HttpRequestMessage request)
11.04.2024
12:26:16
at System.Threading.Tasks.TaskCompletionSourceWithCancellation`1.WaitWithCancellationAsync(CancellationToken cancellationToken)
11.04.2024
12:26:16
at System.Net.Http.HttpConnectionPool.GetHttp11ConnectionAsync(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken)
11.04.2024
12:26:16
at System.Net.Http.HttpConnectionPool.SendWithVersionDetectionAndRetryAsync(HttpRequestMessage request, Boolean async, Boolean doRequestAuth, CancellationToken cancellationToken)
11.04.2024
12:26:16
at System.Net.Http.DiagnosticsHandler.SendAsyncCore(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken)
11.04.2024
12:26:16
at System.Net.Http.RedirectHandler.SendAsync(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken)
11.04.2024
12:26:16
at System.Net.Http.HttpClient.g__Core|83_0(HttpRequestMessage request, HttpCompletionOption completionOption, CancellationTokenSource cts, Boolean disposeCts, CancellationTokenSource pendingRequestsCts, CancellationToken originalCancellationToken)
11.04.2024
12:26:16
at Shokofin.API.ShokoAPIClient.GetApiKey(String username, String password, Boolean forUser)
11.04.2024
12:26:16
at Shokofin.Web.WebController.PostAsync(ApiLoginRequest body)

Plugin has no settings page

Somehow after installing plugin there is a no way to configure it.

Restarting Jellyfin doesn't fix it.

Jellyfin version: 10.8.11

Screenshot_20240101_091116

Generate Playlists (or Collections) for Series and Movie combinations

As a potential enhancement I would like to be able to have a Playlist (or Collection, whichever is more viable) that contains mixed media all together, so for example a playlist or collection like follows:

Neon Genesis Evangelion -> Entire original series, + End of Eva + Rebuilds

or similarly

Jujutsu Kaisen: JJK S1, JJK 0 (Movie), JJK S2

In which you can watch through the entire set of episodes and movies ordered by release all in the same location.

Shokofin not fetching trailers/credits

Jellyfin version.

10.9.8

Shokofin version.

4.1.1.0

Shoko Server version, release channel, and commit hash.

4.2.2 Stable

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

../Anime Title/Season X/S0XE0Y: Episode Title

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

Screenshot 2024-07-30 at 7 40 19 PM Screenshot 2024-07-30 at 7 40 32 PM

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.)

  • Yes, I hereby confirm that the issue persists after creating a library with Shoko set as the only metadata provider.

Issue

Shokofin doesn’t add trailers for a series (not yet tested for movies, so unsure about that) into a trailers folder that Jellyfin supports. I have VFS turned on, so I can’t manually add a trailer either. The same goes for credits as well, but I can live without it, although support for that would be great as well.

Stack Trace

No response

Shokofin Status Display update on failure

Description

Ran into a bug that took me a few days to figure out because of a bad status message. I updated to latest Shokofin and Jellyfin, and there was an issue with the connection with my Shoko server instance occurred. However, the plugin shows a status of Active even when its in a failure state due to a bad connection. I didn't realize that there was an issue until I found this line in my logs.

[2024-07-22 09:23:25.470 -04:00] [WRN] [56] Shokofin.API.ShokoAPIClient: Unable to connect to complete the request to Shoko.
System.Net.Http.HttpRequestException: Invalid or expired API Token. Please reconnect the plugin to Shoko Server by resetting the connection or deleting and re-adding the user in the plugin settings.
   at Shokofin.API.ShokoAPIClient.Get(String url, HttpMethod method, String apiKey, Boolean skipApiKey)

Suggested Solution

Some way for the plugin to alert that there has been a connection issue.

Additional Information

No response

Cast/Guest Cast images are not displayed

Screenshot 2024-08-01 at 4 09 34 AM Screenshot 2024-08-01 at 4 02 20 AM

Usually, cast images are not shown (left screenshot), and instead just a transparent image (if no image is set, Jellyfin shows a placeholder image, which isn’t the case here) is placed. This is often the case, but not always as sometimes (although rare), cast images do show up, like in the right screenshot.

This is the HTML content for the anchor tag that contains a valid cast image:

<a
  href="#/details?id=00686a421b09ba6b5154dcbc5b12bf17&amp;serverId=undefined"
  data-action="link"
  class="cardImageContainer coveredImage cardContent itemAction lazy non-blurhashable lazy-image-fadein-fast"
  aria-label="Mao"
  style='background-image: url("https://jellyfin.home/Items/00686a421b09ba6b5154dcbc5b12bf17/Images/Primary?fillHeight=669&amp;fillWidth=446&amp;quality=96&amp;tag=924f17657c5bcd2f0437774ba54d3a5c");'
></a>;

whereas, this is the HTML content for the anchor tag with the transparent image:

<a
  href="#/details?id=35698f11326c1e55fbde533d90806b70&amp;serverId=undefined"
  data-action="link"
  class="cardImageContainer coveredImage cardContent itemAction lazy non-blurhashable lazy-hidden"
  data-src="https://jellyfin.home/Items/35698f11326c1e55fbde533d90806b70/Images/Primary?fillHeight=669&amp;fillWidth=446&amp;quality=96&amp;tag=c8b7c3266fe1a187d3cd0d3bc6478d69"
  aria-label="Furukawa Makoto"
></a>;

Furthermore, navigating to the url inside the background-image property in the former HTML content takes to a valid Jellyfin page with the image, whereas navigating to the url inside data-src in the latter HTML content just shows "Error processing request".

Proposal: Add a new Series/Sesson/Episode indexer.

Proposal

I want Jellyfin's "series" to be used to group together Shoko's series (all kinds, e.g. series, web and movies) in something along the lines of Shoko's "groups", where Jellyfin's "sessions" are used to order the items in the group. The "session"'s details will be filled from the series in Shoko, and the "series"'s details will be filled from the the staring point (not necessary the first "session") of the "group". The starting point will be considered the first release in the group (e.g Fate/Stay Night for the fate series)

All misc. (other and parody), trailers and credits will be grouped at "session" index 97, 98 and 99 respectively, specials will be grouped after the episodes from the series they are in, but in a separate "session" ending with " Specials" (or localized equivalent), and the rest of the episodes will be ordered in one of the following ways:

  • By chronological order - meaning the first "session" may have been released later then the second "session", and so on. The story is followed from the first prequel to the last sequel.

  • By release date - meaning the order of which they were released. Some series expand the backstory of the original by releasing a prequel at a later time. The story may jump a bit, if you watch in this order, but sometimes that may be preferred.

Conflicts

  • All Shoko series will be stored under the same "group", so finding a series will be more difficult if you don't know the "group" it belongs to, and individual series will not be searchable.

  • Currently undefined behavior when a group of series contain alternate versions with the same prequel/sequel or both. Help needed!

Goal

So if this proposal goes though, we will have three ways to index our library:

  • A one-to-one relation between Jellyfin Series and Movies and Shoko Series.

  • A one-to-many relation between Jellyfin Series and Shoko Series.

  • Whatever TvDB decides. (Because I don't know).

Implementation To-Do

Shows as unsupported in Jellyfin 10.9.z

I was testing out the beta to see if it resolved some playback issues and found that this plugin was showing as unsupported. If there's any data you want to help figure out why, just let me know.

Error message from logs

Emby.Server.Implementations.Plugins.PluginManager: Failed to load assembly "/config/plugins/Shoko_3.0.1.34/Shokofin.dll". This error occurs when a plugin references an incompatible version of one of the shared libraries. Disabling plugin

Shokofin unexpected interal server error

Jellyfin version.

10.9.7

Shokofin version.

4.0.1.0

Shoko Server version, release channel, and commit hash.

4.2.2.0, https://truecharts.org/charts/stable/shoko-server/

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

Anime/Episode1.mkv, Anime/Episode2.mkv, Anime/Season1/Episode1.mkv ....
Basically there is no structure.

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

shokofin_1
shokofin_2
shokofin_3
shokofin_4

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.)

  • Yes, I hereby confirm that the issue persists after creating a library with Shoko set as the only metadata provider.

Issue

Refresh metadata crashes the plugin like shown in the stack trace.

Stack Trace

2024-07-07 21:06:16.201244+02:00[21:06:16] [WRN] [58] Shokofin.Providers.SeriesProvider: Unable to find show info for path /media/Animes/[Erai-raws] Ookami to Koushinryou - 01 ~ 13 [480p][Multiple Subtitle]
2024-07-07 21:06:16.259014+02:00[21:06:16] [ERR] [38] Shokofin.Resolvers.ShokoResolver: Threw unexpectedly; InternalServerErrorException
2024-07-07 21:06:16.259035+02:00Shokofin.API.Models.ApiException: InternalServerErrorException
2024-07-07 21:06:16.259043+02:00at Shokofin.API.ShokoAPIClient.Get[ReturnType](String url, HttpMethod method, String apiKey, Boolean skipCache)
2024-07-07 21:06:16.259050+02:00at Shokofin.API.ShokoAPIClient.GetFilesForImportFolder(Int32 importFolderId, String subPath, Int32 page)
2024-07-07 21:06:16.259063+02:00at Shokofin.Resolvers.VirtualFileSystemService.GetFilesForImportFolder(IReadOnlyList`1 mediaConfigs, HashSet`1 fileSet)+MoveNext()
2024-07-07 21:06:16.259071+02:00at System.Linq.Enumerable.SelectEnumerableIterator`2.MoveNext()
2024-07-07 21:06:16.259077+02:00at System.Threading.Tasks.Task.WhenAll(IEnumerable`1 tasks)
2024-07-07 21:06:16.259083+02:00at Shokofin.Resolvers.VirtualFileSystemService.GenerateStructure(Nullable`1 collectionType, String vfsPath, IEnumerable`1 allFiles)
2024-07-07 21:06:16.259089+02:00at Shokofin.Resolvers.VirtualFileSystemService.<>c__DisplayClass16_0.<<GenerateStructureInVFS>b__2>d.MoveNext()
2024-07-07 21:06:16.259095+02:00--- End of stack trace from previous location ---
2024-07-07 21:06:16.259100+02:00at Shokofin.Utils.GuardedMemoryCache.GetOrCreateAsync[TItem](Object key, Func`1 createFactory, MemoryCacheEntryOptions createOptions)
2024-07-07 21:06:16.259106+02:00at Shokofin.Resolvers.VirtualFileSystemService.GenerateStructureInVFS(Folder mediaFolder, String path)
2024-07-07 21:06:16.259112+02:00at Shokofin.Resolvers.ShokoResolver.ResolveMultiple(Folder parent, Nullable`1 collectionType, List`1 fileInfoList)
2024-07-07 21:06:16.259276+02:00[21:06:16] [ERR] [38] MediaBrowser.Controller.Entities.BaseItem: Error retrieving children
2024-07-07 21:06:16.259302+02:00Shokofin.API.Models.ApiException: InternalServerErrorException
2024-07-07 21:06:16.259313+02:00at Shokofin.API.ShokoAPIClient.Get[ReturnType](String url, HttpMethod method, String apiKey, Boolean skipCache)
2024-07-07 21:06:16.259324+02:00at Shokofin.API.ShokoAPIClient.GetFilesForImportFolder(Int32 importFolderId, String subPath, Int32 page)
2024-07-07 21:06:16.259335+02:00at Shokofin.Resolvers.VirtualFileSystemService.GetFilesForImportFolder(IReadOnlyList`1 mediaConfigs, HashSet`1 fileSet)+MoveNext()
2024-07-07 21:06:16.259346+02:00at System.Linq.Enumerable.SelectEnumerableIterator`2.MoveNext()
2024-07-07 21:06:16.259356+02:00at System.Threading.Tasks.Task.WhenAll(IEnumerable`1 tasks)
2024-07-07 21:06:16.259365+02:00at Shokofin.Resolvers.VirtualFileSystemService.GenerateStructure(Nullable`1 collectionType, String vfsPath, IEnumerable`1 allFiles)
2024-07-07 21:06:16.259374+02:00at Shokofin.Resolvers.VirtualFileSystemService.<>c__DisplayClass16_0.<<GenerateStructureInVFS>b__2>d.MoveNext()
2024-07-07 21:06:16.259383+02:00--- End of stack trace from previous location ---
2024-07-07 21:06:16.259392+02:00at Shokofin.Utils.GuardedMemoryCache.GetOrCreateAsync[TItem](Object key, Func`1 createFactory, MemoryCacheEntryOptions createOptions)
2024-07-07 21:06:16.259403+02:00at Shokofin.Resolvers.VirtualFileSystemService.GenerateStructureInVFS(Folder mediaFolder, String path)
2024-07-07 21:06:16.259414+02:00at Shokofin.Resolvers.ShokoResolver.ResolveMultiple(Folder parent, Nullable`1 collectionType, List`1 fileInfoList)
2024-07-07 21:06:16.259424+02:00at Shokofin.Resolvers.ShokoResolver.MediaBrowser.Controller.Resolvers.IMultiItemResolver.ResolveMultiple(Folder parent, List`1 files, Nullable`1 collectionType, IDirectoryService directoryService)
2024-07-07 21:06:16.259434+02:00at Emby.Server.Implementations.Library.LibraryManager.ResolvePaths(IEnumerable`1 files, IDirectoryService directoryService, Folder parent, LibraryOptions libraryOptions, Nullable`1 collectionType, IItemResolver[] resolvers)
2024-07-07 21:06:16.259443+02:00at MediaBrowser.Controller.Entities.Folder.GetNonCachedChildren(IDirectoryService directoryService)
2024-07-07 21:06:16.259466+02:00at MediaBrowser.Controller.Entities.Folder.ValidateChildrenInternal2(IProgress`1 progress, Boolean recursive, Boolean refreshChildMetadata, Boolean allowRemoveRoot, MetadataRefreshOptions refreshOptions, IDirectoryService directoryService, CancellationToken cancellationToken)
2024-07-07 21:06:21.227850+02:00[21:06:21] [INF] [38] Jellyfin.Plugin.KodiSyncQueue.EntryPoints.LibrarySyncNotification: Started library sync
2024-07-07 21:06:21.297378+02:00[21:06:21] [INF] [38] Jellyfin.Plugin.KodiSyncQueue.EntryPoints.LibrarySyncNotification: Library Sync: Updated 1 items

Automated releases not updating tag

Looking at the list of tags for Shokofin, commit bef066d has ended up being tagged twice with both 2.0.1.40 & 2.0.1.41.

Running git for-each-ref --sort=-creatordate --count 1 --format="%(refname:short)" "refs/tags/" (as per the WyriHaximus/github-action-get-previous-tag@v1 action) currently outputs 2.0.1.40 however, which leads to the next attempt at setting a tag to be the already existing 2.0.1.41...

I'd imagine the easiest resolution would be to manually create tags for 2.0.1.42 & 2.0.1.43 (or just delete the tag for 2.0.1.40) Don't think I can PR anything like this sadly!

I can however, as below, include the git commands to create the tags we'd expect if everything played nice at the expected commits however!

git tag 2.0.1.42 77980cd50fa6ef3d0094886fe0fc00f2acf21e5c
git tag 2.0.1.43 cc7df47d57226d6be6a49fdab5bf7395f8002c34

Episode Thumbnails Unavailable

On Jellyfin Web, thumbnails if not available will be replaced by the series poster. But on Jellyfin Fire TV version, they don't get replaced and will be just left blank. I tried looking around for thumbnail generation but it was only for series and movies not individual episodes.

I'm not sure if AniDB provides individual episodes thumbnails so it might not be possible to implement it. If I were to use anilist as metadata provider it will add episode thumbnails, but I'm worried it might trump shoko's configuration.

If you have any suggestions or possible workarounds it would be really helpful.

Thank you.

Wrong "Mapped Import Folder" in SignalR Settings

Jellyfin version.

10.9.7

Shokofin version.

4.0.0.20

Shoko Server version, release channel, and commit hash.

4.2.2.0 (59f051c) Dev

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

Jellyfin: /media/TVアニメ/Series/Episode.mkv
Shoko: /mnt/anime/TVアニメ/Series/Episode.mkv

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

image

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.)

  • Yes, I hereby confirm that the issue persists after creating a library with Shoko set as the only metadata provider.

Issue

The path in the "Mapped Import Folder" in Shokofin settings is incorrect
image

Stack Trace

No response

Specials not excluded from season

I have customized this option:
image

And despite choosing this option (before creating a library) the specials show up in season:
image

The specials also show up in additional season (there are 12 regular episodes and 6 specials in main season and the same 6 specials in Specials season):
image

A interesting fact: despite being in Specials season...
image

the first episode
image

Getting NotSupported-error

Here is log of the things, " This error occurs when a plugin references an incompatible version of one of the shared libraries." seems to be the main issue with this

[2022-06-20 14:12:02.286 +03:00] [INF] [1] Main: Jellyfin version: "10.8.0"
[2022-06-20 14:12:02.319 +03:00] [INF] [1] Main: Environment Variables: ["[JELLYFIN_LOG_DIR, F:\Programs\Jellyfin\Server\log]"]
[2022-06-20 14:12:02.327 +03:00] [INF] [1] Main: Arguments: ["C:\Program Files\Jellyfin\Server\jellyfin.dll", "--datadir", "F:\Programs\Jellyfin\Server"]
[2022-06-20 14:12:02.330 +03:00] [INF] [1] Main: Operating system: "Windows"
[2022-06-20 14:12:02.332 +03:00] [INF] [1] Main: Architecture: X64
[2022-06-20 14:12:02.337 +03:00] [INF] [1] Main: 64-Bit Process: True
[2022-06-20 14:12:02.338 +03:00] [INF] [1] Main: User Interactive: True
[2022-06-20 14:12:02.339 +03:00] [INF] [1] Main: Processor count: 4
[2022-06-20 14:12:02.340 +03:00] [INF] [1] Main: Program data path: "F:\Programs\Jellyfin\Server"
[2022-06-20 14:12:02.342 +03:00] [INF] [1] Main: Web resources path: "C:\Program Files\Jellyfin\Server\jellyfin-web"
[2022-06-20 14:12:02.343 +03:00] [INF] [1] Main: Application directory: "C:\Program Files\Jellyfin\Server"
[2022-06-20 14:12:03.175 +03:00] [INF] [1] Emby.Server.Implementations.AppBase.BaseConfigurationManager: Setting cache path: "F:\Programs\Jellyfin\Server\cache"
[2022-06-20 14:12:03.673 +03:00] [INF] [1] Emby.Server.Implementations.ApplicationHost: Loading assemblies
[2022-06-20 14:12:05.113 +03:00] [ERR] [1] Emby.Server.Implementations.Plugins.PluginManager: Failed to load assembly "F:\Programs\Jellyfin\Server\plugins\Shoko_1.7.3.0\Shokofin.dll". This error occurs when a plugin references an incompatible version of one of the shared libraries. Disabling plugin.
System.Reflection.ReflectionTypeLoadException: Unable to load one or more of the requested types.
Method 'ExecuteAsync' in type 'Shokofin.Tasks.ExportUserDataTask' from assembly 'Shokofin, Version=1.7.3.0, Culture=neutral, PublicKeyToken=null' does not have an implementation.
Method 'ExecuteAsync' in type 'Shokofin.Tasks.ImportUserDataTask' from assembly 'Shokofin, Version=1.7.3.0, Culture=neutral, PublicKeyToken=null' does not have an implementation.
Method 'ExecuteAsync' in type 'Shokofin.Tasks.SyncUserDataTask' from assembly 'Shokofin, Version=1.7.3.0, Culture=neutral, PublicKeyToken=null' does not have an implementation.
at System.Reflection.RuntimeModule.GetTypes(RuntimeModule module)
at System.Reflection.Assembly.GetTypes()
at Emby.Server.Implementations.Plugins.PluginManager.LoadAssemblies()+MoveNext()
System.TypeLoadException: Method 'ExecuteAsync' in type 'Shokofin.Tasks.ExportUserDataTask' from assembly 'Shokofin, Version=1.7.3.0, Culture=neutral, PublicKeyToken=null' does not have an implementation.
System.TypeLoadException: Method 'ExecuteAsync' in type 'Shokofin.Tasks.ImportUserDataTask' from assembly 'Shokofin, Version=1.7.3.0, Culture=neutral, PublicKeyToken=null' does not have an implementation.
System.TypeLoadException: Method 'ExecuteAsync' in type 'Shokofin.Tasks.SyncUserDataTask' from assembly 'Shokofin, Version=1.7.3.0, Culture=neutral, PublicKeyToken=null' does not have an implementation.
[2022-06-20 14:12:06.615 +03:00] [INF] [1] Jellyfin.Networking.Manager.NetworkManager: Defined LAN addresses : "[10.0.0.0/8,172.16.0.0/12,192.168.0.0/16]"
[2022-06-20 14:12:06.618 +03:00] [INF] [1] Jellyfin.Networking.Manager.NetworkManager: Defined LAN exclusions : "[]"
[2022-06-20 14:12:06.620 +03:00] [INF] [1] Jellyfin.Networking.Manager.NetworkManager: Using LAN addresses: "[10.0.0.0/8,172.16.0.0/12,192.168.0.0/16]"
[2022-06-20 14:12:06.645 +03:00] [INF] [1] Jellyfin.Networking.Manager.NetworkManager: Using bind addresses: "[]"
[2022-06-20 14:12:06.647 +03:00] [INF] [1] Jellyfin.Networking.Manager.NetworkManager: Using bind exclusions: "[]"
[2022-06-20 14:12:11.891 +03:00] [INF] [1] Emby.Server.Implementations.Plugins.PluginManager: Loaded plugin: "TMDb" "10.8.0.0"
[2022-06-20 14:12:11.894 +03:00] [INF] [1] Emby.Server.Implementations.Plugins.PluginManager: Loaded plugin: "Studio Images" "10.8.0.0"
[2022-06-20 14:12:11.897 +03:00] [INF] [1] Emby.Server.Implementations.Plugins.PluginManager: Loaded plugin: "OMDb" "10.8.0.0"
[2022-06-20 14:12:11.899 +03:00] [INF] [1] Emby.Server.Implementations.Plugins.PluginManager: Loaded plugin: "MusicBrainz" "10.8.0.0"
[2022-06-20 14:12:11.902 +03:00] [INF] [1] Emby.Server.Implementations.Plugins.PluginManager: Loaded plugin: "AudioDB" "10.8.0.0"

Support differing internal and external domain names

Description

My Jellyfin instance runs inside of a docker container and uses internal dns to communicate with shoko.

e.g.

http://shoko-server.ix-shoko-server.svc.cluster.local:8111

Under advanced settings there is an option to set a public Shoko host URL, I thought this could be used for Shoko links so that they pointed to the correct domain outside the container. However it looks like other traffic is trying to be sent to this domain, rather than just links.

e.g.

[2024-06-10 03:19:07.522 -04:00] [WRN] [23] Emby.Server.Implementations.Library.LibraryManager: Cannot fetch image from "https://shoko.mydomain.com/api/v3/Image/Shoko/Staff/1464". Http status code: null

This domain is not accessible inside of the docker container, because the docker container is not using my LAN DNS server, thus the nslookup fails. http://shoko-server.ix-shoko-server.svc.cluster.local is the domain name it should be using for internal requests (between containers), and it seems this is the domain name that gets used if you leave this blank.

So this puts me in an odd scenario where I can choose to have either the Shoko series links broken or have Shokofin requests fail.

Suggested Solution

An option that causes this domain to only be used for links and not be used for requests to the Shoko server.

Additional Information

No response

Feature: Add support for the "Display missing episodes within sessions" library setting, (without using TvDB).

Motivation

The TvDB is not always correct, and I don't want to start a VM to use desktop (v1) just to correct a mistaken link if I can avoid it altogether. Also, I try to only use Shoko as a Metadata Provider for Jellyfin, and this do not work out-of-the-box without enabling TvDB as a provider.

Goal

See the episodes you haven't collected yet among the series with only using Shoko as a metadata provider.

To Do

  • Add a new API call to get episodes in a series. /api/v3/Series/{id}/Episode already provides IEnumerable<Episode> for us to use.

  • Add a new class implementing ILibraryPostScanTask (used to post-process a library after an import), and hook it into populating the missing data if the option is enabled in the library settings. USing a new ExtraMetadataProvider to add extra metadata such as trailers, theme-videos, and metadata on missing episodes.

Shokofin or ShokoJellyfin Manual install?

Due to ongoing issues with installing plugins in Jellyfin on Windows, sometimes it doesn't want to install.
I am attempting to install Shokofin manually. My question is, the install guide does not seem to be accurate?

It is stated Extract the contained Shokofin.dll and meta.json, place both the files in a folder named Shokofin
However, the latest release has the .dll as ShokoJellyfin.dll not Shokofin.dll. Inside the meta.json as well, it states "name": "ShokoJellyfin",. This makes me question, the proper name of the .dll, as well as the folder name for the plugin.

From the looks of things, you guys are in the process of migrating from ShokoJellyfin to Shokofin, however it does not seem to be done yet.
So I wanted to ensure, as of the time of writing this (Release v1.2.0) the proper format should in fact be which of the following?:

/jellyfin/plugins/ShokoJellyfin/ShokoJellyfin.dll, meta.json
/jellyfin/plugins/ShokoJellyfin/Shokofin.dll, meta.json
/jellyfin/plugins/Shokofin/ShokoJellyfin.dll, meta.json
/jellyfin/plugins/Shokofin/Shokofin.dll

I assume /jellyfin/plugins/ShokoJellyfin/ShokoJellyfin.dll, meta.json to be the proper format?
I ask this because I have tested all of these, and restarted Jellyfin-server between each, and have not seen it appear in plugins. However again, there is a bug on Windows with plugins, and I have had a bit of a buggy experience with manually installing plugins as well. It may need some time to update or fix itself. Unless something is wrong with the plugin, or simply the naming format which is what I wanted to ensure above.
Thanks.

Currently shows as unsupported in 10.8.0 Beta 1 and 2

Plugin currently shows as unsupported in 10.8.0 Beta 1 and 2. Running in Docker on Synology NAS

image

Log:
[ERR] [1] Emby.Server.Implementations.Plugins.PluginManager: Failed to load assembly /config/plugins/Shoko_1.7.2.0/Shokofin.dll. This error occurs when a plugin references an incompatible version of one of the shared libraries. Disabling plugin.

System.Reflection.ReflectionTypeLoadException: Unable to load one or more of the requested types.

Method 'ExecuteAsync' in type 'Shokofin.Tasks.ExportUserDataTask' from assembly 'Shokofin, Version=1.7.2.0, Culture=neutral, PublicKeyToken=null' does not have an implementation.

Method 'ExecuteAsync' in type 'Shokofin.Tasks.ImportUserDataTask' from assembly 'Shokofin, Version=1.7.2.0, Culture=neutral, PublicKeyToken=null' does not have an implementation.

Method 'ExecuteAsync' in type 'Shokofin.Tasks.SyncUserDataTask' from assembly 'Shokofin, Version=1.7.2.0, Culture=neutral, PublicKeyToken=null' does not have an implementation.

at System.Reflection.RuntimeModule.GetTypes(RuntimeModule module)

at System.Reflection.Assembly.GetTypes()
_AJJELLAY15_logs.txt

at Emby.Server.Implementations.Plugins.PluginManager.LoadAssemblies()+MoveNext()

System.TypeLoadException: Method 'ExecuteAsync' in type 'Shokofin.Tasks.ExportUserDataTask' from assembly 'Shokofin, Version=1.7.2.0, Culture=neutral, PublicKeyToken=null' does not have an implementation.

System.TypeLoadException: Method 'ExecuteAsync' in type 'Shokofin.Tasks.ImportUserDataTask' from assembly 'Shokofin, Version=1.7.2.0, Culture=neutral, PublicKeyToken=null' does not have an implementation.

Specials Position not handled properly

Screenshot 2024-07-30 at 7 51 14 PM

Specials Placement works perfectly when the default option (placed after normal episodes) is selected. #37 resolved the last option as well (to exclude specials within seasons). The remaining options still don’t work for me (yes, I have deleted and recreated the library), and selecting any of those will just work as the default option (place specials after seasons).

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.