test
This commit is contained in:
parent
a16731419d
commit
b703e28248
@ -44,6 +44,24 @@ def do_tdarr_inform(dbID, arr_file_path):
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
response = requests.post("%s/api/v2/scan-files" % script_settings["tdarr"]["url"], json=payload, headers=headers)
|
response = requests.post("%s/api/v2/scan-files" % script_settings["tdarr"]["url"], json=payload, headers=headers)
|
||||||
|
loggit("Tdarr response: %s\n" % response)
|
||||||
|
|
||||||
|
|
||||||
|
def do_file_search(arr_file_path):
|
||||||
|
payload = {
|
||||||
|
"data": {
|
||||||
|
"string": arr_file_path,
|
||||||
|
"lessThanGB": 9999,
|
||||||
|
"greaterThanGB": 0
|
||||||
|
}
|
||||||
|
}
|
||||||
|
headers = {"content-type": "application/json"}
|
||||||
|
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"]
|
||||||
|
except Exception:
|
||||||
|
return None
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
@ -86,24 +104,16 @@ def main():
|
|||||||
# sys.exit(1)
|
# sys.exit(1)
|
||||||
# arr_file_path = os.environ[arr_file_path_key]
|
# 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/Cartoons/Ben 10 (2016)/Season 2/Ben 10 (2016) - S02E31 - Chicken Nuggets of Wisdom.mkv"
|
||||||
loggit("Found %s\n" % arr_file_path)
|
loggit("Event Item: %s\n" % arr_file_path)
|
||||||
|
|
||||||
# loggit("Preparing payload to POST to tdarr API\n")
|
# loggit("Preparing payload to POST to tdarr API\n")
|
||||||
|
|
||||||
loggit("Searching tdarr API for item's library ID\n")
|
loggit("Searching tdarr API for item's library ID\n")
|
||||||
|
DBid = do_file_search(arr_file_path)
|
||||||
payload = {
|
if not DBid:
|
||||||
"data": {
|
loggit("No exact match found, searching for library ID from Reverse Recursive Directory matching\n")
|
||||||
"string": arr_file_path,
|
else:
|
||||||
"lessThanGB": 9999,
|
print(DBid)
|
||||||
"greaterThanGB": 0
|
|
||||||
}
|
|
||||||
}
|
|
||||||
headers = {"content-type": "application/json"}
|
|
||||||
response = requests.post("%s/api/v2/search-db" % script_settings["tdarr"]["url"], json=payload, headers=headers)
|
|
||||||
|
|
||||||
loggit("Tdarr response: %s\n" % response)
|
|
||||||
print(response.json()[0]["DB"])
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user