From 43e44a7b45fb6f6c35a79d6fee8919fae4d77339 Mon Sep 17 00:00:00 2001 From: CGreweling Date: Wed, 10 Feb 2021 12:19:10 +0100 Subject: [PATCH] Upload button in backup mode This patch implements an upload option for the backup mode. Event processing will halt after recording as usual, but users will now see an option in the user interface to upload a given event to Opencast manually. Co-authored-by: Christian Greweling --- pyca/capture.py | 10 ++++++++-- pyca/db.py | 1 + pyca/ingest.py | 4 ---- ui/Event.vue | 2 +- 4 files changed, 10 insertions(+), 7 deletions(-) diff --git a/pyca/capture.py b/pyca/capture.py index efca0e49..04121d93 100644 --- a/pyca/capture.py +++ b/pyca/capture.py @@ -71,8 +71,14 @@ def start_capture(db, upcoming_event): # Set status # If part files exist, its an partial recording - p = any([glob.glob(f'{f}-part-*') for f in files]) - state = Status.PARTIAL_RECORDING if p else Status.FINISHED_RECORDING + part_files = any([glob.glob(f'{f}-part-*') for f in files]) + if part_files: + state = Status.PARTIAL_RECORDING + elif config('agent', 'backup_mode'): + state = Status.PAUSED_AFTER_RECORDING + else: + state = Status.FINISHED_RECORDING + logger.info("Set %s to %s", event.uid, Status.str(state)) update_event_status(event, state) recording_state(event.uid, 'capture_finished') diff --git a/pyca/db.py b/pyca/db.py index 739fe23b..c15191da 100644 --- a/pyca/db.py +++ b/pyca/db.py @@ -83,6 +83,7 @@ class Status(Constants): FAILED_UPLOADING = 6 FINISHED_UPLOADING = 7 PARTIAL_RECORDING = 8 + PAUSED_AFTER_RECORDING = 9 class ServiceStatus(Constants): diff --git a/pyca/ingest.py b/pyca/ingest.py index 16c54038..2a9dda50 100644 --- a/pyca/ingest.py +++ b/pyca/ingest.py @@ -158,9 +158,5 @@ def control_loop(): def run(): '''Start the capture agent. ''' - # If we are a backup CA, we don't want to actually upload anything. So - # let's just quit here and do not run the ingest service at all. - if config('agent')['backup_mode']: - return control_loop() diff --git a/ui/Event.vue b/ui/Event.vue index 31f92e4a..046b4b65 100644 --- a/ui/Event.vue +++ b/ui/Event.vue @@ -9,7 +9,7 @@