From 8d88c5e1133a824901ce4b5c9664caac4749dc35 Mon Sep 17 00:00:00 2001 From: deathbybandaid Date: Fri, 6 Jan 2023 19:40:06 -0500 Subject: [PATCH] test --- tdarr_inform.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/tdarr_inform.py b/tdarr_inform.py index 896fcf9..076631d 100644 --- a/tdarr_inform.py +++ b/tdarr_inform.py @@ -59,9 +59,14 @@ def do_file_search(arr_file_path): response = requests.post("%s/api/v2/search-db" % script_settings["tdarr"]["url"], json=payload, headers=headers) loggit("Tdarr response: %s\n" % response) try: - DBid = response.json()[0]["DB"] + response_json = response.json() except Exception: return None + if not len(response_json): + return None + DBids = [x["DB"] for x in response_json if "DB" in list(response_json[x].keys())] + print(DBids) + DBid = DBids[0] return DBid @@ -73,8 +78,8 @@ def do_reverse_recursive_directory_search(arr_file_path): print(arr_dir_path) DBid = do_file_search(arr_dir_path) if DBid: - break - print(DBid) + # break + print(DBid) return None