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

check if locator is http-link


Signed-off-by: Sebastian Schüpbach's avatarSebastian Schüpbach <sebastian.schuepbach@unibas.ch>
parent 081e1578
......@@ -155,8 +155,8 @@ def _get_values_from_digital_object(msg, access_status):
def _is_remote_file(msg):
return 'locator' in msg and msg['locator'].startswith('http') \
and not msg['locator'].startswith('https://memobase.ch/')
return 'locator' in msg and not \
msg['locator'].startswith('https://memobase.ch/')
def _is_directly_fetchable(digital_object_resource):
......@@ -224,6 +224,10 @@ def _has_audio_snippet(record):
record['uri'].startswith('file://')
def _has_http_locator(digital_object):
'locator' in digital_object and digital_object['locator'].startswith('http')
def _create_audio_snippet_entry(record, mariadb_cursor):
snippet_record = record.copy()
snippet_record['sig'] = snippet_record['sig'] + '-intro'
......@@ -286,7 +290,8 @@ class MediametadataToDB:
if access_status == 'public' or access_status == 'closed':
for recordJsonData in records_json_data:
if 'type' in recordJsonData and \
recordJsonData['type'] == 'digitalObject':
recordJsonData['type'] == 'digitalObject' and \
_has_http_locator(recordJsonData):
_try_fetch_from_json_object(recordJsonData, record_values_for_db,
_get_values_from_digital_object,
access_status)
......
......@@ -66,9 +66,9 @@ class Test(TestCase):
res = {
'sig': 'BAB-PA_43-BAB_MC169A-1',
'access': 'public',
'proto': 'file',
'proto': 'redirect',
'type': 'audio',
'uri': 'file:///data/BAB-PA_43-BAB_MC169A-1.mp4'
'uri': 'rtmp://intstream.memobase.ch:1935/memobase/mp3:BAB_MC169A.mp3'
}
digital_object = Test._load_file_and_get_res('BAB-PA_43-BAB_MC169A.json',
Test._get_digital_object)
......
Markdown is supported
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