jellyfin / jellyfin-plugin-bookshelf

https://jellyfin.org
MIT License
195 stars 20 forks source link

Cover image not extracted from ePUB files #90

Closed yodaldevoid closed 5 months ago

yodaldevoid commented 5 months ago

I have some books in ePUB format that bookshelf fails to load covers from. The name of the book loads as well as the publication year, but nothing else. I have confirmed that each book has a cover image in the PNG format tagged with the cover-image property. I have also confirmed that this is (probably) not a permissions issue as Jellyfin can read and display the ePUB file if I open it.

Normally providing one of the failing files would be difficult, but thankfully one of them is free. https://www.dragonsteelbooks.com/products/long-chills-and-case-dough-ebook

A (probably) relevant section of the Jellyfin log below:

[2024-01-14 23:18:38.601 -05:00] [ERR] [168] MediaBrowser.Providers.Books.BookMetadataService: Error in "Epub Metadata"
System.NotSupportedException: This stream from ZipArchiveEntry does not support reading.
   at System.IO.Compression.SubReadStream.ThrowIfCantRead()
   at System.IO.Compression.SubReadStream.ReadAsync(Memory`1 buffer, CancellationToken cancellationToken)
   at System.IO.Stream.<CopyToAsync>g__Core|29_0(Stream source, Stream destination, Int32 bufferSize, CancellationToken cancellationToken)
   at System.IO.Compression.DeflateStream.CopyToStream.CopyFromSourceToDestinationAsync()
   at Jellyfin.Plugin.Bookshelf.Providers.Epub.EpubMetadataImageProvider.LoadCover(ZipArchive epub, XmlDocument opf, String opfRootDirectory)
   at MediaBrowser.Providers.Manager.ItemImageProvider.RefreshFromProvider(BaseItem item, IDynamicImageProvider provider, ImageRefreshOptions refreshOptions, TypeOptions savedOptions, ICollection`1 downloadedImages, RefreshResult result, CancellationToken cancellationToken)
[2024-01-14 23:18:38.601 -05:00] [ERR] [164] MediaBrowser.Providers.Books.BookMetadataService: Error in "Epub Metadata"
System.NotSupportedException: This stream from ZipArchiveEntry does not support reading.
   at System.IO.Compression.SubReadStream.ThrowIfCantRead()
   at System.IO.Compression.SubReadStream.ReadAsync(Memory`1 buffer, CancellationToken cancellationToken)
   at System.IO.Stream.<CopyToAsync>g__Core|29_0(Stream source, Stream destination, Int32 bufferSize, CancellationToken cancellationToken)
   at System.IO.Compression.DeflateStream.CopyToStream.CopyFromSourceToDestinationAsync()
   at Jellyfin.Plugin.Bookshelf.Providers.Epub.EpubMetadataImageProvider.LoadCover(ZipArchive epub, XmlDocument opf, String opfRootDirectory)
   at MediaBrowser.Providers.Manager.ItemImageProvider.RefreshFromProvider(BaseItem item, IDynamicImageProvider provider, ImageRefreshOptions refreshOptions, TypeOptions savedOptions, ICollection`1 downloadedImages, RefreshResult result, CancellationToken cancellationToken)
[2024-01-14 23:18:38.601 -05:00] [ERR] [156] MediaBrowser.Providers.Books.BookMetadataService: Error in "Epub Metadata"
System.NotSupportedException: This stream from ZipArchiveEntry does not support reading.
   at System.IO.Compression.SubReadStream.ThrowIfCantRead()
   at System.IO.Compression.SubReadStream.ReadAsync(Memory`1 buffer, CancellationToken cancellationToken)
   at System.IO.Stream.<CopyToAsync>g__Core|29_0(Stream source, Stream destination, Int32 bufferSize, CancellationToken cancellationToken)
   at System.IO.Compression.DeflateStream.CopyToStream.CopyFromSourceToDestinationAsync()
   at Jellyfin.Plugin.Bookshelf.Providers.Epub.EpubMetadataImageProvider.LoadCover(ZipArchive epub, XmlDocument opf, String opfRootDirectory)
   at MediaBrowser.Providers.Manager.ItemImageProvider.RefreshFromProvider(BaseItem item, IDynamicImageProvider provider, ImageRefreshOptions refreshOptions, TypeOptions savedOptions, ICollection`1 downloadedImages, RefreshResult result, CancellationToken cancellationToken)
[2024-01-14 23:18:38.601 -05:00] [ERR] [169] MediaBrowser.Providers.Books.BookMetadataService: Error in "Epub Metadata"
System.NotSupportedException: This stream from ZipArchiveEntry does not support reading.
   at System.IO.Compression.SubReadStream.ThrowIfCantRead()
   at System.IO.Compression.SubReadStream.ReadAsync(Memory`1 buffer, CancellationToken cancellationToken)
   at System.IO.Stream.<CopyToAsync>g__Core|29_0(Stream source, Stream destination, Int32 bufferSize, CancellationToken cancellationToken)
   at System.IO.Compression.DeflateStream.CopyToStream.CopyFromSourceToDestinationAsync()
   at Jellyfin.Plugin.Bookshelf.Providers.Epub.EpubMetadataImageProvider.LoadCover(ZipArchive epub, XmlDocument opf, String opfRootDirectory)
   at MediaBrowser.Providers.Manager.ItemImageProvider.RefreshFromProvider(BaseItem item, IDynamicImageProvider provider, ImageRefreshOptions refreshOptions, TypeOptions savedOptions, ICollection`1 downloadedImages, RefreshResult result, CancellationToken cancellationToken)
[2024-01-14 23:18:38.601 -05:00] [ERR] [171] MediaBrowser.Providers.Books.BookMetadataService: Error in "Epub Metadata"
System.NotSupportedException: This stream from ZipArchiveEntry does not support reading.
   at System.IO.Compression.SubReadStream.ThrowIfCantRead()
   at System.IO.Compression.SubReadStream.ReadAsync(Memory`1 buffer, CancellationToken cancellationToken)
   at System.IO.Stream.<CopyToAsync>g__Core|29_0(Stream source, Stream destination, Int32 bufferSize, CancellationToken cancellationToken)
   at System.IO.Compression.DeflateStream.CopyToStream.CopyFromSourceToDestinationAsync()
   at Jellyfin.Plugin.Bookshelf.Providers.Epub.EpubMetadataImageProvider.LoadCover(ZipArchive epub, XmlDocument opf, String opfRootDirectory)
   at MediaBrowser.Providers.Manager.ItemImageProvider.RefreshFromProvider(BaseItem item, IDynamicImageProvider provider, ImageRefreshOptions refreshOptions, TypeOptions savedOptions, ICollection`1 downloadedImages, RefreshResult result, CancellationToken cancellationToken)
[2024-01-14 23:19:16.060 -05:00] [INF] [167] Emby.Server.Implementations.IO.LibraryMonitor: "Brandon Sanderson" ("/data/books/Books/Brandon Sanderson") will be refreshed.
[2024-01-14 23:19:16.060 -05:00] [INF] [167] Emby.Server.Implementations.IO.LibraryMonitor: "Long Chills and Case Dough" ("/data/books/Books/Brandon Sanderson/Long_Chills_and_Case_Dough_by_Brandon_Sanderson.epub") will be refreshed.
[2024-01-14 23:19:16.060 -05:00] [INF] [167] Emby.Server.Implementations.IO.LibraryMonitor: "The Frugal Wizard’s Handbook for Surviving Medieval England" ("/data/books/Books/Brandon Sanderson/The_Frugal_Wizard_s_Handbook_for_Surviving_Medieval_England_by_Brandon_Sanderson.epub") will be refreshed.
[2024-01-14 23:19:16.060 -05:00] [INF] [167] Emby.Server.Implementations.IO.LibraryMonitor: "The Sunlit Man" ("/data/books/Books/Brandon Sanderson/The_Sunlit_Man_by_Brandon_Sanderson.epub") will be refreshed.
[2024-01-14 23:19:16.060 -05:00] [INF] [167] Emby.Server.Implementations.IO.LibraryMonitor: "Tress of the Emerald Sea" ("/data/books/Books/Brandon Sanderson/Tress_of_the_Emerald_Sea_by_Brandon_Sanderson.epub") will be refreshed.
[2024-01-14 23:19:16.060 -05:00] [INF] [167] Emby.Server.Implementations.IO.LibraryMonitor: "Yumi and the Nightmare Painter" ("/data/books/Books/Brandon Sanderson/Yumi_and_the_Nightmare_Painter_by_Brandon_Sanderson.epub") will be refreshed.
[2024-01-14 23:22:38.633 -05:00] [INF] [114] Emby.Server.Implementations.IO.LibraryMonitor: "Brandon Sanderson" ("/data/books/Books/Brandon Sanderson") will be refreshed.
FelixSchwarz commented 5 months ago

I just tried with the v10 release and I can see the cover image just fine. I experienced similar issues with other books so could you retry with the latest plugin version?

yodaldevoid commented 5 months ago

Well isn't that perfect timing! Version 10 do indeed resolve this issue.