add custom wait_for time. Fixes #129

This commit is contained in:
clinton-hall 2013-05-23 14:48:51 +09:30
parent 61d6fe5cb9
commit e9fc2b16f5
3 changed files with 14 additions and 3 deletions

View file

@ -205,6 +205,7 @@ def process(dirName, nzbName=None, status=0, clientAgent = "manual", download_id
delay = float(config.get("CouchPotato", "delay")) delay = float(config.get("CouchPotato", "delay"))
method = config.get("CouchPotato", "method") method = config.get("CouchPotato", "method")
delete_failed = int(config.get("CouchPotato", "delete_failed")) delete_failed = int(config.get("CouchPotato", "delete_failed"))
wait_for = int(config.get("CouchPotato", "wait_for"))
try: try:
ssl = int(config.get("CouchPotato", "ssl")) ssl = int(config.get("CouchPotato", "ssl"))
@ -318,16 +319,17 @@ def process(dirName, nzbName=None, status=0, clientAgent = "manual", download_id
# we will now check to see if CPS has finished renaming before returning to TorrentToMedia and unpausing. # we will now check to see if CPS has finished renaming before returning to TorrentToMedia and unpausing.
start = datetime.datetime.now() # set time for timeout start = datetime.datetime.now() # set time for timeout
while (datetime.datetime.now() - start) < datetime.timedelta(minutes=2): # only wait 2 minutes, then return to TorrentToMedia pause_for = wait_for * 10 # keep this so we only ever have 6 complete loops.
while (datetime.datetime.now() - start) < datetime.timedelta(minutes=wait_for): # only wait 2 (default) minutes, then return.
movie_status, clientAgent, download_id, release_status = get_status(myOpener, baseURL, movie_id, clientAgent, download_id) # get the current status fo this movie. movie_status, clientAgent, download_id, release_status = get_status(myOpener, baseURL, movie_id, clientAgent, download_id) # get the current status fo this movie.
if movie_status != initial_status: # Something has changed. CPS must have processed this movie. if movie_status != initial_status: # Something has changed. CPS must have processed this movie.
Logger.info("SUCCESS: This movie is now marked as status %s in CouchPotatoServer", movie_status) Logger.info("SUCCESS: This movie is now marked as status %s in CouchPotatoServer", movie_status)
return 0 # success return 0 # success
time.sleep(20) # Just stop this looping infinitely and hogging resources for 2 minutes ;) time.sleep(pause_for) # Just stop this looping infinitely and hogging resources for 2 minutes ;)
else: else:
if release_status != initial_release_status and release_status != "none": # Something has changed. CPS must have processed this movie. if release_status != initial_release_status and release_status != "none": # Something has changed. CPS must have processed this movie.
Logger.info("SUCCESS: This release is now marked as status %s in CouchPotatoServer", release_status) Logger.info("SUCCESS: This release is now marked as status %s in CouchPotatoServer", release_status)
return 0 # success return 0 # success
else: # The status hasn't changed. we have waited 2 minutes which is more than enough. uTorrent can resule seeding now. else: # The status hasn't changed. we have waited 2 minutes which is more than enough. uTorrent can resule seeding now.
Logger.warning("The movie does not appear to have changed status after 2 minutes. Please check CouchPotato Logs") Logger.warning("The movie does not appear to have changed status after %s minutes. Please check CouchPotato Logs", wait_for)
return 1 # failure return 1 # failure

View file

@ -16,6 +16,7 @@ web_root =
delay = 65 delay = 65
method = renamer method = renamer
delete_failed = 0 delete_failed = 0
wait_for = 2
[SickBeard] [SickBeard]

View file

@ -1,5 +1,13 @@
Change_LOG / History Change_LOG / History
VX.X
Impacts All
Add option to set the "wait_for" period. This is how long the script waits to see if the movie changes status in CouchPotato.
Impacts Torrents
Fixed Delete_Original option
V8.1 04/05/2013 V8.1 04/05/2013
Impacts All Impacts All