diff --git a/update_mongo.py b/update_mongo.py index f1bdc4f..3b0e94a 100755 --- a/update_mongo.py +++ b/update_mongo.py @@ -87,6 +87,7 @@ def main() -> int: directories["ALIASDIR"] = os.path.join(ROOTDIR, "cache", "aliases") + os.sep tempdir = os.path.join(ROOTDIR, 'temp') + os.sep updatetable = 'updates.tvupdates' + skip_file = f"{tempdir}skip_ids.txt" # Create directories if missing so later code doesn't fail try: @@ -269,6 +270,11 @@ def main() -> int: directory_list = [] for value in directories.values(): directory_list.append(value) + skip_ids = {} + skipfile = open(skip_file, 'r') + for line in skipfile: + field = line.split(';') + skip_ids[field[0]] = field[1] 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: @@ -295,11 +301,14 @@ def main() -> int: lprint.logprint("info", f"Downloadinng JSON for {len(files_needed)} series IDs.") print(f"Downloadinng JSON for {len(files_needed)} files.") - 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"] + if file.replace('.json', '') in skip_ids and 'castcredits' in skip_ids[file.replace('.json', '')].strip(): + lprint.logprint("info", f"Skipping credits download for series ID {file.replace('.json', '')} as per skip_ids.txt") + continue + else: + url_template = TVMAZE_URLS["creditsurl"] elif 'crew' in directory: url_template = TVMAZE_URLS["crewurl"] elif 'cast' in directory: