Skip to content

Commit

Permalink
Optionally delete recordings after Upload
Browse files Browse the repository at this point in the history
This patch introduce a new feature of deleting recordings after they were
uploaded successfully. Is is disabled per default.
  • Loading branch information
shaardie authored and lkiesow committed Jul 10, 2020
1 parent cf53935 commit f9c7f40
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 0 deletions.
9 changes: 9 additions & 0 deletions etc/pyca.conf
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,15 @@ command = 'ffmpeg -nostats -re -f lavfi -r 25 -i testsrc -f lavfi -i si
#exit_code = 0


[ingest]

# Delete recordings after they have been successfully uploaded. This does only
# apply to the content of the recording directory, not the metadata.
# Type: boolean
# Default: False
#delete_after_upload = False


[server]

# Base URL of the admin server. This corresponds to the
Expand Down
3 changes: 3 additions & 0 deletions pyca/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,9 @@
sigkill_time = integer(min=-1, default=120)
exit_code = integer(min=0, max=255, default=0)
[ingest]
delete_after_upload = boolean(default=false)
[server]
url = string(default='https://develop.opencast.org')
auth_method = option('basic', 'digest', default='digest')
Expand Down
5 changes: 5 additions & 0 deletions pyca/ingest.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
import logging
import pycurl
import sdnotify
import shutil
import time
import traceback

Expand Down Expand Up @@ -99,6 +100,10 @@ def ingest(event):
# Update status
recording_state(event.uid, 'upload_finished')
update_event_status(event, Status.FINISHED_UPLOADING)
if config('ingest', 'delete_after_upload'):
directory = event.directory()
logger.info("Removing uploaded event directory %s", directory)
shutil.rmtree(directory)
notify.notify('STATUS=Running')
set_service_status_immediate(Service.INGEST, ServiceStatus.IDLE)

Expand Down

0 comments on commit f9c7f40

Please sign in to comment.