mirror of
https://github.com/9001/copyparty.git
synced 2025-08-18 01:22:13 -06:00
ok that wasn't enough
This commit is contained in:
parent
cdacdccdb8
commit
a84c583b2c
19
bin/up2k.py
19
bin/up2k.py
|
@ -1,8 +1,8 @@
|
||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
from __future__ import print_function, unicode_literals
|
from __future__ import print_function, unicode_literals
|
||||||
|
|
||||||
S_VERSION = "1.7"
|
S_VERSION = "1.8"
|
||||||
S_BUILD_DT = "2023-04-26"
|
S_BUILD_DT = "2023-04-27"
|
||||||
|
|
||||||
"""
|
"""
|
||||||
up2k.py: upload to copyparty
|
up2k.py: upload to copyparty
|
||||||
|
@ -348,6 +348,8 @@ def undns(url):
|
||||||
try:
|
try:
|
||||||
gai = socket.getaddrinfo(hn, None)
|
gai = socket.getaddrinfo(hn, None)
|
||||||
hn = gai[0][4][0]
|
hn = gai[0][4][0]
|
||||||
|
except KeyboardInterrupt:
|
||||||
|
raise
|
||||||
except:
|
except:
|
||||||
t = "\n\033[31mfailed to resolve upload destination host;\033[0m\ngai={0}\n"
|
t = "\n\033[31mfailed to resolve upload destination host;\033[0m\ngai={0}\n"
|
||||||
eprint(t.format(repr(gai)))
|
eprint(t.format(repr(gai)))
|
||||||
|
@ -1100,7 +1102,7 @@ source file/folder selection uses rsync syntax, meaning that:
|
||||||
|
|
||||||
ap = app.add_argument_group("compatibility")
|
ap = app.add_argument_group("compatibility")
|
||||||
ap.add_argument("--cls", action="store_true", help="clear screen before start")
|
ap.add_argument("--cls", action="store_true", help="clear screen before start")
|
||||||
ap.add_argument("--rh", action="store_true", help="resolve server hostname before upload (good for buggy networks, but TLS certs will break)")
|
ap.add_argument("--rh", type=int, metavar="TRIES", default=0, help="resolve server hostname before upload (good for buggy networks, but TLS certs will break)")
|
||||||
|
|
||||||
ap = app.add_argument_group("folder sync")
|
ap = app.add_argument_group("folder sync")
|
||||||
ap.add_argument("--dl", action="store_true", help="delete local files after uploading")
|
ap.add_argument("--dl", action="store_true", help="delete local files after uploading")
|
||||||
|
@ -1157,8 +1159,15 @@ source file/folder selection uses rsync syntax, meaning that:
|
||||||
with open(fn, "rb") as f:
|
with open(fn, "rb") as f:
|
||||||
ar.a = f.read().decode("utf-8").strip()
|
ar.a = f.read().decode("utf-8").strip()
|
||||||
|
|
||||||
if ar.rh:
|
for n in range(ar.rh):
|
||||||
ar.url = undns(ar.url)
|
try:
|
||||||
|
ar.url = undns(ar.url)
|
||||||
|
break
|
||||||
|
except KeyboardInterrupt:
|
||||||
|
raise
|
||||||
|
except:
|
||||||
|
if n > ar.rh - 2:
|
||||||
|
raise
|
||||||
|
|
||||||
if ar.cls:
|
if ar.cls:
|
||||||
eprint("\x1b\x5b\x48\x1b\x5b\x32\x4a\x1b\x5b\x33\x4a", end="")
|
eprint("\x1b\x5b\x48\x1b\x5b\x32\x4a\x1b\x5b\x33\x4a", end="")
|
||||||
|
|
Loading…
Reference in a new issue