diff --git a/tdarr_inform.py b/tdarr_inform.py index d21334e..9d8383d 100644 --- a/tdarr_inform.py +++ b/tdarr_inform.py @@ -64,15 +64,15 @@ def do_file_search(arr_file_path): return None if not len(response_json): return None - DBids = [] DBids = [x["DB"] for x in response_json if "DB" in list(x.keys())] DBids = list(set(DBids)) - print(DBids) - DBid = DBids[0] - return DBid + if len(DBids) > 1: + return None + return DBids[0] def do_reverse_recursive_directory_search(arr_file_path): + DBid = None arr_dir_path = os.path.dirname(arr_file_path) print(arr_dir_path) while arr_dir_path != "/": @@ -80,10 +80,9 @@ 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) - - return None + break + print(DBid) + return DBid def main(): @@ -125,7 +124,7 @@ def main(): # loggit("%s Environment variable was missing." % arr_file_path_key, True) # sys.exit(1) # arr_file_path = os.environ[arr_file_path_key] - arr_file_path = "/Drivepool/Media/TV/Cartoons/Ben 10 (2016)/Season 2/Ben 10 (2016) - S02E31 - Chicken Nuggets of Wisdom.mkv" + arr_file_path = "/Drivepool/Media/TV/fCartoons/Ben 10 (2016)/Season 2/Ben 10 (2016) - S02E31 - Chicken Nuggets of Wisdom.mkv" loggit("Event Item: %s\n" % arr_file_path) # loggit("Preparing payload to POST to tdarr API\n")