mirror of
https://github.com/davegallant/rfd-notify.git
synced 2025-08-06 08:43:39 +00:00
Migrate to python (#265)
* Add initial python migration * Add pylint * Add pre-commit * Add Dockerfile * Add expression matching * Use shelve to store previous matches * Add notifications * Calculate post age * Update README.md
This commit is contained in:
40
rfd_notify/cli.py
Normal file
40
rfd_notify/cli.py
Normal file
@@ -0,0 +1,40 @@
|
||||
import argparse
|
||||
import os
|
||||
|
||||
from config import load_yaml_file
|
||||
from rfd import get_topics, look_for_matches
|
||||
from loguru import logger
|
||||
|
||||
|
||||
def main() -> None:
|
||||
parser = argparse.ArgumentParser(description="Process some configuration.")
|
||||
|
||||
parser.add_argument(
|
||||
"-c", "--config", type=str, required=True, help="path to configuration file"
|
||||
)
|
||||
|
||||
parser.add_argument(
|
||||
"-s",
|
||||
"--storage-path",
|
||||
type=str,
|
||||
required=False,
|
||||
default="previous_matches",
|
||||
help="path to persistent storage",
|
||||
)
|
||||
|
||||
args = parser.parse_args()
|
||||
|
||||
config_path = args.config
|
||||
|
||||
apprise_url = os.getenv("APPRISE_URL")
|
||||
|
||||
config = load_yaml_file(config_path)
|
||||
|
||||
topics = get_topics(forum_id=9, pages=2)
|
||||
|
||||
logger.debug(f"config: {config}")
|
||||
|
||||
look_for_matches(topics, config, args.storage_path, apprise_url)
|
||||
|
||||
|
||||
main()
|
Reference in New Issue
Block a user