stumpapp / stump

A free and open source comics, manga and digital book server with OPDS support (WIP)
https://stumpapp.dev
MIT License
863 stars 34 forks source link

✨ Add ability to clean library #199

Closed aaronleopold closed 8 months ago

aaronleopold commented 8 months ago

Relates to https://github.com/stumpapp/stump/issues/195

Cleaning a library does the following:

  1. Delete any media that are not READY, e.g. missing from disk. This should cascade delete things like read progress etc.
  2. Delete any series that are not READY, e.g. missing from disk, or that are empty, i.e. no media left
  3. Return a flag indicating if the library is empty, i.e. no series with media left

This is done within a single transaction, so technically has the potential to timeout if the library cleaning requirement is excessively large (e.g. there are something like 5k+ books that need to be deleted at once along with all the cascading and their series etc). Because of this, it might be good in the future if people hit this to batch.

The media is queried for twice since delete_many returns affected row count and not records themselves:

I also fixed a few UI things, like non-scrolling SideBar on mobile and oddities with the refreshed entity card variants