cloudinary-cli 1.11.1__tar.gz → 1.12.0__tar.gz
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.
- {cloudinary_cli-1.11.1/cloudinary_cli.egg-info → cloudinary_cli-1.12.0}/PKG-INFO +1 -1
- {cloudinary_cli-1.11.1 → cloudinary_cli-1.12.0}/cloudinary_cli/modules/sync.py +6 -4
- {cloudinary_cli-1.11.1 → cloudinary_cli-1.12.0}/cloudinary_cli/utils/api_utils.py +16 -6
- cloudinary_cli-1.12.0/cloudinary_cli/version.py +1 -0
- {cloudinary_cli-1.11.1 → cloudinary_cli-1.12.0/cloudinary_cli.egg-info}/PKG-INFO +1 -1
- cloudinary_cli-1.11.1/cloudinary_cli/version.py +0 -1
- {cloudinary_cli-1.11.1 → cloudinary_cli-1.12.0}/LICENSE +0 -0
- {cloudinary_cli-1.11.1 → cloudinary_cli-1.12.0}/MANIFEST.in +0 -0
- {cloudinary_cli-1.11.1 → cloudinary_cli-1.12.0}/README.md +0 -0
- {cloudinary_cli-1.11.1 → cloudinary_cli-1.12.0}/cloudinary_cli/__init__.py +0 -0
- {cloudinary_cli-1.11.1 → cloudinary_cli-1.12.0}/cloudinary_cli/cli.py +0 -0
- {cloudinary_cli-1.11.1 → cloudinary_cli-1.12.0}/cloudinary_cli/cli_group.py +0 -0
- {cloudinary_cli-1.11.1 → cloudinary_cli-1.12.0}/cloudinary_cli/core/__init__.py +0 -0
- {cloudinary_cli-1.11.1 → cloudinary_cli-1.12.0}/cloudinary_cli/core/admin.py +0 -0
- {cloudinary_cli-1.11.1 → cloudinary_cli-1.12.0}/cloudinary_cli/core/config.py +0 -0
- {cloudinary_cli-1.11.1 → cloudinary_cli-1.12.0}/cloudinary_cli/core/overrides.py +0 -0
- {cloudinary_cli-1.11.1 → cloudinary_cli-1.12.0}/cloudinary_cli/core/provisioning.py +0 -0
- {cloudinary_cli-1.11.1 → cloudinary_cli-1.12.0}/cloudinary_cli/core/search.py +0 -0
- {cloudinary_cli-1.11.1 → cloudinary_cli-1.12.0}/cloudinary_cli/core/uploader.py +0 -0
- {cloudinary_cli-1.11.1 → cloudinary_cli-1.12.0}/cloudinary_cli/core/utils.py +0 -0
- {cloudinary_cli-1.11.1 → cloudinary_cli-1.12.0}/cloudinary_cli/defaults.py +0 -0
- {cloudinary_cli-1.11.1 → cloudinary_cli-1.12.0}/cloudinary_cli/modules/__init__.py +0 -0
- {cloudinary_cli-1.11.1 → cloudinary_cli-1.12.0}/cloudinary_cli/modules/clone.py +0 -0
- {cloudinary_cli-1.11.1 → cloudinary_cli-1.12.0}/cloudinary_cli/modules/make.py +0 -0
- {cloudinary_cli-1.11.1 → cloudinary_cli-1.12.0}/cloudinary_cli/modules/migrate.py +0 -0
- {cloudinary_cli-1.11.1 → cloudinary_cli-1.12.0}/cloudinary_cli/modules/regen_derived.py +0 -0
- {cloudinary_cli-1.11.1 → cloudinary_cli-1.12.0}/cloudinary_cli/modules/upload_dir.py +0 -0
- {cloudinary_cli-1.11.1 → cloudinary_cli-1.12.0}/cloudinary_cli/samples/__init__.py +0 -0
- {cloudinary_cli-1.11.1 → cloudinary_cli-1.12.0}/cloudinary_cli/templates/html/media_library_widget +0 -0
- {cloudinary_cli-1.11.1 → cloudinary_cli-1.12.0}/cloudinary_cli/templates/html/product_gallery +0 -0
- {cloudinary_cli-1.11.1 → cloudinary_cli-1.12.0}/cloudinary_cli/templates/html/upload_widget +0 -0
- {cloudinary_cli-1.11.1 → cloudinary_cli-1.12.0}/cloudinary_cli/templates/html/video_player +0 -0
- {cloudinary_cli-1.11.1 → cloudinary_cli-1.12.0}/cloudinary_cli/templates/node/upload +0 -0
- {cloudinary_cli-1.11.1 → cloudinary_cli-1.12.0}/cloudinary_cli/templates/python/base +0 -0
- {cloudinary_cli-1.11.1 → cloudinary_cli-1.12.0}/cloudinary_cli/templates/python/explicit +0 -0
- {cloudinary_cli-1.11.1 → cloudinary_cli-1.12.0}/cloudinary_cli/templates/python/find_all_empty_folders +0 -0
- {cloudinary_cli-1.11.1 → cloudinary_cli-1.12.0}/cloudinary_cli/templates/python/upload +0 -0
- {cloudinary_cli-1.11.1 → cloudinary_cli-1.12.0}/cloudinary_cli/templates/ruby/upload +0 -0
- {cloudinary_cli-1.11.1 → cloudinary_cli-1.12.0}/cloudinary_cli/utils/__init__.py +0 -0
- {cloudinary_cli-1.11.1 → cloudinary_cli-1.12.0}/cloudinary_cli/utils/config_utils.py +0 -0
- {cloudinary_cli-1.11.1 → cloudinary_cli-1.12.0}/cloudinary_cli/utils/file_utils.py +0 -0
- {cloudinary_cli-1.11.1 → cloudinary_cli-1.12.0}/cloudinary_cli/utils/json_utils.py +0 -0
- {cloudinary_cli-1.11.1 → cloudinary_cli-1.12.0}/cloudinary_cli/utils/utils.py +0 -0
- {cloudinary_cli-1.11.1 → cloudinary_cli-1.12.0}/cloudinary_cli.egg-info/SOURCES.txt +0 -0
- {cloudinary_cli-1.11.1 → cloudinary_cli-1.12.0}/cloudinary_cli.egg-info/dependency_links.txt +0 -0
- {cloudinary_cli-1.11.1 → cloudinary_cli-1.12.0}/cloudinary_cli.egg-info/entry_points.txt +0 -0
- {cloudinary_cli-1.11.1 → cloudinary_cli-1.12.0}/cloudinary_cli.egg-info/not-zip-safe +0 -0
- {cloudinary_cli-1.11.1 → cloudinary_cli-1.12.0}/cloudinary_cli.egg-info/requires.txt +0 -0
- {cloudinary_cli-1.11.1 → cloudinary_cli-1.12.0}/cloudinary_cli.egg-info/top_level.txt +0 -0
- {cloudinary_cli-1.11.1 → cloudinary_cli-1.12.0}/requirements.txt +0 -0
- {cloudinary_cli-1.11.1 → cloudinary_cli-1.12.0}/setup.cfg +0 -0
- {cloudinary_cli-1.11.1 → cloudinary_cli-1.12.0}/setup.py +0 -0
- {cloudinary_cli-1.11.1 → cloudinary_cli-1.12.0}/test/__init__.py +0 -0
- {cloudinary_cli-1.11.1 → cloudinary_cli-1.12.0}/test/helper_test.py +0 -0
- {cloudinary_cli-1.11.1 → cloudinary_cli-1.12.0}/test/test_cli.py +0 -0
- {cloudinary_cli-1.11.1 → cloudinary_cli-1.12.0}/test/test_cli_api.py +0 -0
- {cloudinary_cli-1.11.1 → cloudinary_cli-1.12.0}/test/test_cli_config.py +0 -0
- {cloudinary_cli-1.11.1 → cloudinary_cli-1.12.0}/test/test_cli_samples.py +0 -0
- {cloudinary_cli-1.11.1 → cloudinary_cli-1.12.0}/test/test_cli_search_api.py +0 -0
- {cloudinary_cli-1.11.1 → cloudinary_cli-1.12.0}/test/test_cli_url.py +0 -0
- {cloudinary_cli-1.11.1 → cloudinary_cli-1.12.0}/test/test_cli_utils.py +0 -0
- {cloudinary_cli-1.11.1 → cloudinary_cli-1.12.0}/test/test_file_utils.py +0 -0
- {cloudinary_cli-1.11.1 → cloudinary_cli-1.12.0}/test/test_modules/__init__.py +0 -0
- {cloudinary_cli-1.11.1 → cloudinary_cli-1.12.0}/test/test_modules/test_cli_make.py +0 -0
- {cloudinary_cli-1.11.1 → cloudinary_cli-1.12.0}/test/test_modules/test_cli_sync.py +0 -0
- {cloudinary_cli-1.11.1 → cloudinary_cli-1.12.0}/test/test_modules/test_cli_upload_dir.py +0 -0
- {cloudinary_cli-1.11.1 → cloudinary_cli-1.12.0}/test/test_utils.py +0 -0
|
@@ -38,17 +38,19 @@ _SYNC_META_FILE = '.cld-sync'
|
|
|
38
38
|
help="Specify the batch size for deleting remote assets.")
|
|
39
39
|
@option("-fm", "--folder-mode", type=Choice(['fixed', 'dynamic'], case_sensitive=False),
|
|
40
40
|
help="Specify folder mode explicitly. By default uses cloud mode configured in your cloud.", hidden=True)
|
|
41
|
+
@option("-st", "--status", type=Choice(['all', 'active', 'pending'], case_sensitive=False),
|
|
42
|
+
help="Specify asset status. Server default: active.", default=None)
|
|
41
43
|
@option("-o", "--optional_parameter", multiple=True, nargs=2, help="Pass optional parameters as raw strings.")
|
|
42
44
|
@option("-O", "--optional_parameter_parsed", multiple=True, nargs=2,
|
|
43
45
|
help="Pass optional parameters as interpreted strings.")
|
|
44
46
|
@option("--dry-run", is_flag=True, help="Simulate the sync operation without making any changes.")
|
|
45
47
|
def sync(local_folder, cloudinary_folder, push, pull, include_hidden, concurrent_workers, force, keep_unique,
|
|
46
|
-
deletion_batch_size, folder_mode, optional_parameter, optional_parameter_parsed, dry_run):
|
|
48
|
+
deletion_batch_size, folder_mode, status, optional_parameter, optional_parameter_parsed, dry_run):
|
|
47
49
|
if push == pull:
|
|
48
50
|
raise UsageError("Please use either the '--push' OR '--pull' options")
|
|
49
51
|
|
|
50
52
|
sync_dir = SyncDir(local_folder, cloudinary_folder, include_hidden, concurrent_workers, force, keep_unique,
|
|
51
|
-
deletion_batch_size, folder_mode, optional_parameter, optional_parameter_parsed, dry_run)
|
|
53
|
+
deletion_batch_size, folder_mode, status, optional_parameter, optional_parameter_parsed, dry_run)
|
|
52
54
|
result = True
|
|
53
55
|
if push:
|
|
54
56
|
result = sync_dir.push()
|
|
@@ -63,7 +65,7 @@ def sync(local_folder, cloudinary_folder, push, pull, include_hidden, concurrent
|
|
|
63
65
|
|
|
64
66
|
class SyncDir:
|
|
65
67
|
def __init__(self, local_dir, remote_dir, include_hidden, concurrent_workers, force, keep_deleted,
|
|
66
|
-
deletion_batch_size, folder_mode, optional_parameter, optional_parameter_parsed, dry_run):
|
|
68
|
+
deletion_batch_size, folder_mode, status, optional_parameter, optional_parameter_parsed, dry_run):
|
|
67
69
|
self.local_dir = local_dir
|
|
68
70
|
self.remote_dir = remote_dir.strip('/')
|
|
69
71
|
self.user_friendly_remote_dir = self.remote_dir if self.remote_dir else '/'
|
|
@@ -100,7 +102,7 @@ class SyncDir:
|
|
|
100
102
|
logger.info(f"Cloudinary folder '{self.user_friendly_remote_dir}' does not exist "
|
|
101
103
|
f"({self.folder_mode} folder mode).")
|
|
102
104
|
else:
|
|
103
|
-
raw_remote_files = query_cld_folder(self.remote_dir, self.folder_mode)
|
|
105
|
+
raw_remote_files = query_cld_folder(self.remote_dir, self.folder_mode, status)
|
|
104
106
|
if len(raw_remote_files):
|
|
105
107
|
logger.info(
|
|
106
108
|
f"Found {len(raw_remote_files)} items in Cloudinary folder '{self.user_friendly_remote_dir}' "
|
|
@@ -21,17 +21,22 @@ PAGINATION_MAX_RESULTS = 500
|
|
|
21
21
|
_cursor_fields = {"resource": "derived_next_cursor"}
|
|
22
22
|
|
|
23
23
|
|
|
24
|
-
def query_cld_folder(folder, folder_mode):
|
|
24
|
+
def query_cld_folder(folder, folder_mode, status=None):
|
|
25
25
|
files = {}
|
|
26
26
|
|
|
27
27
|
folder = folder.strip('/') # omit redundant leading slash and duplicate trailing slashes in query
|
|
28
|
+
folder_key = "asset_folder" if folder_mode == "dynamic" else "folder"
|
|
28
29
|
folder_query = f"{folder}/*" if folder else "*"
|
|
30
|
+
status_value = "(active OR pending)" if status == "all" else status
|
|
31
|
+
status_query = f" AND status:{status_value}" if status_value else ""
|
|
29
32
|
|
|
30
|
-
|
|
33
|
+
search = Search().expression(f"{folder_key}:\"{folder_query}\"{status_query}").with_field("image_analysis").max_results(500)
|
|
34
|
+
|
|
35
|
+
logger.debug(f"Search expression: {search.to_json()}")
|
|
31
36
|
|
|
32
37
|
next_cursor = True
|
|
33
38
|
while next_cursor:
|
|
34
|
-
res =
|
|
39
|
+
res = search.execute()
|
|
35
40
|
|
|
36
41
|
for asset in res['resources']:
|
|
37
42
|
rel_path = _relative_path(asset, folder)
|
|
@@ -57,7 +62,7 @@ def query_cld_folder(folder, folder_mode):
|
|
|
57
62
|
}
|
|
58
63
|
# use := when switch to python 3.8
|
|
59
64
|
next_cursor = res.get('next_cursor')
|
|
60
|
-
|
|
65
|
+
search.next_cursor(next_cursor)
|
|
61
66
|
|
|
62
67
|
return files
|
|
63
68
|
|
|
@@ -77,7 +82,12 @@ def _display_path(asset):
|
|
|
77
82
|
if asset.get("display_name") is None:
|
|
78
83
|
return ""
|
|
79
84
|
|
|
80
|
-
|
|
85
|
+
if asset["resource_type"] == "raw" or asset["type"] == 'fetch':
|
|
86
|
+
normalized_display_name = asset["display_name"]
|
|
87
|
+
else:
|
|
88
|
+
normalized_display_name = ".".join(filter(None, [asset["display_name"], asset.get("format", None)]))
|
|
89
|
+
|
|
90
|
+
return "/".join([asset.get("asset_folder", ""), normalized_display_name])
|
|
81
91
|
|
|
82
92
|
|
|
83
93
|
def _relative_display_path(asset, folder):
|
|
@@ -128,7 +138,7 @@ def upload_file(file_path, options, uploaded=None, failed=None):
|
|
|
128
138
|
disp_path = _display_path(result)
|
|
129
139
|
if "batch_id" in result:
|
|
130
140
|
starting_msg = "Uploading"
|
|
131
|
-
disp_str = f"
|
|
141
|
+
disp_str = f"asynchronously with batch_id: {result['batch_id']}"
|
|
132
142
|
else:
|
|
133
143
|
starting_msg = "Successfully uploaded"
|
|
134
144
|
disp_str = f"as {result['public_id']}" if not disp_path \
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
__version__ = "1.12.0"
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
__version__ = "1.11.1"
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{cloudinary_cli-1.11.1 → cloudinary_cli-1.12.0}/cloudinary_cli/templates/html/media_library_widget
RENAMED
|
File without changes
|
{cloudinary_cli-1.11.1 → cloudinary_cli-1.12.0}/cloudinary_cli/templates/html/product_gallery
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{cloudinary_cli-1.11.1 → cloudinary_cli-1.12.0}/cloudinary_cli.egg-info/dependency_links.txt
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|