rclone-api 1.0.23__py2.py3-none-any.whl → 1.0.25__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 CHANGED
@@ -6,6 +6,7 @@ import subprocess
6
6
  import time
7
7
  import warnings
8
8
  from concurrent.futures import ThreadPoolExecutor
9
+ from enum import Enum
9
10
  from fnmatch import fnmatch
10
11
  from pathlib import Path
11
12
  from typing import Generator
@@ -23,6 +24,11 @@ from rclone_api.util import get_rclone_exe, to_path, wait_for_mount
23
24
  from rclone_api.walk import walk
24
25
 
25
26
 
27
+ class ModTimeStrategy(Enum):
28
+ USE_SERVER_MODTIME = "use-server-modtime"
29
+ NO_MODTIME = "no-modtime"
30
+
31
+
26
32
  class Rclone:
27
33
  def __init__(
28
34
  self, rclone_conf: Path | Config, rclone_exe: Path | None = None
@@ -299,6 +305,7 @@ class Rclone:
299
305
  url: str,
300
306
  outdir: Path,
301
307
  vfs_cache_mode="full",
308
+ vfs_disk_space_total_size: str | None = "10G",
302
309
  other_cmds: list[str] | None = None,
303
310
  ) -> Process:
304
311
  """Mount a remote or directory to a local path.
@@ -327,10 +334,60 @@ class Rclone:
327
334
  cmd_list.append(vfs_cache_mode)
328
335
  if other_cmds:
329
336
  cmd_list += other_cmds
337
+ if vfs_disk_space_total_size is not None:
338
+ cmd_list.append("--vfs-cache-max-size")
339
+ cmd_list.append(vfs_disk_space_total_size)
330
340
  proc = self._launch_process(cmd_list)
331
341
  wait_for_mount(outdir, proc)
332
342
  return proc
333
343
 
344
+ def mount_s3(
345
+ self,
346
+ url: str,
347
+ outdir: Path,
348
+ allow_writes=False,
349
+ vfs_cache_mode="full",
350
+ transfers: int | None = 16,
351
+ modtime_strategy: (
352
+ ModTimeStrategy | None
353
+ ) = ModTimeStrategy.USE_SERVER_MODTIME, # speeds up S3 operations
354
+ vfs_read_chunk_streams: int | None = 16,
355
+ vfs_read_chunk_size: str | None = "4M",
356
+ vfs_fast_fingerprint: bool = True,
357
+ other_cmds: list[str] | None = None,
358
+ ) -> Process:
359
+ """Mount a remote or directory to a local path.
360
+
361
+ Args:
362
+ src: Remote or directory to mount
363
+ outdir: Local path to mount to
364
+ """
365
+ other_cmds = other_cmds or []
366
+ if modtime_strategy is not None:
367
+ other_cmds.append(f"--{modtime_strategy.value}")
368
+ if (vfs_cache_mode == "full" or vfs_cache_mode == "writes") and (
369
+ transfers is not None
370
+ ):
371
+ other_cmds.append("--transfers")
372
+ other_cmds.append(str(transfers))
373
+ if vfs_read_chunk_streams:
374
+ other_cmds.append("--vfs-read-chunk-streams")
375
+ other_cmds.append(str(vfs_read_chunk_streams))
376
+ if vfs_read_chunk_size:
377
+ other_cmds.append("--vfs-read-chunk-size")
378
+ other_cmds.append(vfs_read_chunk_size)
379
+ if vfs_fast_fingerprint:
380
+ other_cmds.append("--vfs-fast-fingerprint")
381
+
382
+ other_cmds = other_cmds if other_cmds else None
383
+ return self.mount(
384
+ url,
385
+ outdir,
386
+ allow_writes=allow_writes,
387
+ vfs_cache_mode=vfs_cache_mode,
388
+ other_cmds=other_cmds,
389
+ )
390
+
334
391
  def serve_webdav(
335
392
  self,
336
393
  src: Remote | Dir | str,
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: rclone_api
3
- Version: 1.0.23
3
+ Version: 1.0.25
4
4
  Summary: rclone api in python
5
5
  Home-page: https://github.com/zackees/rclone-api
6
6
  Maintainer: Zachary Vorhies
@@ -8,16 +8,16 @@ rclone_api/exec.py,sha256=9qSOpZo8YRYxv3hOvNr57ApnY2KbjxwT1QNr8OgcLM4,883
8
8
  rclone_api/file.py,sha256=D02iHJW1LhfOiM_R_yPHP8_ApnDiYrkuraVcrV8-qkw,1246
9
9
  rclone_api/filelist.py,sha256=xbiusvNgaB_b_kQOZoHMJJxn6TWGtPrWd2J042BI28o,767
10
10
  rclone_api/process.py,sha256=iVA8_qtJFgHtg92Yb4W7xv9jnyds_7kAdKeSiGCBIZ0,3952
11
- rclone_api/rclone.py,sha256=RBlEi7M8Jpgt8oJcV-2VrhF-iVAtGlpfBJ7YXGjPS_s,12649
11
+ rclone_api/rclone.py,sha256=2sxlxC9zsEG8P4ctgGtVKUPYxk2hB8uBimXbHnpqC-Q,14705
12
12
  rclone_api/remote.py,sha256=c9hlRKBCg1BFB9MCINaQIoCg10qyAkeqiS4brl8ce-8,343
13
13
  rclone_api/rpath.py,sha256=8ZA_1wxWtskwcy0I8V2VbjKDmzPkiWd8Q2JQSvh-sYE,2586
14
14
  rclone_api/util.py,sha256=AWTImA1liCMw52wtS-Gs8Abz96diQ39x6Tx56mvbrEo,3860
15
15
  rclone_api/walk.py,sha256=kca0t1GAnF6FLclN01G8NG__Qe-ggodLtAbQSHyVPng,2968
16
16
  rclone_api/assets/example.txt,sha256=lTBovRjiz0_TgtAtbA1C5hNi2ffbqnNPqkKg6UiKCT8,54
17
17
  rclone_api/cmd/list_files.py,sha256=x8FHODEilwKqwdiU1jdkeJbLwOqUkUQuDWPo2u_zpf0,741
18
- rclone_api-1.0.23.dist-info/LICENSE,sha256=b6pOoifSXiUaz_lDS84vWlG3fr4yUKwB8fzkrH9R8bQ,1064
19
- rclone_api-1.0.23.dist-info/METADATA,sha256=UWJf59LRcykpcIWrMtB0mZi_75RvEMXjI48U1bWhGwE,4454
20
- rclone_api-1.0.23.dist-info/WHEEL,sha256=9Hm2OB-j1QcCUq9Jguht7ayGIIZBRTdOXD1qg9cCgPM,109
21
- rclone_api-1.0.23.dist-info/entry_points.txt,sha256=XUoTX3m7CWxdj2VAKhEuO0NMOfX2qf-OcEDFwdyk9ZE,72
22
- rclone_api-1.0.23.dist-info/top_level.txt,sha256=EvZ7uuruUpe9RiUyEp25d1Keq7PWYNT0O_-mr8FCG5g,11
23
- rclone_api-1.0.23.dist-info/RECORD,,
18
+ rclone_api-1.0.25.dist-info/LICENSE,sha256=b6pOoifSXiUaz_lDS84vWlG3fr4yUKwB8fzkrH9R8bQ,1064
19
+ rclone_api-1.0.25.dist-info/METADATA,sha256=1UQ5eElGnKi2Bd-rWpgy_XT9Vw_jLS-TYM1Mm95xk9o,4454
20
+ rclone_api-1.0.25.dist-info/WHEEL,sha256=9Hm2OB-j1QcCUq9Jguht7ayGIIZBRTdOXD1qg9cCgPM,109
21
+ rclone_api-1.0.25.dist-info/entry_points.txt,sha256=XUoTX3m7CWxdj2VAKhEuO0NMOfX2qf-OcEDFwdyk9ZE,72
22
+ rclone_api-1.0.25.dist-info/top_level.txt,sha256=EvZ7uuruUpe9RiUyEp25d1Keq7PWYNT0O_-mr8FCG5g,11
23
+ rclone_api-1.0.25.dist-info/RECORD,,