add option to specify default num parallel uploads

This commit is contained in:
ed 2023-12-28 01:41:17 +01:00
parent 39554b4bc3
commit 5b26ab0096
5 changed files with 11 additions and 5 deletions

View file

@ -869,6 +869,7 @@ def add_upload(ap):
ap2.add_argument("--df", metavar="GiB", type=float, default=0, help="ensure \033[33mGiB\033[0m free disk space by rejecting upload requests")
ap2.add_argument("--sparse", metavar="MiB", type=int, default=4, help="windows-only: minimum size of incoming uploads through up2k before they are made into sparse files")
ap2.add_argument("--turbo", metavar="LVL", type=int, default=0, help="configure turbo-mode in up2k client; [\033[32m-1\033[0m] = forbidden/always-off, [\033[32m0\033[0m] = default-off and warn if enabled, [\033[32m1\033[0m] = default-off, [\033[32m2\033[0m] = on, [\033[32m3\033[0m] = on and disable datecheck")
ap2.add_argument("--u2j", metavar="JOBS", type=int, default=2, help="web-client: number of file chunks to upload in parallel; 1 or 2 is good for low-latency (same-country) connections, 4-8 for android clients, 16-32 for cross-atlantic (max=64)")
ap2.add_argument("--u2sort", metavar="TXT", type=u, default="s", help="upload order; [\033[32ms\033[0m]=smallest-first, [\033[32mn\033[0m]=alphabetical, [\033[32mfs\033[0m]=force-s, [\033[32mfn\033[0m]=force-n -- alphabetical is a bit slower on fiber/LAN but makes it easier to eyeball if everything went fine")
ap2.add_argument("--write-uplog", action="store_true", help="write POST reports to textfiles in working-directory")

View file

@ -3966,6 +3966,7 @@ class HttpCli(object):
"dsort": vf["sort"],
"themes": self.args.themes,
"turbolvl": self.args.turbo,
"u2j": self.args.u2j,
"idxh": int(self.args.ih),
"u2sort": self.args.u2sort,
}

View file

@ -1077,7 +1077,7 @@ ebi('op_up2k').innerHTML = (
' <tr>\n' +
' <td class="c" data-perm="read">\n' +
' <a href="#" class="b" id="nthread_sub">&ndash;</a><input\n' +
' class="txtbox" id="nthread" value="2" tt="' + L.ut_par + '"/><a\n' +
' class="txtbox" id="nthread" value="" tt="' + L.ut_par + '"/><a\n' +
' href="#" class="b" id="nthread_add">+</a><br />&nbsp;\n' +
' </td>\n' +
' </tr>\n' +

View file

@ -852,7 +852,7 @@ function up2k_init(subtle) {
setmsg(suggest_up2k, 'msg');
var parallel_uploads = icfg_get('nthread'),
var parallel_uploads = ebi('nthread').value = icfg_get('nthread', u2j),
uc = {},
fdom_ctr = 0,
biggest_file = 0;
@ -2685,7 +2685,11 @@ function up2k_init(subtle) {
}
parallel_uploads = v;
if (v == u2j)
localStorage.removeItem('nthread');
else
swrite('nthread', v);
clmod(obj, 'err');
return;
}
@ -2699,7 +2703,7 @@ function up2k_init(subtle) {
parallel_uploads = 16;
obj.value = parallel_uploads;
bumpthread({ "target": 1 })
bumpthread({ "target": 1 });
}
function tgl_fsearch() {

View file

@ -931,7 +931,7 @@ function fcfg_get(name, defval) {
val = parseFloat(sread(name));
if (!isNum(val))
return parseFloat(o ? o.value : defval);
return parseFloat(o && o.value !== '' ? o.value : defval);
if (o)
o.value = val;