mirror of
https://github.com/clinton-hall/nzbToMedia.git
synced 2025-08-19 12:59:36 -07:00
Added in NzbDrone support!
This commit is contained in:
parent
7c8643d92f
commit
6cc0d38483
3 changed files with 22 additions and 5 deletions
|
@ -47,6 +47,7 @@
|
||||||
#### ndCategory - category that gets called for post-processing with NzbDrone
|
#### ndCategory - category that gets called for post-processing with NzbDrone
|
||||||
[[tv]]
|
[[tv]]
|
||||||
enabled = 0
|
enabled = 0
|
||||||
|
apikey =
|
||||||
host = localhost
|
host = localhost
|
||||||
port = 8989
|
port = 8989
|
||||||
username =
|
username =
|
||||||
|
|
|
@ -230,7 +230,7 @@ else:
|
||||||
result = 0
|
result = 0
|
||||||
|
|
||||||
# init sub-sections
|
# init sub-sections
|
||||||
subsections = config.get_subsections(["SickBeard", "NzbDrone"])
|
subsections = config.get_subsections(["SickBeard"])
|
||||||
|
|
||||||
Logger.warn("MAIN: Invalid number of arguments received from client.")
|
Logger.warn("MAIN: Invalid number of arguments received from client.")
|
||||||
for section, subsection in subsections.items():
|
for section, subsection in subsections.items():
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
import copy
|
import copy
|
||||||
|
import json
|
||||||
import logging
|
import logging
|
||||||
import os
|
import os
|
||||||
import socket
|
import socket
|
||||||
|
@ -47,6 +48,11 @@ class autoProcessTV:
|
||||||
username = config()[section][inputCategory]["username"]
|
username = config()[section][inputCategory]["username"]
|
||||||
password = config()[section][inputCategory]["password"]
|
password = config()[section][inputCategory]["password"]
|
||||||
|
|
||||||
|
try:
|
||||||
|
apikey = config()[section][inputCategory]["apikey"]
|
||||||
|
except:
|
||||||
|
apikey = ""
|
||||||
|
|
||||||
try:
|
try:
|
||||||
ssl = int(config()[section][inputCategory]["ssl"])
|
ssl = int(config()[section][inputCategory]["ssl"])
|
||||||
except:
|
except:
|
||||||
|
@ -162,7 +168,7 @@ class autoProcessTV:
|
||||||
[fork_params.pop(k) for k,v in fork_params.items() if v is None]
|
[fork_params.pop(k) for k,v in fork_params.items() if v is None]
|
||||||
|
|
||||||
if status == 0:
|
if status == 0:
|
||||||
Logger.info("The download succeeded. Sending process request to SickBeard's %s branch", fork)
|
Logger.info("The download succeeded. Sending process request to %s", section)
|
||||||
elif fork in config.SICKBEARD_FAILED:
|
elif fork in config.SICKBEARD_FAILED:
|
||||||
Logger.info("The download failed. Sending 'failed' process request to SickBeard's %s branch", fork)
|
Logger.info("The download failed. Sending 'failed' process request to SickBeard's %s branch", fork)
|
||||||
else:
|
else:
|
||||||
|
@ -184,17 +190,27 @@ class autoProcessTV:
|
||||||
else:
|
else:
|
||||||
protocol = "http://"
|
protocol = "http://"
|
||||||
|
|
||||||
url = protocol + host + ":" + port + web_root + "/home/postprocess/processEpisode?" + urllib.urlencode(fork_params)
|
|
||||||
|
url = None
|
||||||
|
if section == "SickBeard":
|
||||||
|
url = protocol + host + ":" + port + web_root + "/home/postprocess/processEpisode?" + urllib.urlencode(fork_params)
|
||||||
|
elif section == "NzbDrone":
|
||||||
|
url = protocol + host + ":" + port + web_root + "/api/command"
|
||||||
|
|
||||||
if clientAgent == "manual":delay = 0
|
if clientAgent == "manual":delay = 0
|
||||||
Logger.info("Waiting for %s seconds to allow SB to process newly extracted files", str(delay))
|
Logger.info("Waiting for %s seconds to allow %s to process newly extracted files", str(delay), section)
|
||||||
|
|
||||||
time.sleep(delay)
|
time.sleep(delay)
|
||||||
|
|
||||||
Logger.debug("Opening URL: %s", url)
|
Logger.debug("Opening URL: %s", url)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
r = requests.get(url, auth=(username, password), stream=True)
|
if section == "SickBeard":
|
||||||
|
r = requests.get(url, auth=(username, password), stream=True)
|
||||||
|
elif section == "NzbDrone":
|
||||||
|
data = json.dumps({"name": "DownloadedEpisodesScan", "path": dirName})
|
||||||
|
headers = {"X-Api-Key": apikey}
|
||||||
|
r = requests.get(url, data=data, headers=headers, stream=True)
|
||||||
except requests.ConnectionError:
|
except requests.ConnectionError:
|
||||||
Logger.exception("Unable to open URL")
|
Logger.exception("Unable to open URL")
|
||||||
return 1 # failure
|
return 1 # failure
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue