29 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
6ba00477e7
Cover Image - First and tests (#170)
* Changed how natural sort works to cover more cases

* Changed the name of CoverImage regex for Parser and added more cases.

* Changed how we get result from Task.Run()

* Defer execution of a loop till we really need it and added another TODO for later this iteration.

* Big refactor to cover image code to unify between IOCompression and SharpCompress. Both use methods to find the correct file. This results in one extra loop through entries, but simplifies code signficantly.

In addition, new unit tests for the methods that actually do the logic on choosing cover file and first file.

* Removed dead code

* Added missing doc
2021-04-11 18:15:12 -05:00
Joseph Milazzo
b3ec8e8756
Bugfixes! (#157)
* More cases for parsing regex

* Fixed a bug where chapter cover images weren't being updated due to a missed not.

* Removed a piece of code that was needed for upgrading, since all beta users agreed to wipe db.

* Fixed InProgress to properly respect order and show more recent activity first. Issue is with IEntityDate LastModified not updating in DataContext.

* Updated dependencies to lastest stable.

* LastModified on Volumes wasn't updating, validated it does update when data is changed.

* Fixed #152 - Sorting issue when finding cover image.

* Fixed #151 - Sort files during scan.

* Fixed #161 - Remove files that don't exist from chapters during scan.

* Fixed #155 - Ignore images that start with !, expand cover detection by checking for the word cover as well as folder, and some code cleanup to make code more concise.

* Fixed #153 - Ensure that we persist series name changes and don't override on scanning.

* Fixed a broken unit test
2021-04-06 08:59:44 -05:00
Joseph Milazzo
d3c14863d6
Performance, Scan Loop, Specials, and cleanup (#150)
* More cases for parsing regex

* Fixed a bug where chapter cover images weren't being updated due to a missed not.

* Removed a piece of code that was needed for upgrading, since all beta users agreed to wipe db.

* Fixed InProgress to properly respect order and show more recent activity first. Issue is with IEntityDate LastModified not updating in DataContext.

* Updated dependencies to lastest stable.

* LastModified on Volumes wasn't updating, validated it does update when data is changed.

* Rewrote a check to avoid a small heap object warning.

* Ensure UpdateSeries checks all libraries for unique name.

* Took care of some todos, removed unused imports, on dev go ahead and schedule reoocuring jobs since LiteDB caused the locking issue.

* No Tracking when we aren't using entities.

* Added code to remove abandoned progress rows after a chapter gets deleted.

* RefreshMetadata uses one large query rather than many trips to DB for updating metadata. Significantly faster.

* Fixed a bug where UpdateSeries would always complain about a unique name even when we weren't updating name.

* Files that are linked to a series but can't parse out Vol/Chapter information are properly grouped like other Specials.

* Refresh metadata on UI should call the task directly

* Fixed a bug on updating series to make sure we don't complain if we aren't trying to update the name to an existing name.

* Fixed #142 - Library cards should be sorted.

* Refactored the name of some variables to be more agnostic to comics.

* Implemented ScanLibrary but abandoning it.

* Code Cleanup & removing ScanSeries code.

* Some more tests and new Comparators for natural sorting.

* Fixed #137 - When performing I/O on archives, ignore __MACOSX folders completely.

* Fixed #137 - When performing I/O on archives, ignore __MACOSX folders completely.

* All entities that will show under specials tab should be marked special, rather than just what has a special keyword.

* Don't let specials generate cover images

* Don't let specials generate cover images

* SearchResults should send LocalizedName back since we are searching against it.

* Added some tests around macosx folders found from my actual server.

* Put extra notes about a case where duplicates come about, logger will now tell user about this issue.

* Missed a build issue somehow...

* Some code smells
2021-04-05 08:37:45 -05:00
Joseph Milazzo
c639b8ca04 Implemented the LastWrite check for Summaries and Series Cover Images. Removed a TODO after validation. 2021-03-24 07:41:52 -05:00
Joseph Milazzo
a176034905 Some smells found in scan. 2021-03-23 15:04:22 -05:00
Joseph Milazzo
70cc163cb0 More cleanup 2021-03-23 14:41:14 -05:00
Joseph Milazzo
6ebf5d6254 Cleanup and tests fixup 2021-03-23 14:37:47 -05:00
Joseph Milazzo
154b30c3fd Implemented fallback functionality. Try to use System.IO.Compression.ZipArchive then fallback to SharpCompress (which is extremely slow).
Currently this hits disk 3 times per operation, needs performance tuning.
2021-03-23 14:12:28 -05:00
Joseph Milazzo
067b5174ab Cleaned up tests and began implementation of fallback functionality 2021-03-23 12:59:40 -05:00
Joseph Milazzo
d724a8f178 A lot of random changes to try and speed up SharpCompress. 2021-03-23 12:22:50 -05:00
Joseph Milazzo
d73bd22db2 Some code cleanup 2021-03-23 12:22:47 -05:00
Joseph Milazzo
585e965a85 Fixed some bad test cases that really messed up my codebase. 2021-03-23 12:21:09 -05:00
Joseph Milazzo
d543511131 Finished refactoring to SharpCompress. 2021-03-23 12:20:27 -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
bbb4240e20 Implemented download log files (not in service). Refactored backupservice to handle log file splitting. Improved a few interfaces and added some unit tests around them. 2021-02-24 11:59:16 -06:00
Joseph Milazzo
cdd44340a2 Implemented update series 2021-02-18 14:07:36 -06:00
Joseph Milazzo
265f7dcc8c Implemented ability to generate Series summary from ComicInfo.xml (if present) 2021-02-17 16:41:42 -06:00
Joseph Milazzo
922c0153d3 Added series progress/rating information back in. Left attempts at doing via a JOIN or raw SQL. 2021-02-17 15:28:57 -06:00
Joseph Milazzo
b4ee16d8d1 Code cleanup. Implemented ability to schedule Library Backups. 2021-02-17 08:58:36 -06:00
Joseph Milazzo
aaedb11836 Scanner Service is working perfectly and optimized to the baseline. Next step is to multithread the series generation. 2021-02-10 11:31:27 -06:00
Joseph Milazzo
d8d01ffaf6 More refactoring around ScannerService. Moved metadata into its own service. Focusing on cleaning up ScanLibrary code to work 100%. 2021-02-08 16:44:18 -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
1050fa4e54 Ability to update settings. Take effect on next reboot. 2021-02-04 16:49:48 -06:00
Joseph Milazzo
53e85317f9 Refactored DB to be Series->Volumes->Chapters instead. All functionality that previously worked still works. Cleanup still needed. 2021-02-01 09:29:11 -06:00
Joseph Milazzo
1d61d1057e Refactored and cleaned up GetCoverImage code. 2021-01-26 10:45:44 -06:00
Joseph Milazzo
ec64bf90c0 Moved the test data around so more tests can use it properly. Added a IsValidArchive that is re-usable for all archive methods. 2021-01-26 10:32:07 -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