rclone-api 1.5.28__py3-none-any.whl → 1.5.30__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/__init__.py +18 -1
- rclone_api/config.py +28 -1
- rclone_api/rclone_impl.py +1360 -1301
- {rclone_api-1.5.28.dist-info → rclone_api-1.5.30.dist-info}/METADATA +1 -1
- {rclone_api-1.5.28.dist-info → rclone_api-1.5.30.dist-info}/RECORD +9 -9
- {rclone_api-1.5.28.dist-info → rclone_api-1.5.30.dist-info}/WHEEL +0 -0
- {rclone_api-1.5.28.dist-info → rclone_api-1.5.30.dist-info}/entry_points.txt +0 -0
- {rclone_api-1.5.28.dist-info → rclone_api-1.5.30.dist-info}/licenses/LICENSE +0 -0
- {rclone_api-1.5.28.dist-info → rclone_api-1.5.30.dist-info}/top_level.txt +0 -0
rclone_api/__init__.py
CHANGED
@@ -93,7 +93,7 @@ class Rclone:
|
|
93
93
|
return upgrade_rclone()
|
94
94
|
|
95
95
|
def __init__(
|
96
|
-
self, rclone_conf: Path | Config, rclone_exe: Path | None = None
|
96
|
+
self, rclone_conf: Path | Config | None, rclone_exe: Path | None = None
|
97
97
|
) -> None:
|
98
98
|
"""
|
99
99
|
Initialize the Rclone interface.
|
@@ -210,6 +210,23 @@ class Rclone:
|
|
210
210
|
"""
|
211
211
|
return self.impl.obscure(password=password)
|
212
212
|
|
213
|
+
def config_show(
|
214
|
+
self, remote: str | None = None, obscure: bool = False, no_obscure: bool = False
|
215
|
+
) -> list[Path] | Exception:
|
216
|
+
"""Show the current configuration.
|
217
|
+
|
218
|
+
Args:
|
219
|
+
remote: Optional remote name to show configuration for
|
220
|
+
obscure: Show obscured passwords
|
221
|
+
no_obscure: Show passwords in plain text
|
222
|
+
|
223
|
+
Returns:
|
224
|
+
Configuration as text or an Exception if an error occurred
|
225
|
+
"""
|
226
|
+
return self.impl.config_paths(
|
227
|
+
remote=remote, obscure=obscure, no_obscure=no_obscure
|
228
|
+
)
|
229
|
+
|
213
230
|
def ls_stream(
|
214
231
|
self,
|
215
232
|
src: str,
|
rclone_api/config.py
CHANGED
@@ -1,5 +1,7 @@
|
|
1
|
+
import os
|
1
2
|
from dataclasses import dataclass, field
|
2
|
-
from
|
3
|
+
from pathlib import Path
|
4
|
+
from typing import Any, Dict, List
|
3
5
|
|
4
6
|
|
5
7
|
@dataclass
|
@@ -55,6 +57,31 @@ class Config:
|
|
55
57
|
return Parsed.parse(self.text)
|
56
58
|
|
57
59
|
|
60
|
+
def find_conf_file(rclone: Any | None = None) -> Path | None:
|
61
|
+
from rclone_api.rclone_impl import RcloneImpl
|
62
|
+
|
63
|
+
# if os.environ.get("RCLONE_CONFIG"):
|
64
|
+
# return Path(os.environ["RCLONE_CONFIG"])
|
65
|
+
# return None
|
66
|
+
# rclone_conf = rclone_conf or Path.cwd() / "rclone.conf"
|
67
|
+
|
68
|
+
if os.environ.get("RCLONE_CONFIG"):
|
69
|
+
return Path(os.environ["RCLONE_CONFIG"])
|
70
|
+
if (conf := Path.cwd() / "rclone.conf").exists():
|
71
|
+
return conf
|
72
|
+
if rclone is not None:
|
73
|
+
assert isinstance(rclone, RcloneImpl)
|
74
|
+
paths_or_err = rclone.config_paths()
|
75
|
+
if isinstance(paths_or_err, Exception):
|
76
|
+
return None
|
77
|
+
paths = paths_or_err
|
78
|
+
path: Path
|
79
|
+
for path in paths:
|
80
|
+
if path.exists():
|
81
|
+
return path
|
82
|
+
return None
|
83
|
+
|
84
|
+
|
58
85
|
def parse_rclone_config(content: str) -> Parsed:
|
59
86
|
"""
|
60
87
|
Parses an rclone configuration file and returns a list of RcloneConfigSection objects.
|