Comment out SQL update logic in Dbexec class for verification; adjust sleep duration in JSON downloader to reduce server load; enhance logging in update_mongo.py for clarity on processing updates.
This commit is contained in:
+7
-11
@@ -5,11 +5,7 @@ import time
|
||||
import sys
|
||||
import url.urls
|
||||
import url.process
|
||||
# import api.tvmaze.cast as mazecast
|
||||
# import api.tvmaze.crew as mazecrew
|
||||
# import api.tvmaze.episodes as mazeepisodes
|
||||
# import api.tvmaze.series as mazeseries
|
||||
from pathlib import Path
|
||||
from tqdm import tqdm
|
||||
import db.sql
|
||||
import jprocessor.process
|
||||
import logs.Logger
|
||||
@@ -288,6 +284,7 @@ def main() -> int:
|
||||
directory_list = []
|
||||
for value in directories.values():
|
||||
directory_list.append(value)
|
||||
print(f"Processing {len(downloaded_updates_dict)} downloaded updates against {len(previous_listing_dict)} previous listings for files needed.")
|
||||
for seriesid, ts in downloaded_updates_dict.items():
|
||||
if seriesid in previous_listing_dict:
|
||||
prev_ts = previous_listing_dict[seriesid]
|
||||
@@ -315,8 +312,8 @@ def main() -> int:
|
||||
lprint.logprint("info", f"Downloadinng JSON for {len(files_needed)} series IDs.")
|
||||
print(f"Downloadinng JSON for {len(files_needed)} files.")
|
||||
|
||||
try:
|
||||
for directory, filename in files_needed:
|
||||
for i in tqdm(range(len(files_needed)), desc="Downloading JSON files", unit="filename"):
|
||||
for directory, file in files_needed[i:i+1]:
|
||||
if 'credits' in directory:
|
||||
url_template = TVMAZE_URLS["creditsurl"]
|
||||
elif 'crew' in directory:
|
||||
@@ -329,11 +326,10 @@ def main() -> int:
|
||||
url_template = TVMAZE_URLS["aliasurl"]
|
||||
else:
|
||||
url_template = TVMAZE_URLS["showurl"]
|
||||
seriesid = filename.replace('.json', '')
|
||||
seriesid = file.replace('.json', '')
|
||||
json_downloader.download_json_to_file(url_template.replace("<seriesid>", str(seriesid)), directory, f'{seriesid}.json')
|
||||
except Exception as exc:
|
||||
lprint.logprint("error", f"update_cache failed: {exc}")
|
||||
return 1
|
||||
|
||||
|
||||
|
||||
|
||||
# countrylisting = dbExec.rawsql_select(
|
||||
|
||||
Reference in New Issue
Block a user