Unverified Commit d107c994 authored by Sebastian Schüpbach's avatar Sebastian Schüpbach
Browse files

change locator key to uri



Signed-off-by: Sebastian Schüpbach's avatarSebastian Schüpbach <sebastian.schuepbach@unibas.ch>
parent c3957e74
Pipeline #15983 passed with stages
in 4 minutes and 29 seconds
......@@ -112,8 +112,8 @@ def _has_audio_snippet(record):
# FIXME: Needs probably improvements as soon as we have
# a reliable technique to distinguish sources of media files
return record['type'] == 'audio' and \
'locator' in record and \
record['locator'].startswith('https://memobase.ch/')
'uri' in record and \
record['uri'].startswith('file://')
def _create_audio_snippet_entry(record, mariadbCursor):
......@@ -122,8 +122,8 @@ def _create_audio_snippet_entry(record, mariadbCursor):
snippet_record['duration'] = \
30.0 if snippet_record['duration'] >= 30.0 else snippet_record['duration']
snippet_record['mimetype'] = 'audio/mpeg'
snippet_record['locator'] = \
'.'.join(snippet_record['locator'].split('.')[0:-1]) + '-intro.mp3'
snippet_record['uri'] = \
'.'.join(snippet_record['uri'].split('.')[0:-1]) + '-intro.mp3'
_create_entities_entry(snippet_record, mariadbCursor)
_create_metadata_entry(snippet_record, mariadbCursor)
......@@ -133,10 +133,7 @@ def _write_values_in_db(mariadbCursor, recordValuesForDB):
for record in recordValuesForDB:
_create_entities_entry(record, mariadbCursor)
_create_metadata_entry(record, mariadbCursor)
logging.warning(record)
if _has_audio_snippet(record):
logging.warning('Creating additional audio snippet entry'
' for resource {}'.format(record['@id']))
_create_audio_snippet_entry(record, mariadbCursor)
except Exception as ex:
status = 'Exception: ' + str(ex)
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment