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)