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
This commit is contained in:
agatha 2025-08-03 12:23:15 -04:00
parent 2110281a20
commit 1c520a7f58

View File

@ -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()