Feature/misc (#1234)
* Fixed a bug where publication status could show as filled in when total number is 0 but there is a max count. Add ComicInfo support for LocalizedSeries which will populate a Series LocalizedName. Fixed an issue in tag constraint issues. * Hooked in LocalizedSeries tag into merge step in scanner. * Hooked in LocalizedSeries from ComicInfo into Kavita and also use it to help during merge phase to avoid 2 different series, if one file is using the name of the localized series. * Reduced some extra string creation and updated epub library to ignore bad ToCs. * Bumped dependencies to latest. When an epub doesn't have a dc:date with publication event type, default back to just a normal dc:date tag. * Fixed a bug where webtoon reader would error out on first load due to how we passed the function to the reader * Reverted the centering code
This commit is contained in:
parent
0eb3d74ff9
commit
1e51e39f66
17 changed files with 114 additions and 66 deletions
|
|
@ -20,6 +20,7 @@ using Microsoft.IO;
|
|||
using SixLabors.ImageSharp;
|
||||
using SixLabors.ImageSharp.PixelFormats;
|
||||
using VersOne.Epub;
|
||||
using VersOne.Epub.Options;
|
||||
using Image = SixLabors.ImageSharp.Image;
|
||||
|
||||
namespace API.Services
|
||||
|
|
@ -59,6 +60,13 @@ namespace API.Services
|
|||
private readonly StylesheetParser _cssParser = new ();
|
||||
private static readonly RecyclableMemoryStreamManager StreamManager = new ();
|
||||
private const string CssScopeClass = ".book-content";
|
||||
public static readonly EpubReaderOptions BookReaderOptions = new()
|
||||
{
|
||||
PackageReaderOptions = new PackageReaderOptions()
|
||||
{
|
||||
IgnoreMissingToc = true
|
||||
}
|
||||
};
|
||||
|
||||
public BookService(ILogger<BookService> logger, IDirectoryService directoryService, IImageService imageService)
|
||||
{
|
||||
|
|
@ -383,10 +391,14 @@ namespace API.Services
|
|||
|
||||
try
|
||||
{
|
||||
using var epubBook = EpubReader.OpenBook(filePath);
|
||||
using var epubBook = EpubReader.OpenBook(filePath, BookReaderOptions);
|
||||
var publicationDate =
|
||||
epubBook.Schema.Package.Metadata.Dates.FirstOrDefault(date => date.Event == "publication")?.Date;
|
||||
|
||||
if (string.IsNullOrEmpty(publicationDate))
|
||||
{
|
||||
publicationDate = epubBook.Schema.Package.Metadata.Dates.FirstOrDefault()?.Date;
|
||||
}
|
||||
var info = new ComicInfo()
|
||||
{
|
||||
Summary = epubBook.Schema.Package.Metadata.Description,
|
||||
|
|
@ -450,7 +462,7 @@ namespace API.Services
|
|||
return docReader.GetPageCount();
|
||||
}
|
||||
|
||||
using var epubBook = EpubReader.OpenBook(filePath);
|
||||
using var epubBook = EpubReader.OpenBook(filePath, BookReaderOptions);
|
||||
return epubBook.Content.Html.Count;
|
||||
}
|
||||
catch (Exception ex)
|
||||
|
|
@ -504,7 +516,7 @@ namespace API.Services
|
|||
|
||||
try
|
||||
{
|
||||
using var epubBook = EpubReader.OpenBook(filePath);
|
||||
using var epubBook = EpubReader.OpenBook(filePath, BookReaderOptions);
|
||||
|
||||
// <meta content="The Dark Tower" name="calibre:series"/>
|
||||
// <meta content="Wolves of the Calla" name="calibre:title_sort"/>
|
||||
|
|
@ -669,8 +681,7 @@ namespace API.Services
|
|||
return GetPdfCoverImage(fileFilePath, fileName, outputDirectory);
|
||||
}
|
||||
|
||||
using var epubBook = EpubReader.OpenBook(fileFilePath);
|
||||
|
||||
using var epubBook = EpubReader.OpenBook(fileFilePath, BookReaderOptions);
|
||||
|
||||
try
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue