mirror of
https://github.com/clinton-hall/nzbToMedia.git
synced 2025-07-16 02:02:53 -07:00
change movie json results to media to match recent CouchPotato changes.
This commit is contained in:
parent
0371036177
commit
d427d9df09
1 changed files with 12 additions and 12 deletions
|
@ -53,7 +53,7 @@ def get_movie_info(baseURL, imdbid, download_id):
|
||||||
library = []
|
library = []
|
||||||
offset = int(0)
|
offset = int(0)
|
||||||
while True:
|
while True:
|
||||||
url = baseURL + "movie.list/?status=active" + "&limit_offset=50," + str(offset)
|
url = baseURL + "media.list/?status=active" + "&limit_offset=50," + str(offset)
|
||||||
|
|
||||||
Logger.debug("Opening URL: %s", url)
|
Logger.debug("Opening URL: %s", url)
|
||||||
|
|
||||||
|
@ -81,7 +81,7 @@ def get_movie_info(baseURL, imdbid, download_id):
|
||||||
|
|
||||||
for index in range(len(movieid)):
|
for index in range(len(movieid)):
|
||||||
if not imdbid:
|
if not imdbid:
|
||||||
url = baseURL + "movie.get/?id=" + str(movieid[index])
|
url = baseURL + "media.get/?id=" + str(movieid[index])
|
||||||
Logger.debug("Opening URL: %s", url)
|
Logger.debug("Opening URL: %s", url)
|
||||||
try:
|
try:
|
||||||
urlObj = urllib.urlopen(url)
|
urlObj = urllib.urlopen(url)
|
||||||
|
@ -90,7 +90,7 @@ def get_movie_info(baseURL, imdbid, download_id):
|
||||||
return ""
|
return ""
|
||||||
try:
|
try:
|
||||||
result = json.load(urlObj)
|
result = json.load(urlObj)
|
||||||
releaselist = [item["info"]["download_id"] for item in result["movie"]["releases"] if "download_id" in item["info"] and item["info"]["download_id"].lower() == download_id.lower()]
|
releaselist = [item["info"]["download_id"] for item in result["media"]["releases"] if "download_id" in item["info"] and item["info"]["download_id"].lower() == download_id.lower()]
|
||||||
except:
|
except:
|
||||||
Logger.exception("Unable to parse json data for releases")
|
Logger.exception("Unable to parse json data for releases")
|
||||||
return ""
|
return ""
|
||||||
|
@ -116,7 +116,7 @@ def get_status(baseURL, movie_id, clientAgent, download_id):
|
||||||
|
|
||||||
if not movie_id:
|
if not movie_id:
|
||||||
return "", clientAgent, "none", "none"
|
return "", clientAgent, "none", "none"
|
||||||
url = baseURL + "movie.get/?id=" + str(movie_id)
|
url = baseURL + "media.get/?id=" + str(movie_id)
|
||||||
Logger.debug("Looking for status of movie: %s - with release sent to clientAgent: %s and download_id: %s", movie_id, clientAgent, download_id)
|
Logger.debug("Looking for status of movie: %s - with release sent to clientAgent: %s and download_id: %s", movie_id, clientAgent, download_id)
|
||||||
Logger.debug("Opening URL: %s", url)
|
Logger.debug("Opening URL: %s", url)
|
||||||
|
|
||||||
|
@ -127,7 +127,7 @@ def get_status(baseURL, movie_id, clientAgent, download_id):
|
||||||
return "", clientAgent, "none", "none"
|
return "", clientAgent, "none", "none"
|
||||||
result = json.load(urlObj)
|
result = json.load(urlObj)
|
||||||
try:
|
try:
|
||||||
movie_status = result["movie"]["status"]["identifier"]
|
movie_status = result["media"]["status"]["identifier"]
|
||||||
Logger.debug("This movie is marked as status %s in CouchPotatoServer", movie_status)
|
Logger.debug("This movie is marked as status %s in CouchPotatoServer", movie_status)
|
||||||
except: # index out of range/doesn't exist?
|
except: # index out of range/doesn't exist?
|
||||||
Logger.exception("Could not find a status for this movie")
|
Logger.exception("Could not find a status for this movie")
|
||||||
|
@ -135,8 +135,8 @@ def get_status(baseURL, movie_id, clientAgent, download_id):
|
||||||
try:
|
try:
|
||||||
release_status = "none"
|
release_status = "none"
|
||||||
if download_id != "" and download_id != "none": # we have the download id from the downloader. Let's see if it's valid.
|
if download_id != "" and download_id != "none": # we have the download id from the downloader. Let's see if it's valid.
|
||||||
release_statuslist = [item["status"]["identifier"] for item in result["movie"]["releases"] if "download_id" in item["info"] and item["info"]["download_id"].lower() == download_id.lower()]
|
release_statuslist = [item["status"]["identifier"] for item in result["media"]["releases"] if "download_id" in item["info"] and item["info"]["download_id"].lower() == download_id.lower()]
|
||||||
clientAgentlist = [item["info"]["download_downloader"] for item in result["movie"]["releases"] if "download_id" in item["info"] and item["info"]["download_id"].lower() == download_id.lower()]
|
clientAgentlist = [item["info"]["download_downloader"] for item in result["media"]["releases"] if "download_id" in item["info"] and item["info"]["download_id"].lower() == download_id.lower()]
|
||||||
if len(release_statuslist) == 1: # we have found a release by this id. :)
|
if len(release_statuslist) == 1: # we have found a release by this id. :)
|
||||||
release_status = release_statuslist[0]
|
release_status = release_statuslist[0]
|
||||||
clientAgent = clientAgentlist[0]
|
clientAgent = clientAgentlist[0]
|
||||||
|
@ -146,7 +146,7 @@ def get_status(baseURL, movie_id, clientAgent, download_id):
|
||||||
clients = [item for item in clientAgentlist if item.lower() == clientAgent.lower()]
|
clients = [item for item in clientAgentlist if item.lower() == clientAgent.lower()]
|
||||||
clientAgent = clients[0]
|
clientAgent = clients[0]
|
||||||
if len(clients) == 1: # ok.. a unique entry for download_id and clientAgent ;)
|
if len(clients) == 1: # ok.. a unique entry for download_id and clientAgent ;)
|
||||||
release_status = [item["status"]["identifier"] for item in result["movie"]["releases"] if "download_id" in item["info"] and item["info"]["download_id"].lower() == download_id.lower() and item["info"]["download_downloader"] == clientAgent][0]
|
release_status = [item["status"]["identifier"] for item in result["media"]["releases"] if "download_id" in item["info"] and item["info"]["download_id"].lower() == download_id.lower() and item["info"]["download_downloader"] == clientAgent][0]
|
||||||
Logger.debug("Found a single release for download_id: %s and clientAgent: %s. Release status is: %s", download_id, clientAgent, release_status)
|
Logger.debug("Found a single release for download_id: %s and clientAgent: %s. Release status is: %s", download_id, clientAgent, release_status)
|
||||||
else: # doesn't matter. only really used as secondary confirmation of movie status change. Let's continue.
|
else: # doesn't matter. only really used as secondary confirmation of movie status change. Let's continue.
|
||||||
Logger.debug("Found several releases for download_id: %s and clientAgent: %s. Cannot determine the release status", download_id, clientAgent)
|
Logger.debug("Found several releases for download_id: %s and clientAgent: %s. Cannot determine the release status", download_id, clientAgent)
|
||||||
|
@ -156,8 +156,8 @@ def get_status(baseURL, movie_id, clientAgent, download_id):
|
||||||
if download_id == "none": # if we couldn't find this initially, there is no need to check next time around.
|
if download_id == "none": # if we couldn't find this initially, there is no need to check next time around.
|
||||||
return movie_status, clientAgent, download_id, release_status
|
return movie_status, clientAgent, download_id, release_status
|
||||||
elif download_id == "": # in case we didn't get this from the downloader.
|
elif download_id == "": # in case we didn't get this from the downloader.
|
||||||
download_idlist = [item["info"]["download_id"] for item in result["movie"]["releases"] if item["status"]["identifier"] == "snatched"]
|
download_idlist = [item["info"]["download_id"] for item in result["media"]["releases"] if item["status"]["identifier"] == "snatched"]
|
||||||
clientAgentlist = [item["info"]["download_downloader"] for item in result["movie"]["releases"] if item["status"]["identifier"] == "snatched"]
|
clientAgentlist = [item["info"]["download_downloader"] for item in result["media"]["releases"] if item["status"]["identifier"] == "snatched"]
|
||||||
if len(clientAgentlist) == 1:
|
if len(clientAgentlist) == 1:
|
||||||
if clientAgent == "manual":
|
if clientAgent == "manual":
|
||||||
clientAgent = clientAgentlist[0]
|
clientAgent = clientAgentlist[0]
|
||||||
|
@ -268,7 +268,7 @@ def process(dirName, nzbName=None, status=0, clientAgent = "manual", download_id
|
||||||
if remoteCPS == 1:
|
if remoteCPS == 1:
|
||||||
command = command + "/?downloader=" + clientAgent + "&download_id=" + download_id
|
command = command + "/?downloader=" + clientAgent + "&download_id=" + download_id
|
||||||
else:
|
else:
|
||||||
command = command + "/?movie_folder=" + dirName + "&downloader=" + clientAgent + "&download_id=" + download_id
|
command = command + "/?media_folder=" + dirName + "&downloader=" + clientAgent + "&download_id=" + download_id
|
||||||
|
|
||||||
url = baseURL + command
|
url = baseURL + command
|
||||||
|
|
||||||
|
@ -302,7 +302,7 @@ def process(dirName, nzbName=None, status=0, clientAgent = "manual", download_id
|
||||||
Logger.error("Exiting autoProcessMovie script")
|
Logger.error("Exiting autoProcessMovie script")
|
||||||
return 1 # failure
|
return 1 # failure
|
||||||
|
|
||||||
url = baseURL + "movie.searcher.try_next/?id=" + movie_id
|
url = baseURL + "media.searcher.try_next/?id=" + movie_id
|
||||||
|
|
||||||
Logger.debug("Opening URL: %s", url)
|
Logger.debug("Opening URL: %s", url)
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue