rclone-api 1.5.65__py3-none-any.whl → 1.5.67__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 +26 -4
- rclone_api/s3/multipart/upload_parts_resumable.py +24 -5
- {rclone_api-1.5.65.dist-info → rclone_api-1.5.67.dist-info}/METADATA +1 -1
- {rclone_api-1.5.65.dist-info → rclone_api-1.5.67.dist-info}/RECORD +8 -8
- {rclone_api-1.5.65.dist-info → rclone_api-1.5.67.dist-info}/WHEEL +0 -0
- {rclone_api-1.5.65.dist-info → rclone_api-1.5.67.dist-info}/entry_points.txt +0 -0
- {rclone_api-1.5.65.dist-info → rclone_api-1.5.67.dist-info}/licenses/LICENSE +0 -0
- {rclone_api-1.5.65.dist-info → rclone_api-1.5.67.dist-info}/top_level.txt +0 -0
rclone_api/__init__.py
CHANGED
@@ -48,7 +48,7 @@ from .types import ( # Common types
|
|
48
48
|
setup_default_logging()
|
49
49
|
|
50
50
|
|
51
|
-
def rclone_verbose(val: bool | None) -> bool:
|
51
|
+
def rclone_verbose(val: bool | None, from_api: bool = False) -> bool:
|
52
52
|
"""
|
53
53
|
Get or set the global verbosity setting for rclone operations.
|
54
54
|
|
@@ -61,21 +61,43 @@ def rclone_verbose(val: bool | None) -> bool:
|
|
61
61
|
Returns:
|
62
62
|
The current verbosity setting after any change.
|
63
63
|
"""
|
64
|
+
import warnings
|
65
|
+
|
64
66
|
from rclone_api.rclone_impl import rclone_verbose as _rclone_verbose
|
65
67
|
|
68
|
+
if not from_api:
|
69
|
+
warnings.warn(
|
70
|
+
"rclone_verbose is deprecated. Use LogSettings.rclone_verbose instead.",
|
71
|
+
DeprecationWarning,
|
72
|
+
)
|
73
|
+
|
66
74
|
return _rclone_verbose(val)
|
67
75
|
|
68
76
|
|
69
|
-
class
|
77
|
+
class LogSettings:
|
70
78
|
@staticmethod
|
71
|
-
def enable_upload_parts_logging(value: bool) ->
|
79
|
+
def enable_upload_parts_logging(value: bool | None = None) -> bool:
|
72
80
|
"""
|
73
81
|
Enable or disable logging of upload parts.
|
74
82
|
|
75
83
|
Args:
|
76
84
|
value: If True, enables upload parts logging; otherwise disables it.
|
77
85
|
"""
|
78
|
-
|
86
|
+
|
87
|
+
if value is not None:
|
88
|
+
os.environ["LOG_UPLOAD_S3_RESUMABLE"] = "1" if value else "0"
|
89
|
+
env_val = str(os.getenv("LOG_UPLOAD_S3_RESUMABLE", "0"))
|
90
|
+
return env_val.lower() in ["1", "true", "yes"]
|
91
|
+
|
92
|
+
@staticmethod
|
93
|
+
def rclone_verbose(value: bool) -> bool:
|
94
|
+
"""
|
95
|
+
Enable or disable verbose logging for rclone commands.
|
96
|
+
|
97
|
+
Args:
|
98
|
+
value: If True, enables verbose logging; otherwise disables it.
|
99
|
+
"""
|
100
|
+
return rclone_verbose(value, from_api=True)
|
79
101
|
|
80
102
|
|
81
103
|
class Rclone:
|
@@ -20,7 +20,7 @@ from rclone_api.types import (
|
|
20
20
|
_LOCK = threading.Lock()
|
21
21
|
|
22
22
|
|
23
|
-
def
|
23
|
+
def _log(msg: str) -> None:
|
24
24
|
print(msg)
|
25
25
|
if os.getenv("LOG_UPLOAD_S3_RESUMABLE") == "1":
|
26
26
|
log_path = Path("log") / "s3_resumable_upload.log"
|
@@ -32,6 +32,17 @@ def _maybe_log(msg: str) -> None:
|
|
32
32
|
f.write("\n")
|
33
33
|
|
34
34
|
|
35
|
+
def _log_completed_item(msg: str) -> None:
|
36
|
+
if os.getenv("LOG_UPLOAD_S3_RESUMABLE") == "1":
|
37
|
+
log_path = Path("log") / "s3_resumable_upload_completed.log"
|
38
|
+
with _LOCK:
|
39
|
+
log_path.parent.mkdir(parents=True, exist_ok=True)
|
40
|
+
# log_path.write_text(msg, append=True)
|
41
|
+
with open(log_path, mode="a", encoding="utf-8") as f:
|
42
|
+
f.write(msg)
|
43
|
+
f.write("\n")
|
44
|
+
|
45
|
+
|
35
46
|
@dataclass
|
36
47
|
class UploadPart:
|
37
48
|
chunk: Path
|
@@ -74,7 +85,7 @@ def upload_task(self: RcloneImpl, upload_part: UploadPart) -> UploadPart:
|
|
74
85
|
msg += f"# Chunk size: {upload_part.chunk.stat().st_size} bytes\n"
|
75
86
|
msg += f"# Range: {upload_part.chunk.name}\n"
|
76
87
|
msg += "##############################################################\n"
|
77
|
-
|
88
|
+
_log(msg)
|
78
89
|
self.copy_to(upload_part.chunk.as_posix(), upload_part.dst_part)
|
79
90
|
return upload_part
|
80
91
|
except Exception as e:
|
@@ -346,7 +357,7 @@ def upload_parts_resumable(
|
|
346
357
|
|
347
358
|
if len(exceptions) > 0:
|
348
359
|
msg = f"Failed to copy parts: {exceptions}"
|
349
|
-
|
360
|
+
_log(msg)
|
350
361
|
return Exception(msg, exceptions)
|
351
362
|
|
352
363
|
finished_parts: list[int] = info_json.fetch_all_finished_part_numbers()
|
@@ -355,7 +366,15 @@ def upload_parts_resumable(
|
|
355
366
|
diff_set = set(all_part_numbers).symmetric_difference(set(finished_parts))
|
356
367
|
all_part_numbers_done = len(diff_set) == 0
|
357
368
|
# print(f"all_part_numbers_done: {all_part_numbers_done}")
|
358
|
-
msg = f"all_part_numbers_done: {all_part_numbers_done}"
|
359
|
-
|
369
|
+
# msg = f"all_part_numbers_done: {all_part_numbers_done}"
|
370
|
+
full_path = os.path.join(dst_dir, src_name)
|
371
|
+
if all_part_numbers_done:
|
372
|
+
msg = f"Upload completed: {full_path} ({len(finished_parts)}/{len(all_part_numbers)})"
|
373
|
+
_log(msg)
|
374
|
+
info_json.save()
|
375
|
+
else:
|
376
|
+
msg = f"Upload failed for {full_path} ({len(finished_parts)}/{len(all_part_numbers)})"
|
377
|
+
_log(msg)
|
378
|
+
_log_completed_item(msg)
|
360
379
|
|
361
380
|
return None
|
@@ -1,4 +1,4 @@
|
|
1
|
-
rclone_api/__init__.py,sha256=
|
1
|
+
rclone_api/__init__.py,sha256=TLQhluXlEYEcOz0HlDtgrEs1EE15f34k6NHpW3-_dBY,35950
|
2
2
|
rclone_api/cli.py,sha256=dibfAZIh0kXWsBbfp3onKLjyZXo54mTzDjUdzJlDlWo,231
|
3
3
|
rclone_api/completed_process.py,sha256=_IZ8IWK7DM1_tsbDEkH6wPZ-bbcrgf7A7smls854pmg,1775
|
4
4
|
rclone_api/config.py,sha256=URZwMME01f0EZymprCESuZ5dk4IuUSKbHhwIeTHrn7A,6131
|
@@ -55,12 +55,12 @@ rclone_api/s3/multipart/info_json.py,sha256=-e8UCwrqjAP64U8PmH-o2ciJ6TN48DwHktJf
|
|
55
55
|
rclone_api/s3/multipart/merge_state.py,sha256=ziTB9CYV-OWaky5C1fOT9hifSY2zgUrk5HmX1Xeu2UA,4978
|
56
56
|
rclone_api/s3/multipart/upload_info.py,sha256=d6_OfzFR_vtDzCEegFfzCfWi2kUBUV4aXZzqAEVp1c4,1874
|
57
57
|
rclone_api/s3/multipart/upload_parts_inline.py,sha256=V7syKjFyVIe4U9Ahl5XgqVTzt9akiew3MFjGmufLo2w,12503
|
58
|
-
rclone_api/s3/multipart/upload_parts_resumable.py,sha256=
|
58
|
+
rclone_api/s3/multipart/upload_parts_resumable.py,sha256=tdOkEfoK9zENaTfgVyTWB5GNqn-IYl-zJn-rJLcoVTo,12388
|
59
59
|
rclone_api/s3/multipart/upload_parts_server_side_merge.py,sha256=Fp2pdrs5dONQI9LkfNolgAGj1-Z2V1SsRd0r0sreuXI,18040
|
60
60
|
rclone_api/s3/multipart/upload_state.py,sha256=f-Aq2NqtAaMUMhYitlICSNIxCKurWAl2gDEUVizLIqw,6019
|
61
|
-
rclone_api-1.5.
|
62
|
-
rclone_api-1.5.
|
63
|
-
rclone_api-1.5.
|
64
|
-
rclone_api-1.5.
|
65
|
-
rclone_api-1.5.
|
66
|
-
rclone_api-1.5.
|
61
|
+
rclone_api-1.5.67.dist-info/licenses/LICENSE,sha256=b6pOoifSXiUaz_lDS84vWlG3fr4yUKwB8fzkrH9R8bQ,1064
|
62
|
+
rclone_api-1.5.67.dist-info/METADATA,sha256=NnfySdn_QjHtynzcviDQ3y42jSCPrtH_RGQnfRLDrYU,37305
|
63
|
+
rclone_api-1.5.67.dist-info/WHEEL,sha256=SmOxYU7pzNKBqASvQJ7DjX3XGUF92lrGhMb3R6_iiqI,91
|
64
|
+
rclone_api-1.5.67.dist-info/entry_points.txt,sha256=ognh2e11HTjn73_KL5MWI67pBKS2jekBi-QTiRXySXA,316
|
65
|
+
rclone_api-1.5.67.dist-info/top_level.txt,sha256=EvZ7uuruUpe9RiUyEp25d1Keq7PWYNT0O_-mr8FCG5g,11
|
66
|
+
rclone_api-1.5.67.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|