Commit 2a71eace authored by Administrator's avatar Administrator

[FEAT] All possible forms of Zotero files integrated.

parent 2644e642
...@@ -34,17 +34,19 @@ class FileParser: ...@@ -34,17 +34,19 @@ class FileParser:
""" """
# First, check the split dates... # First, check the split dates...
# This part mainly deal with Zotero data but can be usefull for others
# parts
date_string = hyperdata.get('publication_date_to_parse', None) date_string = hyperdata.get('publication_date_to_parse', None)
if date_string is not None: if date_string is not None:
date_string = re.sub(r'\/\/+', '', date_string) date_string = re.sub(r'\/\/+(\w*|\d*)', '', date_string)
date_string = re.sub(r'undefined', '', date_string) #date_string = re.sub(r'undefined', '', date_string)
try: try:
hyperdata['publication' + "_date"] = dateutil.parser.parse( hyperdata['publication' + "_date"] = dateutil.parser.parse(
date_string, date_string,
default=DEFAULT_DATE default=DEFAULT_DATE
).strftime("%Y-%m-%d %H:%M:%S") ).strftime("%Y-%m-%d %H:%M:%S")
except: except Exception as error:
print('Parser Zotero, Date not parsed for:', date_string) print(error, 'Parser Zotero, Date not parsed for:', date_string)
hyperdata['publication_date'] = datetime.datetime.now().strftime("%Y-%m-%d %H:%M:%S") hyperdata['publication_date'] = datetime.datetime.now().strftime("%Y-%m-%d %H:%M:%S")
......
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