15 Commits

Author SHA1 Message Date
Joseph Milazzo
a01613f80f
EPUB Support (#178)
* Added book filetype detection and reorganized tests due to size of file

* Added ability to get basic Parse Info from Book and Pages.

* We can now scan books and get them in a library with cover images.

* Take the first image in the epub if the cover isn't set.

* Implemented the ability to unzip the ebup to cache. Implemented a test api to load html files.

* Just some test code to figure out how to approach this.

* Fixed some merge conflicts

* Removed some dead code from merge

* Snapshot: I can now load everything properly into the UI by rewriting the urls before I send them back. I don't notice any lag from this method. It can be optimized further.

* Implemented a way to load the content in the browser not via an iframe.

* Added a note

* Anchor mappings is complete. New anchors are updated so references now resolve to javascript:void() for UI to take care of internally loading and the appropriate page is mapped to it. Anchors that are external have target="_blank" added so they don't force you out of the app and styles are of course inlined.

* Oops i need this

* Table of contents api implemented (rough) and some small enhancements to codebase for books.

* GetBookPageResources now only loads files from within the book. Nested chapter list support and images now use html parsing instead of string parsing.

* Fonts now are remapped to load from endpoint.

* book-resources now uses a key, ensuring the file is in proper format for lookup. Changed chapter list based on structure with one HEADER and nested chapters.

* Properly handle svg resource requests and when there are part anchors that are clickable, make sure we handle them in the UI by adding a kavita-page handler.

* Add Chapter group page even if one isn't set by using first page (without part) from nestedChildren.

* Added extra debug code for issue #163.

* Added new user preferences for books and updated the css so we scope it to our reading section.

* Cleaned up style code

* Implemented ability to save book preferences and some cleanup on existing apis.

* Added an api for checking if a user has read something in a library type before.

* Forgot to make sure the has reading progress is against a user lol.

* Remove cacheservice code for books, sine we use an in-memory method

* Handle svg images as well

* Enhanced cover image extraction to check for a "cover" image if the cover image wasn't set in OPF before falling back to the first image.

* Fixed an issue with special books not properly generating metadata due to not having filename set.

* Cleanup, removed warmup task code from statup/program and changed taskscheduler to schedule tasks on startup only (or if tasks are changed from UI).

* Code cleanup

* Code cleanup

* So much code. Lots of refactors to try to test scanner service. Moved a lot of the queries into Extensions to allow to easier test, even though it's hacky. Support @font-face src:url swaps with ' and ". Source summary information from epubs.

* Well...baseURL needs to come from BE and not from UI lol.

* Adjusted migrations so default values match Entity

* Removed comment

* I think I finally fixed #163! The issue was that when i checked if it had a parserInfo, i wasn't considering that the chapter range might have a - in it (0-6) and so when the code to check if range could parse out a number failed, it treated it like a special and checked range against info's filename.

* Some bugfixes

* Lots of testing, extracting code to make it easier to test. This code is buggy, but fixed a bug where 1) If we changed the normalization code, we would remove the whole db during a scan and 2) We weren't actually removing series properly.

Other than that, code is being extracted to remove duplication and centralize logic.

* More code cleanup and test cleanup to ensure scan loop is working as expected and matches expectaions from tests.

* Cleaned up the code and made it so if I change normalization, which I do in this branch, it wont break existing DBs.

* Some comic parser changes for partial chapter support.

* Added some code for directory service and scanner service along with python code to generate test files (not used yet). Fixed up all the tests.

* Code smells
2021-04-28 16:16:22 -05:00
Joseph Milazzo
d59d60d9ec
Feature/unit tests (#171)
* Removed a duplicate loop that was already done earlier in method.

* Normalize now replaces underscores

* Added more Parser cases, Added test case for SeriesExtension (Name in List), and added MergeNameTest and some TODOs for where tests should go

* Added a test for removal

* Fixed bad merge

Co-authored-by: Andrew Song <asong641@gmail.com>
2021-04-13 10:24:44 -05:00
Joseph Milazzo
ecfb40cb2d Moved some files around, fixed Log file fetching to use zip and work more reliably. Refactored some code in directory service. 2021-02-24 15:58:17 -06:00
Joseph Milazzo
b4ee16d8d1 Code cleanup. Implemented ability to schedule Library Backups. 2021-02-17 08:58:36 -06:00
Joseph Milazzo
a501e50c98 Clean up and fixed a parsing case. 2021-02-10 12:16:29 -06:00
Joseph Milazzo
40154c8d63 Temp stop point. Rewrote the Scanner service to be much cleaner and slightly more efficient. Code is structured so it can easily be multithreaded. 2021-02-09 15:03:02 -06:00
Joseph Milazzo
5c913ba615 Further changes around ScanLibrary. Refactored DirectoryService search pattern to allow for greater re-usability. Fixed a bug where leftover chapters and volumes wouldn't get cleaned up when removed from disk. 2021-02-09 09:22:26 -06:00
Joseph Milazzo
9461b89725 A hefty refactor of the ScanLibrary code. There were significant fallouts due to duplicate entities getting created and SingleOrDefaults failing. 2021-02-08 12:03:52 -06:00
Joseph Milazzo
39fa750d96 Enhanced the parser to handle more cases and implement some negative lookups when being greedy. 2021-02-08 10:53:59 -06:00
Joseph Milazzo
10c8ea34fe Cleanup after feature implementation. 2021-02-04 17:01:37 -06:00
Joseph Milazzo
6621730afb Refactored more archive code into the service and updated documentation now that methods are public. 2021-01-26 10:03:06 -06:00
Joseph Milazzo
6b76c8b211 Refactored archive code into a service so that I can write tests for it. 2021-01-26 09:55:15 -06:00
Joseph Milazzo
c57b77f092 Cleanup and moved a test to proper place 2021-01-25 18:22:27 -06:00
Joseph Milazzo
8683c81361 There is a theme...more regex changes. Moved the logic around parsing and falling back into Parser.Parse() and setup testing for it. 2021-01-24 10:05:53 -06:00
Joseph Milazzo
a315feb569 More Parser tests and more cases! Added ability to parse Editions for Manga (Omnibus, Color, etc). To be stripped from Series if present. Future can be stored on MangaFile. 2021-01-24 08:34:57 -06:00