Latency Checker and Download Adjuster
Posted: February 6th, 2013, 12:15 pm
I was wondering if it would be possible to implement a latency checker under sabnzb which according to the ping time response from the preferred location, regulates step by step (every minute) from maximal download speed to the minimum selected download speed in X kB/s (10KB/s per step).
Maybe looking something like this:

Here a physon script for checking ping time.
Works with fping, tried it under Linux. If no ping time could be measured, a big value is returned. Usage: print get_ping_time('<ip>:<port>').
Source: http://stackoverflow.com/questions/2525 ... ver-python
Thank you for your consideration,
greetings,
slugshell
Maybe looking something like this:

Here a physon script for checking ping time.
Works with fping, tried it under Linux. If no ping time could be measured, a big value is returned. Usage: print get_ping_time('<ip>:<port>').
Code: Select all
import shlex
from subprocess import Popen, PIPE, STDOUT
def get_simple_cmd_output(cmd, stderr=STDOUT):
"""
Execute a simple external command and get its output.
"""
args = shlex.split(cmd)
return Popen(args, stdout=PIPE, stderr=stderr).communicate()[0]
def get_ping_time(host):
host = host.split(':')[0]
cmd = "fping {host} -C 3 -q".format(host=host)
res = [float(x) for x in process.get_simple_cmd_output(cmd).strip().split(':')[-1].split() if x != '-']
if len(res) > 0:
return sum(res) / len(res)
else:
return 999999
Thank you for your consideration,
greetings,
slugshell