From dfe4ed9ad4b889af5ffdb68d45edfc2c43038bd7 Mon Sep 17 00:00:00 2001 From: clinton-hall Date: Mon, 20 Jan 2014 14:23:03 +1030 Subject: [PATCH 1/3] added longer socket timeout for CouchPotato renamer.scan. fixes #242 --- autoProcess/autoProcessMovie.py | 7 +++++-- changelog.txt | 6 ++++++ 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/autoProcess/autoProcessMovie.py b/autoProcess/autoProcessMovie.py index fce9c074..e3b97d93 100644 --- a/autoProcess/autoProcessMovie.py +++ b/autoProcess/autoProcessMovie.py @@ -311,6 +311,8 @@ def process(dirName, nzbName=None, status=0, clientAgent = "manual", download_id url = baseURL + "movie.searcher.try_next/?id=" + movie_id Logger.debug("Opening URL: %s", url) + TimeOut2 = wait_for * 60 # If transfering files across directories, it now appears CouchPotato can take a while to confirm this url request... Try using wait_for timing. + socket.setdefaulttimeout(int(TimeOut2)) #initialize socket timeout. We may now be able to remove the delays from the wait_for section below? try: urlObj = urllib.urlopen(url) @@ -331,12 +333,13 @@ def process(dirName, nzbName=None, status=0, clientAgent = "manual", download_id Logger.exception("Unable to delete folder %s", dirName) return 0 # success - if nzbName == "Manual Run": + if nzbName == "Manual Run" or download_id == "none": return 0 # success # we will now check to see if CPS has finished renaming before returning to TorrentToMedia and unpausing. + socket.setdefaulttimeout(int(TimeOut)) #initialize socket timeout. start = datetime.datetime.now() # set time for timeout - pause_for = wait_for * 10 # keep this so we only ever have 6 complete loops. + pause_for = wait_for * 10 # keep this so we only ever have 6 complete loops. This may not be necessary now? 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(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. diff --git a/changelog.txt b/changelog.txt index e8986590..c44d9678 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,5 +1,11 @@ Change_LOG / History +V9.1 XX/01/2014 + +Impacts All +Don't wait to verify status change in CouchPotato when no initial status (manual run) +Now use "wait_for" timing as socket timeout on the renamer.scan. It appears to now be delayed in confirming success. + V9.0 19/01/2014 Impacts NZBs From a29206d51cc0fe45c548825775185261a4fa536c Mon Sep 17 00:00:00 2001 From: clinton-hall Date: Wed, 22 Jan 2014 09:50:32 +1030 Subject: [PATCH 2/3] move socket timeout before url call for renamer. fixes #242 --- autoProcess/autoProcessMovie.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/autoProcess/autoProcessMovie.py b/autoProcess/autoProcessMovie.py index e3b97d93..7149fd15 100644 --- a/autoProcess/autoProcessMovie.py +++ b/autoProcess/autoProcessMovie.py @@ -258,6 +258,9 @@ def process(dirName, nzbName=None, status=0, clientAgent = "manual", download_id process_all_exceptions(nzbName.lower(), dirName) nzbName, dirName = converto_to_ascii(nzbName, dirName) + TimeOut2 = int(wait_for) * 60 # If transfering files across directories, it now appears CouchPotato can take a while to confirm this url request... Try using wait_for timing. + socket.setdefaulttimeout(int(TimeOut2)) #initialize socket timeout. We may now be able to remove the delays from the wait_for section below? + if status == 0: if transcode == 1: result = Transcoder.Transcode_directory(dirName) @@ -311,8 +314,6 @@ def process(dirName, nzbName=None, status=0, clientAgent = "manual", download_id url = baseURL + "movie.searcher.try_next/?id=" + movie_id Logger.debug("Opening URL: %s", url) - TimeOut2 = wait_for * 60 # If transfering files across directories, it now appears CouchPotato can take a while to confirm this url request... Try using wait_for timing. - socket.setdefaulttimeout(int(TimeOut2)) #initialize socket timeout. We may now be able to remove the delays from the wait_for section below? try: urlObj = urllib.urlopen(url) @@ -338,8 +339,9 @@ 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. socket.setdefaulttimeout(int(TimeOut)) #initialize socket timeout. + start = datetime.datetime.now() # set time for timeout - pause_for = wait_for * 10 # keep this so we only ever have 6 complete loops. This may not be necessary now? + pause_for = int(wait_for) * 10 # keep this so we only ever have 6 complete loops. This may not be necessary now? 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(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. From a0b827afd3c9dfff2257e95b0e756e765e9345cf Mon Sep 17 00:00:00 2001 From: clinton-hall Date: Fri, 24 Jan 2014 16:17:35 +1030 Subject: [PATCH 3/3] ready for merge --- changelog.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/changelog.txt b/changelog.txt index c44d9678..f81a6bf9 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,6 +1,6 @@ Change_LOG / History -V9.1 XX/01/2014 +V9.1 24/01/2014 Impacts All Don't wait to verify status change in CouchPotato when no initial status (manual run)