Browse Source

Use month of reddisc as beginning if missing

Construct a fictive but sensfull beginning if we cant detect one
Needed since beginning is mandatory

Related Task: [https://fs.golderweb.de/index.php?do=details&task_id=76 FS#76]
develop
Jonathan Golder 8 years ago
parent
commit
ab430e0085
  1. 13
      redfam.py

13
redfam.py

@ -359,6 +359,19 @@ class RedFamParser( RedFam ):
# Extract beginnig and maybe ending
(beginning, ending) = RedFamParser.extract_dates( text, isarchive )
# Missing beginning (Task: FS#76)
# Use first day of month of reddisc
if not beginning:
match = re.search(
jogobot.config["redundances"]["reddiscs_onlyinclude_re"],
page.title() )
if match:
beginning = datetime.strptime(
"01. {month} {year}".format(
month=match.group(1), year=match.group(2)),
"%d. %B %Y" )
# Create the RedFam object
RedFamParser( heading, page, isarchive, beginning, ending )

Loading…
Cancel
Save