Skip to content

Commit

Permalink
Don't Upload Metadata Catalogs
Browse files Browse the repository at this point in the history
This patch makes pyCA not upload metadata catalogs by default since
Opencast holds them internally anyway.
  • Loading branch information
lkiesow committed Oct 7, 2020
1 parent 2e684e5 commit 15288d9
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 11 deletions.
7 changes: 3 additions & 4 deletions etc/pyca.conf
Original file line number Diff line number Diff line change
Expand Up @@ -142,12 +142,11 @@ command = 'ffmpeg -nostats -re -f lavfi -r 25 -i testsrc -f lavfi -i si
# Default: False
#delete_after_upload = False

# Skip ingesting metadata catalogs to Opencast. If you set this option to True,
# Opencast will use the metadata catalogs from the scheduler service and do not
# override these by the uploaded version from pyCA.
# Defines if pyCA will upload dublin core catalogs to Opencast.
# Deprecated: The option will be removed soon.
# Type: boolean
# Default: False
# skip_catalogs = False
#upload_catalogs = False


[server]
Expand Down
2 changes: 1 addition & 1 deletion pyca/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
[ingest]
delete_after_upload = boolean(default=false)
skip_catalogs = boolean(default=false)
upload_catalogs = boolean(default=false)
[server]
url = string(default='https://develop.opencast.org')
Expand Down
14 changes: 8 additions & 6 deletions pyca/ingest.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,19 +68,21 @@ def ingest(event):
if attachment.get('x-apple-filename') == prop:
workflow_def, workflow_config = get_config_params(data)

# Check for dublincore catalogs
elif attachment.get('fmttype') == 'application/xml' and dcns in data:
# dublin core catalogs
elif attachment.get('fmttype') == 'application/xml' \
and dcns in data \
and config('ingest', 'upload_catalogs'):
name = attachment.get('x-apple-filename', '').rsplit('.', 1)[0]
if config('ingest', 'skip_catalogs'):
logger.info(
'Skipping adding catalog %s due to configuration', name)
continue
logger.info('Adding %s DC catalog', name)
fields = [('mediaPackage', mediapackage),
('flavor', 'dublincore/%s' % name),
('dublinCore', data.encode('utf-8'))]
mediapackage = http_request(service_url + '/addDCCatalog', fields)

else:
logger.info('Not uploading %s', attachment.get('x-apple-filename'))
continue

# add track
for (flavor, track) in event.get_tracks():
logger.info('Adding track (%s -> %s)', flavor, track)
Expand Down

0 comments on commit 15288d9

Please sign in to comment.