Browse Source

Remove timezone from timestamp patterns since it is not stored and causes errors on labs

develop
Jonathan Golder 7 years ago
parent
commit
ad100e96eb
  1. 10
      red_fam.py

10
red_fam.py

@ -60,13 +60,13 @@ class RED_FAM_PARSER( RED_FAM ):
"""
# Define the timestamp format
__timestamp_format = "%H:%M, %d. %b. %Y (%Z)"
__timestamp_format = "%H:%M, %d. %b. %Y"
# Define section heading re.pattern
__sectionhead_pat = re.compile( r"^(=+)(.*\[\[.+\]\].*\[\[.+\]\].*)\1" )
# Define timestamp re.pattern
__timestamp_pat = re.compile( r"(\d{2}:\d{2}), (\d{1,2}). (Jan|Feb|Mär|Apr|Mai|Jun|Jul|Aug|Sep|Okt|Nov|Dez).? (\d{4}) (\(CES?T\))" )
__timestamp_pat = re.compile( r"(\d{2}:\d{2}), (\d{1,2}). (Jan|Feb|Mär|Apr|Mai|Jun|Jul|Aug|Sep|Okt|Nov|Dez).? (\d{4})" )
# Textpattern for recognisation of done-notices
__done_notice = ":<small>Archivierung dieses Abschnittes wurde gewünscht von:"
@ -265,7 +265,7 @@ class RED_FAM_PARSER( RED_FAM ):
match = cls.__timestamp_pat.search( line )
if match:
# Since some timestamps are broken we need to reconstruct them by regex match groups
result = match.group(1) + ", " + match.group(2) + ". " + match.group(3) + ". " + match.group(4) + " " + match.group(5)
result = match.group(1) + ", " + match.group(2) + ". " + match.group(3) + ". " + match.group(4)
return result
else:
return None
@ -282,7 +282,7 @@ class RED_FAM_PARSER( RED_FAM ):
match = cls.__timestamp_pat.search( line )
if match:
# Since some timestamps are broken we need to reconstruct them by regex match groups
result = match.group(1) + ", " + match.group(2) + ". " + match.group(3) + ". " + match.group(4) + " " + match.group(5)
result = match.group(1) + ", " + match.group(2) + ". " + match.group(3) + ". " + match.group(4)
return result
return None
@ -297,7 +297,7 @@ class RED_FAM_PARSER( RED_FAM ):
matches = cls.__timestamp_pat.findall( line )
if matches:
# Since some timestamps are broken we need to reconstruct them by regex match groups
result = matches[-1][0] + ", " + matches[-1][1] + ". " + matches[-1][2] + ". " + matches[-1][3] + " " + matches[-1][4]
result = matches[-1][0] + ", " + matches[-1][1] + ". " + matches[-1][2] + ". " + matches[-1][3]
return result
else:
return None

Loading…
Cancel
Save