Add clean_library command

This adds a clean_library command to manage.py that will scan for deleted
files and offer to remove them from the database, and then offer to remove
tracks with no associated files as well as empty albums and empty artists.

Fixes #362.

Signed-off-by: Toke Høiland-Jørgensen <toke@toke.dk>
8 jobs for clean-library in 24 seconds (queued for 2 seconds)
Status Job ID Name Coverage
  Review
manual #9392
funkwhale-review allowed to fail manual
review_docs
manual #9390
funkwhale-review allowed to fail manual
review_front
manual #9393
funkwhale-review allowed to fail manual
stop_docs_review
manual #9391
funkwhale-review allowed to fail manual
stop_front_review
 
  Lint
failed #9394
black

00:00:20

passed #9395
flake8

00:00:22

 
  Test
skipped #9396
docker
test_api
skipped #9397
docker
test_front
 
Name Stage Failure
failed
black Lint
-            num_albums=Count('albums')).filter(num_tracks=0,
- num_albums=0)
+ num_tracks=Count("tracks"), num_albums=Count("albums")
+ ).filter(num_tracks=0, num_albums=0)

would reformat api/funkwhale_api/providers/audiofile/management/commands/clean_library.py
All done! 💥 💔 💥
1 file would be reformatted, 283 files would be left unchanged.
ERROR: Job failed: exit code 1