mirror of
https://github.com/clinton-hall/nzbToMedia.git
synced 2025-08-14 18:47:09 -07:00
added dynamic timeout. #295
This commit is contained in:
parent
4e4bc03234
commit
800bb84c3e
7 changed files with 29 additions and 15 deletions
|
@ -85,9 +85,9 @@ def processEpisode(dirName, nzbName=None, failed=False, clientAgent=None, inputC
|
|||
except (ConfigParser.NoOptionError, ValueError):
|
||||
delay = 0
|
||||
try:
|
||||
wait_for = int(config.get(section, "wait_for"))
|
||||
TimePerGiB = int(config.get(section, "TimePerGiB"))
|
||||
except (ConfigParser.NoOptionError, ValueError):
|
||||
wait_for = 5
|
||||
TimePerGiB = 1 # note, if using Network to transfer on 100Mbit LAN, expect ~ 600 MB/minute.
|
||||
try:
|
||||
SampleIDs = (config.get("Extensions", "SampleIDs")).split(',')
|
||||
except (ConfigParser.NoOptionError, ValueError):
|
||||
|
@ -100,10 +100,7 @@ def processEpisode(dirName, nzbName=None, failed=False, clientAgent=None, inputC
|
|||
process_method = config.get(section, "process_method")
|
||||
except ConfigParser.NoOptionError:
|
||||
process_method = None
|
||||
|
||||
TimeOut = 60 * int(wait_for) # SickBeard needs to complete all moving and renaming before returning the log sequence via url.
|
||||
socket.setdefaulttimeout(int(TimeOut)) #initialize socket timeout.
|
||||
|
||||
|
||||
mediaContainer = (config.get("Extensions", "mediaExtensions")).split(',')
|
||||
minSampleSize = int(config.get("Extensions", "minSampleSize"))
|
||||
|
||||
|
@ -146,6 +143,11 @@ def processEpisode(dirName, nzbName=None, failed=False, clientAgent=None, inputC
|
|||
if watch_dir != "" and (not host in ['localhost', '127.0.0.1'] or nzbName == "Manual Run"):
|
||||
dirName = watch_dir
|
||||
|
||||
dirSize = getDirectorySize(dirName) # get total directory size to calculate needed processing time.
|
||||
TimeOut = 60 * int(TimePerGiB) * dirSize # SickBeard needs to complete all moving and renaming before returning the log sequence via url.
|
||||
TimeOut += 60 # Add an extra minute for over-head/processing/metadata.
|
||||
socket.setdefaulttimeout(int(TimeOut)) #initialize socket timeout.
|
||||
|
||||
# configure SB params to pass
|
||||
params['quiet'] = 1
|
||||
if nzbName is not None:
|
||||
|
|
|
@ -58,6 +58,8 @@ def migrate():
|
|||
option, value = item
|
||||
if option == "category": # change this old format
|
||||
option = "sbCategory"
|
||||
if option == "wait_for": # remove old format
|
||||
continue
|
||||
if option == "failed_fork": # change this old format
|
||||
option = "fork"
|
||||
if value not in ["default", "failed", "failed-torrent", "auto"]:
|
||||
|
@ -305,8 +307,8 @@ def addnzbget():
|
|||
|
||||
|
||||
section = "SickBeard"
|
||||
envKeys = ['CATEGORY', 'HOST', 'PORT', 'USERNAME', 'PASSWORD', 'SSL', 'WEB_ROOT', 'WATCH_DIR', 'FORK', 'DELETE_FAILED', 'DELAY', 'WAIT_FOR', 'PROCESS_METHOD']
|
||||
cfgKeys = ['sbCategory', 'host', 'port', 'username', 'password', 'ssl', 'web_root', 'watch_dir', 'fork', 'delete_failed', 'delay', 'wait_for', 'process_method']
|
||||
envKeys = ['CATEGORY', 'HOST', 'PORT', 'USERNAME', 'PASSWORD', 'SSL', 'WEB_ROOT', 'WATCH_DIR', 'FORK', 'DELETE_FAILED', 'DELAY', 'TIMEPERGIB', 'PROCESS_METHOD']
|
||||
cfgKeys = ['sbCategory', 'host', 'port', 'username', 'password', 'ssl', 'web_root', 'watch_dir', 'fork', 'delete_failed', 'delay', 'TimePerGiB', 'process_method']
|
||||
for index in range(len(envKeys)):
|
||||
key = 'NZBPO_SB' + envKeys[index]
|
||||
if os.environ.has_key(key):
|
||||
|
|
|
@ -13,6 +13,15 @@ import linktastic.linktastic as linktastic
|
|||
|
||||
Logger = logging.getLogger()
|
||||
|
||||
def getDirectorySize(directory):
|
||||
dir_size = 0
|
||||
for (path, dirs, files) in os.walk(directory):
|
||||
for file in files:
|
||||
filename = os.path.join(path, file)
|
||||
dir_size += os.path.getsize(filename)
|
||||
dir_size = dir_size / (1024.0 * 1024.0 * 1024.0) # convert to GB
|
||||
return dir_size
|
||||
|
||||
|
||||
def safeName(name):
|
||||
safename = re.sub(r"[\/\\\:\*\?\"\<\>\|]", "", name) #make this name safe for use in directories for windows etc.
|
||||
|
|
|
@ -31,7 +31,7 @@ password =
|
|||
web_root =
|
||||
ssl = 0
|
||||
delay = 0
|
||||
wait_for = 5
|
||||
TimePerGiB = 1
|
||||
watch_dir =
|
||||
fork = auto
|
||||
delete_failed = 0
|
||||
|
|
|
@ -7,6 +7,7 @@ Allow Headphones to remove torrents and data after processing.
|
|||
Delete torrent if uselink = move
|
||||
Added forceClean for outputDir. Works in file permissions prevent CP/SB from moving files.
|
||||
Ignore .x264 from archive "part" checks.
|
||||
Added dynamic timeout based on directory size.
|
||||
|
||||
Impacts NZBs
|
||||
Fix setting of Mylar config from NZBGet.
|
||||
|
|
|
@ -97,10 +97,10 @@
|
|||
# Set the number of seconds to wait before calling post-process in SickBeard.
|
||||
#sbdelay=0
|
||||
|
||||
# SickBeard wait_for
|
||||
# SickBeard process Time Per GiB
|
||||
#
|
||||
# Set the number of minutes to wait before timing out. If transferring files across drives or network, increase this to longer than the time it takes to copy an episode.
|
||||
#sbwait_for=5
|
||||
# Set the number of minutes to wait, for each GiB of data, before timing out. If transfering files across drives or network, increase this value as needed.
|
||||
#sbTimePerGiB=5
|
||||
|
||||
# SickBeard watch directory.
|
||||
#
|
||||
|
|
|
@ -46,10 +46,10 @@
|
|||
# Set the number of seconds to wait before calling post-process in SickBeard.
|
||||
#sbdelay=0
|
||||
|
||||
# SickBeard wait_for
|
||||
# SickBeard process Time Per GiB
|
||||
#
|
||||
# Set the number of minutes to wait before timing out. If transfering files across drives or network, increase this to longer than the time it takes to copy an episode.
|
||||
#sbwait_for=5
|
||||
# Set the number of minutes to wait, for each GiB of data, before timing out. If transfering files across drives or network, increase this value as needed.
|
||||
#sbTimePerGiB=5
|
||||
|
||||
# SickBeard watch directory.
|
||||
#
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue