rclone-api 1.0.60__py2.py3-none-any.whl → 1.0.62__py2.py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- rclone_api/rclone.py +45 -9
- {rclone_api-1.0.60.dist-info → rclone_api-1.0.62.dist-info}/METADATA +1 -1
- {rclone_api-1.0.60.dist-info → rclone_api-1.0.62.dist-info}/RECORD +7 -7
- {rclone_api-1.0.60.dist-info → rclone_api-1.0.62.dist-info}/LICENSE +0 -0
- {rclone_api-1.0.60.dist-info → rclone_api-1.0.62.dist-info}/WHEEL +0 -0
- {rclone_api-1.0.60.dist-info → rclone_api-1.0.62.dist-info}/entry_points.txt +0 -0
- {rclone_api-1.0.60.dist-info → rclone_api-1.0.62.dist-info}/top_level.txt +0 -0
rclone_api/rclone.py
CHANGED
@@ -47,6 +47,15 @@ class ModTimeStrategy(Enum):
|
|
47
47
|
NO_MODTIME = "no-modtime"
|
48
48
|
|
49
49
|
|
50
|
+
class DiffOption(Enum):
|
51
|
+
COMBINED = "combined"
|
52
|
+
MISSING_ON_SRC = "missing-on-src"
|
53
|
+
MISSING_ON_DST = "missing-on-dst"
|
54
|
+
DIFFER = "differ"
|
55
|
+
MATCH = "match"
|
56
|
+
ERROR = "error"
|
57
|
+
|
58
|
+
|
50
59
|
class Rclone:
|
51
60
|
def __init__(
|
52
61
|
self, rclone_conf: Path | Config, rclone_exe: Path | None = None
|
@@ -190,6 +199,9 @@ class Rclone:
|
|
190
199
|
max_size: (
|
191
200
|
str | None
|
192
201
|
) = None, # e. g. "1GB" - see rclone documentation: https://rclone.org/commands/rclone_check/
|
202
|
+
diff_option: DiffOption = DiffOption.COMBINED,
|
203
|
+
fast_list: bool = True,
|
204
|
+
size_only: bool = False,
|
193
205
|
other_args: list[str] | None = None,
|
194
206
|
) -> Generator[DiffItem, None, None]:
|
195
207
|
"""Be extra careful with the src and dst values. If you are off by one
|
@@ -203,9 +215,13 @@ class Rclone:
|
|
203
215
|
"1000",
|
204
216
|
"--log-level",
|
205
217
|
"INFO",
|
206
|
-
"--
|
218
|
+
f"--{diff_option.value}",
|
207
219
|
"-",
|
208
220
|
]
|
221
|
+
if size_only:
|
222
|
+
cmd += ["--size-only"]
|
223
|
+
if fast_list:
|
224
|
+
cmd += ["--fast-list"]
|
209
225
|
if min_size:
|
210
226
|
cmd += ["--min-size", min_size]
|
211
227
|
if max_size:
|
@@ -299,7 +315,7 @@ class Rclone:
|
|
299
315
|
self,
|
300
316
|
src: str,
|
301
317
|
dst: str,
|
302
|
-
files: list[str],
|
318
|
+
files: list[str] | Path,
|
303
319
|
check: bool | None = None,
|
304
320
|
verbose: bool | None = None,
|
305
321
|
checkers: int | None = None,
|
@@ -322,7 +338,11 @@ class Rclone:
|
|
322
338
|
checkers = checkers or 1000
|
323
339
|
transfers = transfers or 32
|
324
340
|
verbose = get_verbose(verbose)
|
325
|
-
payload: list[str] =
|
341
|
+
payload: list[str] = (
|
342
|
+
files
|
343
|
+
if isinstance(files, list)
|
344
|
+
else [f.strip() for f in files.read_text().splitlines() if f.strip()]
|
345
|
+
)
|
326
346
|
if len(payload) == 0:
|
327
347
|
return []
|
328
348
|
|
@@ -341,10 +361,26 @@ class Rclone:
|
|
341
361
|
with ThreadPoolExecutor(max_workers=max_partition_workers) as executor:
|
342
362
|
for common_prefix, files in datalists.items():
|
343
363
|
|
344
|
-
def _task(
|
364
|
+
def _task(
|
365
|
+
files: list[str] | Path = files,
|
366
|
+
) -> subprocess.CompletedProcess:
|
345
367
|
with TemporaryDirectory() as tmpdir:
|
346
|
-
|
347
|
-
|
368
|
+
filelist: list[str] = []
|
369
|
+
filepath: Path
|
370
|
+
if isinstance(files, list):
|
371
|
+
include_files_txt = Path(tmpdir) / "include_files.txt"
|
372
|
+
include_files_txt.write_text(
|
373
|
+
"\n".join(files), encoding="utf-8"
|
374
|
+
)
|
375
|
+
filelist = list(files)
|
376
|
+
filepath = Path(include_files_txt)
|
377
|
+
elif isinstance(files, Path):
|
378
|
+
filelist = [
|
379
|
+
f.strip()
|
380
|
+
for f in files.read_text().splitlines()
|
381
|
+
if f.strip()
|
382
|
+
]
|
383
|
+
filepath = files
|
348
384
|
if common_prefix:
|
349
385
|
src_path = f"{src}/{common_prefix}"
|
350
386
|
dst_path = f"{dst}/{common_prefix}"
|
@@ -353,8 +389,8 @@ class Rclone:
|
|
353
389
|
dst_path = dst
|
354
390
|
|
355
391
|
if verbose:
|
356
|
-
nfiles = len(
|
357
|
-
files_fqdn = [f" {src_path}/{f}" for f in
|
392
|
+
nfiles = len(filelist)
|
393
|
+
files_fqdn = [f" {src_path}/{f}" for f in filelist]
|
358
394
|
print(f"Copying {nfiles} files:")
|
359
395
|
chunk_size = 100
|
360
396
|
for i in range(0, nfiles, chunk_size):
|
@@ -370,7 +406,7 @@ class Rclone:
|
|
370
406
|
src_path,
|
371
407
|
dst_path,
|
372
408
|
"--files-from",
|
373
|
-
str(
|
409
|
+
str(filepath),
|
374
410
|
"--checkers",
|
375
411
|
str(checkers),
|
376
412
|
"--transfers",
|
@@ -12,16 +12,16 @@ rclone_api/file.py,sha256=YtR5Y6c0YfXTS-sReOy2UgiSnafcAeO6b2hnbojBQD4,1423
|
|
12
12
|
rclone_api/filelist.py,sha256=xbiusvNgaB_b_kQOZoHMJJxn6TWGtPrWd2J042BI28o,767
|
13
13
|
rclone_api/group_files.py,sha256=kOHh6ysFDkxjldSwvW6KqmiADUC1yFCdrZRY57TvbGY,5328
|
14
14
|
rclone_api/process.py,sha256=RrMfTe0bndmJ6gBK67ioqNvCstJ8aTC8RlGX1XBLlcw,4191
|
15
|
-
rclone_api/rclone.py,sha256=
|
15
|
+
rclone_api/rclone.py,sha256=XHlsmFRBFPNa9KzUPMQQgEJ9iT7FEByzdFX_x-YHK3E,27660
|
16
16
|
rclone_api/remote.py,sha256=c9hlRKBCg1BFB9MCINaQIoCg10qyAkeqiS4brl8ce-8,343
|
17
17
|
rclone_api/rpath.py,sha256=8ZA_1wxWtskwcy0I8V2VbjKDmzPkiWd8Q2JQSvh-sYE,2586
|
18
18
|
rclone_api/util.py,sha256=_cvmHcJPRl2yXw4zgZiop3z-riA_8Ek6S5NDPw8cqSY,4198
|
19
19
|
rclone_api/walk.py,sha256=UaNOE3ICd8k5ouSFZvkVEH4r2GnnrD9TxfwkFcQnayo,3170
|
20
20
|
rclone_api/assets/example.txt,sha256=lTBovRjiz0_TgtAtbA1C5hNi2ffbqnNPqkKg6UiKCT8,54
|
21
21
|
rclone_api/cmd/list_files.py,sha256=x8FHODEilwKqwdiU1jdkeJbLwOqUkUQuDWPo2u_zpf0,741
|
22
|
-
rclone_api-1.0.
|
23
|
-
rclone_api-1.0.
|
24
|
-
rclone_api-1.0.
|
25
|
-
rclone_api-1.0.
|
26
|
-
rclone_api-1.0.
|
27
|
-
rclone_api-1.0.
|
22
|
+
rclone_api-1.0.62.dist-info/LICENSE,sha256=b6pOoifSXiUaz_lDS84vWlG3fr4yUKwB8fzkrH9R8bQ,1064
|
23
|
+
rclone_api-1.0.62.dist-info/METADATA,sha256=6kAKTj6uGolJZjeltWjmLlZOK5zPIRnkIhp0Kahs8Ww,4489
|
24
|
+
rclone_api-1.0.62.dist-info/WHEEL,sha256=9Hm2OB-j1QcCUq9Jguht7ayGIIZBRTdOXD1qg9cCgPM,109
|
25
|
+
rclone_api-1.0.62.dist-info/entry_points.txt,sha256=XUoTX3m7CWxdj2VAKhEuO0NMOfX2qf-OcEDFwdyk9ZE,72
|
26
|
+
rclone_api-1.0.62.dist-info/top_level.txt,sha256=EvZ7uuruUpe9RiUyEp25d1Keq7PWYNT0O_-mr8FCG5g,11
|
27
|
+
rclone_api-1.0.62.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|