Added a media delete mechanism

This commit is contained in:
Bradley committed 2026-11-17 08:46:31 -05:00
1 parent 6c44950d23
commit a58903d58e
7 files changed
+490 -3

No files matched your search

+30 -1
View File
@@ -96,6 +96,35 @@ extensions or URL schemes; no schema changes are required.
As with uploads, keep this interface on a trusted network until authentication
and broader access controls are implemented.
### Deleting media
Choose **Delete** beneath an item in `/media`. A separate confirmation page names
the item and explains whether its stored file will be deleted or retained.
Nothing is deleted by opening that page; use **Cancel** to go back or **Yes,
delete media** to confirm. If the record or file changed since the prompt, it
must be reviewed and confirmed again. This works without JavaScript.
Confirmed deletion removes the `media` row and its playback options. Local files
inside the configured image, video, and legacy upload folders are removed to
free storage, including files downloaded from YouTube. A file used by another
media row is retained until its last reference is deleted. Streams, missing
files, paths outside managed storage, directories, and symbolic links only lose
their database record; no remote source, outside file, or directory tree is
deleted. YouTube job history remains unchanged.
Deleting active/default media lets the player choose the next active/default
item or black on its next check. An open player process can retain the deleted
file's disk space until it releases that file. Cached thumbnails for the item
are also removed (including the current legacy-format thumbnail, if present).
A local file is temporarily renamed in place before the database transaction
commits. Database errors restore it rather than destroying it. If final file
cleanup fails after commit, the page explicitly reports that storage was not
freed; the server log identifies the retained `.deleting-*` file for an
administrator to remove. A forced shutdown during deletion can also leave a
`.deleting-*` file: check the database before restoring its original filename
(if the record remains) or removing it (if the deletion committed).
## Submission validation
All new image, video, stream, and YouTube submissions require a nonblank media
@@ -262,5 +291,5 @@ WHERE youtube_download_job_id = 123
Run the database and worker tests without downloading any videos:
```sh
python3 -m unittest test.youtube_download_job_test test.youtube_download_web_test test.upload_video_test test.upload_photo_test test.player_test test.media_library_test test.submission_validation_test -v
python3 -m unittest test.youtube_download_job_test test.youtube_download_web_test test.upload_video_test test.upload_photo_test test.player_test test.media_library_test test.submission_validation_test test.media_deletion_test -v
```