PDF Metadata Support (#3552)
Co-authored-by: Matthias Neeracher <microtherion@gmail.com>
This commit is contained in:
parent
56108eb373
commit
f76de42b28
24 changed files with 1949 additions and 57 deletions
|
@ -81,4 +81,47 @@ public class BookServiceTests
|
|||
Assert.Equal("Accel World", comicInfo.Series);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ShouldHaveComicInfoForPdf()
|
||||
{
|
||||
var testDirectory = Path.Join(Directory.GetCurrentDirectory(), "../../../Services/Test Data/BookService");
|
||||
var document = Path.Join(testDirectory, "test.pdf");
|
||||
var comicInfo = _bookService.GetComicInfo(document);
|
||||
Assert.NotNull(comicInfo);
|
||||
Assert.Equal("Variations Chromatiques de concert", comicInfo.Title);
|
||||
Assert.Equal("Georges Bizet \\(1838-1875\\)", comicInfo.Writer);
|
||||
}
|
||||
|
||||
// TODO: Get the file from microtherion
|
||||
// [Fact]
|
||||
// public void ShouldUsePdfInfoDict()
|
||||
// {
|
||||
// var testDirectory = Path.Join(Directory.GetCurrentDirectory(), "../../../Services/Test Data/ScannerService/Library/Books/PDFs");
|
||||
// var document = Path.Join(testDirectory, "Rollo at Work SP01.pdf");
|
||||
// var comicInfo = _bookService.GetComicInfo(document);
|
||||
// Assert.NotNull(comicInfo);
|
||||
// Assert.Equal("Rollo at Work", comicInfo.Title);
|
||||
// Assert.Equal("Jacob Abbott", comicInfo.Writer);
|
||||
// Assert.Equal(2008, comicInfo.Year);
|
||||
// }
|
||||
|
||||
[Fact]
|
||||
public void ShouldHandleIndirectPdfObjects()
|
||||
{
|
||||
var testDirectory = Path.Join(Directory.GetCurrentDirectory(), "../../../Services/Test Data/BookService");
|
||||
var document = Path.Join(testDirectory, "indirect.pdf");
|
||||
var comicInfo = _bookService.GetComicInfo(document);
|
||||
Assert.NotNull(comicInfo);
|
||||
Assert.Equal(2018, comicInfo.Year);
|
||||
Assert.Equal(8, comicInfo.Month);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void FailGracefullyWithEncryptedPdf()
|
||||
{
|
||||
var testDirectory = Path.Join(Directory.GetCurrentDirectory(), "../../../Services/Test Data/BookService");
|
||||
var document = Path.Join(testDirectory, "encrypted.pdf");
|
||||
var comicInfo = _bookService.GetComicInfo(document);
|
||||
Assert.Null(comicInfo);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -101,7 +101,22 @@ public class ScannerServiceTests : AbstractDbTest
|
|||
[Fact]
|
||||
public async Task ScanLibrary_FlatSeriesWithSpecialFolder()
|
||||
{
|
||||
var testcase = "Flat Series with Specials Folder - Manga.json";
|
||||
var testcase = "Flat Series with Specials Folder Alt Naming - Manga.json";
|
||||
var library = await _scannerHelper.GenerateScannerData(testcase);
|
||||
var scanner = _scannerHelper.CreateServices();
|
||||
await scanner.ScanLibrary(library.Id);
|
||||
var postLib = await _unitOfWork.LibraryRepository.GetLibraryForIdAsync(library.Id, LibraryIncludes.Series);
|
||||
|
||||
Assert.NotNull(postLib);
|
||||
Assert.Single(postLib.Series);
|
||||
Assert.Equal(4, postLib.Series.First().Volumes.Count);
|
||||
Assert.NotNull(postLib.Series.First().Volumes.FirstOrDefault(v => v.Chapters.FirstOrDefault(c => c.IsSpecial) != null));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task ScanLibrary_FlatSeriesWithSpecialFolder_AlternativeNaming()
|
||||
{
|
||||
var testcase = "Flat Series with Specials Folder Alt Naming - Manga.json";
|
||||
var library = await _scannerHelper.GenerateScannerData(testcase);
|
||||
var scanner = _scannerHelper.CreateServices();
|
||||
await scanner.ScanLibrary(library.Id);
|
||||
|
|
BIN
API.Tests/Services/Test Data/BookService/encrypted.pdf
Normal file
BIN
API.Tests/Services/Test Data/BookService/encrypted.pdf
Normal file
Binary file not shown.
BIN
API.Tests/Services/Test Data/BookService/indirect.pdf
Normal file
BIN
API.Tests/Services/Test Data/BookService/indirect.pdf
Normal file
Binary file not shown.
|
@ -0,0 +1,6 @@
|
|||
[
|
||||
"My Dress-Up Darling/My Dress-Up Darling v01.cbz",
|
||||
"My Dress-Up Darling/My Dress-Up Darling v02.cbz",
|
||||
"My Dress-Up Darling/My Dress-Up Darling ch 10.cbz",
|
||||
"My Dress-Up Darling/Specials/My Dress-Up Darling - Omakes SP01.cbz"
|
||||
]
|
Loading…
Add table
Add a link
Reference in a new issue