This commit is contained in:
deathbybandaid 2023-01-06 19:40:06 -05:00
parent b54e043686
commit 8d88c5e113

View File

@ -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,7 +78,7 @@ def do_reverse_recursive_directory_search(arr_file_path):
print(arr_dir_path)
DBid = do_file_search(arr_dir_path)
if DBid:
break
# break
print(DBid)
return None