Skip to content

Commit f9c7f40

Browse files
shaardielkiesow
authored andcommitted
Optionally delete recordings after Upload
This patch introduce a new feature of deleting recordings after they were uploaded successfully. Is is disabled per default.
1 parent cf53935 commit f9c7f40

File tree

3 files changed

+17
-0
lines changed

3 files changed

+17
-0
lines changed

etc/pyca.conf

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,15 @@ command = 'ffmpeg -nostats -re -f lavfi -r 25 -i testsrc -f lavfi -i si
134134
#exit_code = 0
135135

136136

137+
[ingest]
138+
139+
# Delete recordings after they have been successfully uploaded. This does only
140+
# apply to the content of the recording directory, not the metadata.
141+
# Type: boolean
142+
# Default: False
143+
#delete_after_upload = False
144+
145+
137146
[server]
138147

139148
# Base URL of the admin server. This corresponds to the

pyca/config.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,9 @@
3434
sigkill_time = integer(min=-1, default=120)
3535
exit_code = integer(min=0, max=255, default=0)
3636
37+
[ingest]
38+
delete_after_upload = boolean(default=false)
39+
3740
[server]
3841
url = string(default='https://develop.opencast.org')
3942
auth_method = option('basic', 'digest', default='digest')

pyca/ingest.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
import logging
1717
import pycurl
1818
import sdnotify
19+
import shutil
1920
import time
2021
import traceback
2122

@@ -99,6 +100,10 @@ def ingest(event):
99100
# Update status
100101
recording_state(event.uid, 'upload_finished')
101102
update_event_status(event, Status.FINISHED_UPLOADING)
103+
if config('ingest', 'delete_after_upload'):
104+
directory = event.directory()
105+
logger.info("Removing uploaded event directory %s", directory)
106+
shutil.rmtree(directory)
102107
notify.notify('STATUS=Running')
103108
set_service_status_immediate(Service.INGEST, ServiceStatus.IDLE)
104109

0 commit comments

Comments
 (0)