Skip to content

Commit 3aa3c78

Browse files
committed
update metadata structure
- rename viewfile -> viewfiles - add viewfile (string)
1 parent de9c512 commit 3aa3c78

File tree

1 file changed

+13
-7
lines changed

1 file changed

+13
-7
lines changed

extract/metaextract.py

+13-7
Original file line numberDiff line numberDiff line change
@@ -707,7 +707,12 @@ def start(**kwargs):
707707
'codefiles': [],
708708
'inputfiles': [],
709709
'keywords': [],
710-
'license': 'cc-by', # default
710+
'license': {
711+
'text': 'cc-by', # default
712+
'code': None,
713+
'data': None,
714+
'uibindings': None
715+
},
711716
'access_right': 'open', # default
712717
'paperLanguage': [],
713718
'paperSource': None,
@@ -725,7 +730,8 @@ def start(**kwargs):
725730
'temporal': {'begin': None, 'end': None},
726731
'title': None,
727732
'upload_type': 'publication', # default
728-
'viewfile': [],
733+
'viewfiles': [],
734+
'viewfile': None,
729735
'version': None}
730736
bagit_txt_file = None
731737
global compare_extracted
@@ -786,7 +792,7 @@ def start(**kwargs):
786792
'filepath': get_rel_path(full_file_path),
787793
'rdata_preview': get_rdata(full_file_path)})
788794
elif file_extension == '.html':
789-
MASTER_MD_DICT['viewfile'].append(get_rel_path(full_file_path))
795+
MASTER_MD_DICT['viewfiles'].append(get_rel_path(full_file_path))
790796
else:
791797
parse_spatial(full_file_path, file_extension)
792798
status_note(''.join((str(nr), ' files processed')))
@@ -831,18 +837,18 @@ def start(**kwargs):
831837
if 'publicationDate' in MASTER_MD_DICT:
832838
if MASTER_MD_DICT['publicationDate'] is None:
833839
MASTER_MD_DICT['publicationDate'] = datetime.datetime.today().strftime('%Y-%m-%d')
834-
# \ Add viewfile if mainfile rmd exists
835-
if 'viewfile' in MASTER_MD_DICT:
840+
# \ Add viewfiles if mainfile rmd exists
841+
if 'viewfiles' in MASTER_MD_DICT:
836842
# find main file name without ext
837-
if not MASTER_MD_DICT['viewfile']:
843+
if not MASTER_MD_DICT['viewfiles']:
838844
if 'file' in MASTER_MD_DICT:
839845
if 'filepath' in MASTER_MD_DICT['file']:
840846
if MASTER_MD_DICT['file']['filepath'] is not None:
841847
if MASTER_MD_DICT['file']['filepath'].lower().endswith('.rmd'):
842848
if os.path.isfile(MASTER_MD_DICT['file']['filepath']):
843849
main_file_name, file_extension = os.path.splitext(MASTER_MD_DICT['file']['filepath'])
844850
if os.path.isfile(''.join((main_file_name, '.html'))):
845-
MASTER_MD_DICT['viewfile'].append(''.join((main_file_name, '.html')))
851+
MASTER_MD_DICT['viewfiles'].append(''.join((main_file_name, '.html')))
846852
# \ Fix and complete paperSource element, if existing:
847853
if 'paperSource' in MASTER_MD_DICT:
848854
MASTER_MD_DICT['paperSource'] = guess_paper_source()

0 commit comments

Comments
 (0)