diff --git a/main.py b/main.py index f92a9c4..5680d55 100644 --- a/main.py +++ b/main.py @@ -2,6 +2,7 @@ import feedparser import json from markdownify import markdownify import re +import sys import time @@ -28,7 +29,14 @@ def split_notes(text: str, limit: int) -> list[str]: if __name__ == "__main__": - config_file = open("./config.json", "r") + if len(sys.argv) < 3: + print("Usage:", sys.argv[0], " ") + exit(1) + + account = sys.argv[1] + config_path = sys.argv[2] + + config_file = open(config_path, "r") config = json.load(config_file) config_file.close() @@ -55,6 +63,6 @@ if __name__ == "__main__": config[url] = time.mktime(rss.entries[-1].published_parsed) print("Saving config", config) - config_file = open("./config.json", "w") + config_file = open(config_path, "w") json.dump(config, config_file, indent=4) config_file.close()