mirror of
https://github.com/9001/copyparty.git
synced 2025-08-17 17:12:13 -06:00
u2cli: dont enter delete stage if something failed
This commit is contained in:
parent
6acf436573
commit
2459965ca8
13
bin/up2k.py
13
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.5"
|
S_VERSION = "1.6"
|
||||||
S_BUILD_DT = "2023-03-12"
|
S_BUILD_DT = "2023-04-20"
|
||||||
|
|
||||||
"""
|
"""
|
||||||
up2k.py: upload to copyparty
|
up2k.py: upload to copyparty
|
||||||
|
@ -653,6 +653,7 @@ class Ctl(object):
|
||||||
return nfiles, nbytes
|
return nfiles, nbytes
|
||||||
|
|
||||||
def __init__(self, ar, stats=None):
|
def __init__(self, ar, stats=None):
|
||||||
|
self.ok = False
|
||||||
self.ar = ar
|
self.ar = ar
|
||||||
self.stats = stats or self._scan()
|
self.stats = stats or self._scan()
|
||||||
if not self.stats:
|
if not self.stats:
|
||||||
|
@ -700,6 +701,8 @@ class Ctl(object):
|
||||||
|
|
||||||
self._fancy()
|
self._fancy()
|
||||||
|
|
||||||
|
self.ok = True
|
||||||
|
|
||||||
def _safe(self):
|
def _safe(self):
|
||||||
"""minimal basic slow boring fallback codepath"""
|
"""minimal basic slow boring fallback codepath"""
|
||||||
search = self.ar.s
|
search = self.ar.s
|
||||||
|
@ -1131,11 +1134,13 @@ source file/folder selection uses rsync syntax, meaning that:
|
||||||
|
|
||||||
ctl = Ctl(ar)
|
ctl = Ctl(ar)
|
||||||
|
|
||||||
if ar.dr and not ar.drd:
|
if ar.dr and not ar.drd and ctl.ok:
|
||||||
print("\npass 2/2: delete")
|
print("\npass 2/2: delete")
|
||||||
ar.drd = True
|
ar.drd = True
|
||||||
ar.z = True
|
ar.z = True
|
||||||
Ctl(ar, ctl.stats)
|
ctl = Ctl(ar, ctl.stats)
|
||||||
|
|
||||||
|
sys.exit(0 if ctl.ok else 1)
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
|
|
Loading…
Reference in a new issue