rigon/photo-gallery

Improve scanning process

rigon opened this issue · 1 comments

rigon commented

The current scanning process is a bit clumsy.

I'm proposing a 3 tier scans. This will require an additional flag in Photo to indicate if a thumbnail was or was not generated.

  1. Quick:
    • Look for new albums
    • Cache photos info
  2. Regular (run by default):
    • Same as Quick, plus
    • Create all thumbnails for photos with the flag unset
  3. Full:
    • This will verify if all data is correct, for that we need the following
    • Create a list of all thumbnails files stored
    • Load all albums
    • Scan all files in albums
    • Cache photos info
    • Create missing thumbnails
    • After finish processing an album:
      • Load all DB entries for that album and remove those not in the scanned list
      • Remove entries of exiting photos from the list of all thumbnails
    • In the end, the remaining entries in the list of all thumbnails should be removed
    • Entries in the DB for missing albums should be removed as well

Additionally, consider as well:

  1. Creating a process to allow updating the cache in background. Benefits:
    • During the scan, do not to wait while updating the cache
    • Unify code where in some places is already updating cache in background
  2. Allow suspend scan in the middle
rigon commented

Regular Scan runs by default when the server starts:

  • No flag needed as runs by default
  • To disable all scans, run with --disable-scan

Quick Scan is the same as Regular without creating thumbnails:

  • To disable thumbnails during scans, run with --no-cache-thumbnails

Full Scan:

  • Run with --full-scan
  • The flag --no-cache-thumbnails can be used in conjunction