mirror of
https://github.com/clinton-hall/nzbToMedia.git
synced 2025-08-19 12:59:36 -07:00
More code tweaks for autoProcessMusic and autoProcessMovie relating to checking of release statuses
This commit is contained in:
parent
0e8bc50f14
commit
df6e85467a
2 changed files with 22 additions and 26 deletions
|
@ -152,6 +152,15 @@ class autoProcessMovie:
|
||||||
|
|
||||||
media_id, download_id, release_id, release_status = self.find_release_info(baseURL, download_id, dirName, nzbName)
|
media_id, download_id, release_id, release_status = self.find_release_info(baseURL, download_id, dirName, nzbName)
|
||||||
|
|
||||||
|
if release_status:
|
||||||
|
if release_status != "snatched":
|
||||||
|
logger.warning("%s is marked with a status of %s on CouchPotato, skipping ...", nzbName, release_status)
|
||||||
|
return 0
|
||||||
|
else:
|
||||||
|
if clientAgent != 'manual':
|
||||||
|
logger.error("Could not find a status for %s on CouchPotato, skipping ...", nzbName)
|
||||||
|
return 1
|
||||||
|
|
||||||
process_all_exceptions(nzbName.lower(), dirName)
|
process_all_exceptions(nzbName.lower(), dirName)
|
||||||
nzbName, dirName = convert_to_ascii(nzbName, dirName)
|
nzbName, dirName = convert_to_ascii(nzbName, dirName)
|
||||||
|
|
||||||
|
@ -237,11 +246,7 @@ class autoProcessMovie:
|
||||||
timeout = time.time() + 60 * int(wait_for)
|
timeout = time.time() + 60 * int(wait_for)
|
||||||
while (time.time() < timeout): # only wait 2 (default) minutes, then return.
|
while (time.time() < timeout): # only wait 2 (default) minutes, then return.
|
||||||
current_status = self.get_status(baseURL, media_id, release_id)
|
current_status = self.get_status(baseURL, media_id, release_id)
|
||||||
if current_status is None:
|
if current_status is not None and current_status != release_status: # Something has changed. CPS must have processed this movie.
|
||||||
logger.error("Could not find a current status for %s on CouchPotatoServer", nzbName)
|
|
||||||
return 1
|
|
||||||
|
|
||||||
if current_status != release_status: # Something has changed. CPS must have processed this movie.
|
|
||||||
logger.postprocess("SUCCESS: This release is now marked as status [%s] in CouchPotatoServer", current_status.upper())
|
logger.postprocess("SUCCESS: This release is now marked as status [%s] in CouchPotatoServer", current_status.upper())
|
||||||
return 0 # success
|
return 0 # success
|
||||||
|
|
||||||
|
|
|
@ -9,8 +9,6 @@ from nzbtomedia import logger
|
||||||
|
|
||||||
class autoProcessMusic:
|
class autoProcessMusic:
|
||||||
def get_status(self, baseURL, apikey, dirName):
|
def get_status(self, baseURL, apikey, dirName):
|
||||||
release_status = None
|
|
||||||
|
|
||||||
logger.debug("Attempting to get current status for release:%s", os.path.basename(dirName))
|
logger.debug("Attempting to get current status for release:%s", os.path.basename(dirName))
|
||||||
|
|
||||||
url = baseURL
|
url = baseURL
|
||||||
|
@ -31,11 +29,8 @@ class autoProcessMusic:
|
||||||
result = r.json()
|
result = r.json()
|
||||||
for album in result:
|
for album in result:
|
||||||
if os.path.basename(dirName) == album['FolderName']:
|
if os.path.basename(dirName) == album['FolderName']:
|
||||||
release_status = album["Status"]
|
return album["Status"].lower()
|
||||||
except:
|
except:pass
|
||||||
pass
|
|
||||||
|
|
||||||
return release_status
|
|
||||||
|
|
||||||
def process(self, dirName, nzbName=None, status=0, clientAgent="manual", inputCategory=None):
|
def process(self, dirName, nzbName=None, status=0, clientAgent="manual", inputCategory=None):
|
||||||
if dirName is None:
|
if dirName is None:
|
||||||
|
@ -89,9 +84,13 @@ class autoProcessMusic:
|
||||||
|
|
||||||
release_status = self.get_status(url, apikey, dirName)
|
release_status = self.get_status(url, apikey, dirName)
|
||||||
|
|
||||||
if release_status not in ["Unprocessed", "Snatched"]:
|
if release_status:
|
||||||
logger.error("%s is marked with a status of %s on HeadPhones, skipping ...", nzbName, release_status)
|
if release_status not in ["unprocessed", "snatched"]:
|
||||||
return 0
|
logger.warning("%s is marked with a status of %s on HeadPhones, skipping ...", nzbName, release_status)
|
||||||
|
return 0
|
||||||
|
else:
|
||||||
|
logger.error("Could not find a status for %s on HeadPhones", nzbName)
|
||||||
|
return 1
|
||||||
|
|
||||||
logger.debug("Opening URL: %s", url)
|
logger.debug("Opening URL: %s", url)
|
||||||
|
|
||||||
|
@ -112,21 +111,13 @@ class autoProcessMusic:
|
||||||
logger.postprocess("The download failed. Nothing to process")
|
logger.postprocess("The download failed. Nothing to process")
|
||||||
return 0 # Success (as far as this script is concerned)
|
return 0 # Success (as far as this script is concerned)
|
||||||
|
|
||||||
if release_status is None:
|
|
||||||
logger.error("Could not find a current status for %s on HeadPhones", nzbName)
|
|
||||||
return 1
|
|
||||||
|
|
||||||
# we will now wait 1 minutes for this album to be processed before returning to TorrentToMedia and unpausing.
|
# we will now wait 1 minutes for this album to be processed before returning to TorrentToMedia and unpausing.
|
||||||
timeout = time.time() + 60 * 2
|
timeout = time.time() + 60 * 2
|
||||||
while (time.time() < timeout): # only wait 2 (default) minutes, then return.
|
while (time.time() < timeout): # only wait 2 (default) minutes, then return.
|
||||||
current_status = self.get_status(url, apikey, dirName)
|
current_status = self.get_status(url, apikey, dirName)
|
||||||
if current_status is None:
|
if current_status is not None and current_status != release_status: # Something has changed. CPS must have processed this movie.
|
||||||
logger.error("Could not find a current status for %s on HeadPhones", nzbName)
|
logger.postprocess("SUCCESS: This release is now marked as status [%s] in HeadPhones",current_status)
|
||||||
return 1
|
return 0
|
||||||
|
|
||||||
if current_status != release_status: # Something has changed. CPS must have processed this movie.
|
|
||||||
logger.postprocess("SUCCESS: This release is now marked as status [%s] in HeadPhones",current_status.upper())
|
|
||||||
return 0 # success
|
|
||||||
|
|
||||||
time.sleep(10 * 2)
|
time.sleep(10 * 2)
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue