mirror of
https://github.com/tomasriveral/ReSSPublica.git
synced 2026-08-12 02:38:37 +02:00
feeds: add asian hornet sightings in Bern
This commit is contained in:
+13
-5
@@ -2,19 +2,22 @@ from pathlib import Path
|
||||
import os
|
||||
import argparse
|
||||
import logging
|
||||
|
||||
from .translations import *
|
||||
|
||||
logger = logging.getLogger("resspublica")
|
||||
from datetime import date
|
||||
|
||||
from .utils import *
|
||||
from .federalInitiativesFeeds import *
|
||||
from .translations import *
|
||||
|
||||
from .bernAsianHornet import *
|
||||
|
||||
def main():
|
||||
parser = argparse.ArgumentParser()
|
||||
parser.add_argument("--verbose", action="store_true", help="Enable debug logging")
|
||||
parser.add_argument("--gen_federalInitiatives", action="store_true", help="Generate federal popular initiatives feed")
|
||||
parser.add_argument("--gen_bernAsianHornets", action="store_true", help="Generate Asian hornets sightings in Bern feed (only Mondays)")
|
||||
parser.add_argument("--force_gen_bernAsianHornets", action="store_true", help="Generate Asian hornets sightings in Bern feed even when not Monday")
|
||||
|
||||
|
||||
args = parser.parse_args()
|
||||
|
||||
logging.basicConfig(
|
||||
@@ -24,7 +27,12 @@ def main():
|
||||
|
||||
CACHE = Path(os.environ.get("RESSPUBLICA_CACHE", ".cache"))
|
||||
CACHE.mkdir(parents=True, exist_ok=True)
|
||||
ASSETS = Path(os.environ.get("RESSPUBLICA_ASSETS"))
|
||||
ASSETS.mkdir(parents=True, exist_ok=True)
|
||||
|
||||
logging.info("Starting feed generation")
|
||||
generateFederalFeed(CACHE)
|
||||
if args.gen_federalInitiatives:
|
||||
generateFederalFeed(CACHE)
|
||||
if (date.today().weekday() == 0 and args.gen_bernAsianHornets) or args.force_gen_bernAsianHornets:
|
||||
generateBernAsianHornetFeed(ASSETS, CACHE)
|
||||
logging.info("Done")
|
||||
|
||||
Reference in New Issue
Block a user