Add workaround to detect ending datetime if there is no done notice

This commit is contained in:
2015-09-11 16:22:19 +02:00
parent 8b7dc5dbf2
commit 99f050acd3
2 changed files with 25 additions and 3 deletions

View File

@@ -65,7 +65,7 @@ class RED_FAM_PARSER( RED_FAM ):
__sectionhead_pat = re.compile( r"^=+.*\[\[.+\]\].*\[\[.+\]\].*=+$" )
# 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} \(CES?T\))" )
# Textpattern for recognisation of done-notices
__done_notice = ":<small>Archivierung dieses Abschnittes wurde gewünscht von:"
@@ -270,6 +270,20 @@ class RED_FAM_PARSER( RED_FAM ):
if result:
return result.group()
return None
@classmethod
def is_ending2( cls, line ):
"""
Returns the last timestamp found in line, otherwise None
@param str line String to search in
@returns str Timestamp, otherwise None
"""
result = cls.__timestamp_pat.findall( line )
if result:
return result[-1][0]
else:
return None
class RED_FAM_WORKER( RED_FAM ):
"""