From 1c520a7f58a4837c30d9a85e30a1476a80eead27 Mon Sep 17 00:00:00 2001 From: agatha Date: Sun, 3 Aug 2025 12:23:15 -0400 Subject: [PATCH] feat: add debug flag to downloader `downloader.py` can now be called with `-d` or `--debug` to output extra information. it currently defaults to false. closes issue #4 --- downloader.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/downloader.py b/downloader.py index 70456bd..70773f1 100644 --- a/downloader.py +++ b/downloader.py @@ -6,6 +6,7 @@ import json import time from urllib.parse import urljoin from datetime import datetime +import argparse class RomhackRaceScraper: def __init__(self): @@ -15,7 +16,7 @@ class RomhackRaceScraper: self.last_request = 0 self.download_history_file = "download_history.json" self.download_history = self.load_download_history() - self.debug = True + self.debug = False # Default to False os.makedirs('patches', exist_ok=True) @@ -237,7 +238,13 @@ class RomhackRaceScraper: print(f"\nDownload session complete. Downloaded {total_downloads} new patches.") def main(): + # Parse command line arguments + parser = argparse.ArgumentParser(description='Romhack Race Scraper') + parser.add_argument('-d', '--debug', action='store_true', help='Enable debug output') + args = parser.parse_args() + scraper = RomhackRaceScraper() + scraper.debug = args.debug # Set debug flag based on command line argument # Check if we have existing downloads if os.path.exists("download_history.json"): @@ -252,4 +259,3 @@ def main(): if __name__ == '__main__': main() -