mirror of
https://github.com/clinton-hall/nzbToMedia.git
synced 2025-08-20 13:23:18 -07:00
add check for server_running with 60s timeout. Fixes #494
This commit is contained in:
parent
50dc6c16f5
commit
b34e0aca32
7 changed files with 66 additions and 32 deletions
|
@ -3,7 +3,7 @@ import time
|
|||
import requests
|
||||
import nzbtomedia
|
||||
|
||||
from nzbtomedia.nzbToMediaUtil import convert_to_ascii, remoteDir, listMediaFiles
|
||||
from nzbtomedia.nzbToMediaUtil import convert_to_ascii, remoteDir, listMediaFiles, server_responding
|
||||
from nzbtomedia.nzbToMediaSceneExceptions import process_all_exceptions
|
||||
from nzbtomedia import logger
|
||||
|
||||
|
@ -58,6 +58,12 @@ class autoProcessMusic:
|
|||
else:
|
||||
protocol = "http://"
|
||||
|
||||
|
||||
url = "%s%s:%s%s/api" % (protocol,host,port,web_root)
|
||||
if not server_responding(url):
|
||||
logger.error("Server did not respond. Exiting", section)
|
||||
return [1, "%s: Failed to post-process - %s did not respond." % (section, section) ]
|
||||
|
||||
if not os.path.isdir(dirName) and os.path.isfile(dirName): # If the input directory is a file, assume single file download and split dir/name.
|
||||
dirName = os.path.split(os.path.normpath(dirName))[0]
|
||||
|
||||
|
@ -80,8 +86,6 @@ class autoProcessMusic:
|
|||
logger.info("Status shown as failed from Downloader, but %s valid video files found. Setting as successful." % (str(good_files)), section)
|
||||
status = 0
|
||||
|
||||
url = "%s%s:%s%s/api" % (protocol,host,port,web_root)
|
||||
|
||||
if status == 0:
|
||||
|
||||
params = {}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue