From 097225c942ec5f8dbd28d14eebd6541a883d7286 Mon Sep 17 00:00:00 2001 From: Wendell Jones Date: Fri, 12 Dec 2025 07:37:50 -0500 Subject: [PATCH] Add logging support to JSON download function in update_mongo.py --- json_downloader.py | 4 ++-- update_mongo.py | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/json_downloader.py b/json_downloader.py index b228505..c73e819 100644 --- a/json_downloader.py +++ b/json_downloader.py @@ -5,7 +5,7 @@ import json import requests import time -def download_json_to_file(api_url, outputdir, output_file): +def download_json_to_file(api_url, outputdir, output_file, lprint): """ Downloads JSON data from the given API URL and saves it to the specified file. """ @@ -18,5 +18,5 @@ def download_json_to_file(api_url, outputdir, output_file): #print(f"JSON data saved to {outputdir}{output_file}") time.sleep(.5) # Sleep for 0.5 second to avoid overwhelming the server except Exception as e: - print(f"Failed to download or save JSON: {e}") + lprint.logprint("info", f"Downloadinng {outputdir}{output_file} for series ID: {output_file.replace('.json', '')} failed: {e}") diff --git a/update_mongo.py b/update_mongo.py index e1bd163..e6bebfd 100755 --- a/update_mongo.py +++ b/update_mongo.py @@ -327,7 +327,7 @@ def main() -> int: else: url_template = TVMAZE_URLS["showurl"] seriesid = file.replace('.json', '') - json_downloader.download_json_to_file(url_template.replace("", str(seriesid)), directory, f'{seriesid}.json') + json_downloader.download_json_to_file(url_template.replace("", str(seriesid)), directory, f'{seriesid}.json', lprint)