Purge uploads older than configurable time to live
Currently audio uploads are stored indefinitely. This fills up the hard-drive without any space limitations in place. It also encourages hosts to use Tank as some sort of "music library" which is not the focus of Tank.
Since all uploads are reflected in the (archived) recordings anyway, these audio sources are still available in another form and in another location.
Proposal
Provide a YAML config property store.audio.max-age-days
and environment variable AUDIO_MAX_AGE_DAYS
, to set the allowed age in days. By default the value should be 30
days. When no value or -1
is set, the functionality is deactivated.
Implement a background job (agent) running daily, checking for files older then the configured age. Delete such files from hard-disk and relevant Tank database references.
Questions and considerations
Media that is part of the default playlist of a show or a schedule.
We can solve this by checking the files against the playlist endpoint with the parameter containsFileIds
.
Media that is uploaded in advance of the scheduled broadcast,
Purge only files of episodes with broadcast dates in the past. Files which are assigned to some episode, which does't have a broadcast date (i.e. timeslot) assigned yet, are not touched.
Media of an episode that is scheduled for repetition.
This case can be ignored, since repetitions are broadcast based on the recording (living in the radio archive). Uploads only need to be available for the first broadcast.