Incremental loading and filter system for local source
Closes #365 Fixes #397
I implemented my old Tachiyomi PR in Mihon.
New features:
- Local Source manga get Indexed into a database table at app start and are loaded from the db instead of from disk.
- Local Source manga now load in chunks of 20 instead of having to wait for all Manga to load.
- Manga now get loaded with Metadata applied.
- Manga can now be filtered.
Can we have the local source items indexed separately similar to download index and use filesystem observer to detect changes (FileObserver for android).
I don't really understand what you mean by indexed separately. If this about adding new files to LocalSource while the app is running we could achieve that with a FileObserver and adding the new manga to the end of the list, but as far as i can see FileObserver needs to have file access and i don't think this is possible with Scoped Storage.
~~If you mean caching LocalSource manga so we do not have to read the ComicInfo files every time then that would probably not be worth it since the bulk of the loading time comes from the cover files~~ I forgot since it was so long ago but we already use metadata saved in the db to avoid re-scanning when available. The problem with the current implementation is that updates to the ComicInfo file will not get reflected. I also added a lastModified value to SManga if we also implement that value in Manga as lastModifiedLocal for example and push it to the db then we can simply compare the values and only re-scan if they do not match.
Right forgot about SAF. Lemme think about this for a bit.
I now implemented logic, to only re-scan ComicInfo files if the manga directory was modified.
I added support for adding new manga while the app is running