diff options
author | Luke Shumaker <lukeshu@sbcglobal.net> | 2016-04-17 10:58:22 -0400 |
---|---|---|
committer | Luke Shumaker <lukeshu@sbcglobal.net> | 2016-04-17 11:10:57 -0400 |
commit | bf2cb9784fe726b163667aaeab541cf7ae7f21a9 (patch) | |
tree | db3706dad0ccfc5ac4fbd43aa6241a689e8e3e96 /db-pick-mirror | |
parent | 03c3068761682bb1af9c615c91bc30da67fddf06 (diff) |
Give things more consistent names.
Diffstat (limited to 'db-pick-mirror')
-rwxr-xr-x | db-pick-mirror | 25 |
1 files changed, 0 insertions, 25 deletions
diff --git a/db-pick-mirror b/db-pick-mirror deleted file mode 100755 index 4d01b95..0000000 --- a/db-pick-mirror +++ /dev/null @@ -1,25 +0,0 @@ -#!/usr/bin/env ruby - -require 'json' -require 'net/http' - -protocol = ARGV[0] -jsonurl = ARGV[1] - -data = JSON::parse(Net::HTTP.get(URI(jsonurl))) - -if data["version"] != 3 - print "Data format version != 3" - exit 1 -end - -# Filter out URLs with incomplete information -urls = data["urls"].select{|a| a.none?{|k,v|v.nil?}} -rsync_urls = urls.select{|a| a["protocol"]==protocol} - -# By score ( (delay+speed)/completion ) -#best = rsync_urls.sort{|a,b| (a["score"] || Float::INFINITY) <=> (b["score"] || Float::INFINITY) }.first -# By delay/completion -best = rsync_urls.sort{|a,b| a["delay"]/a["completion_pct"] <=> b["delay"]/b["completion_pct"] }.first - -puts best["url"] |