diff --git a/anyway/parsers/news_flash.py b/anyway/parsers/news_flash.py index a93dafd1..4d2191dd 100644 --- a/anyway/parsers/news_flash.py +++ b/anyway/parsers/news_flash.py @@ -15,7 +15,7 @@ news_flash_classifiers = {"ynet": classify_rss, "twitter": classify_tweets, "walla": classify_rss} -def update_all_in_db(source=None, newsflash_id=None, update_cbs_location_only=False): +def update_all_in_db(source=None, newsflash_id=None, use_existing_coordinates_only=False): """ main function for newsflash updating. @@ -30,13 +30,15 @@ def update_all_in_db(source=None, newsflash_id=None, update_cbs_location_only=Fa newsflash_items = db.get_all_newsflash() for i, newsflash in enumerate(newsflash_items): logging.debug(f"Updating news-flash:{newsflash.id}") - if not update_cbs_location_only: + if not use_existing_coordinates_only: classify = news_flash_classifiers[newsflash.source] newsflash.organization = classify_organization(newsflash.source) newsflash.accident = classify(newsflash.title) if newsflash.accident: extract_geo_features( - db=db, newsflash=newsflash, use_existing_coordinates_only=update_cbs_location_only + db=db, + newsflash=newsflash, + use_existing_coordinates_only=use_existing_coordinates_only, ) if i % 1000 == 0: db.commit() diff --git a/main.py b/main.py index 91c86874..1db1d813 100755 --- a/main.py +++ b/main.py @@ -67,15 +67,15 @@ def update_news_flash(): @update_news_flash.command() @click.option("--source", default="", type=str) @click.option("--news_flash_id", default="", type=str) -@click.option("--update_cbs_location_only", is_flag=True) -def update(source, news_flash_id, update_cbs_location_only): +@click.option("--use_existing_coordinates_only", is_flag=True) +def update(source, news_flash_id, use_existing_coordinates_only): from anyway.parsers import news_flash if not source: source = None if not news_flash_id: news_flash_id = None - return news_flash.update_all_in_db(source, news_flash_id, update_cbs_location_only) + return news_flash.update_all_in_db(source, news_flash_id, use_existing_coordinates_only) @update_news_flash.command()