-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathUSAGE.txt
256 lines (204 loc) · 12.3 KB
/
USAGE.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
# Sample usage
# Import AEM from dampy
from dampy import AEM
# Create an AEM handle. Connects by default to localhost:4502 with admin/admin
aem = AEM()
# List all assets under a path
logging.debug ('List all assets under a path')
list = aem.dam.list('/content/dam/we-retail/en/products/apparel/shorts')
for asset in list:
logging.debug (asset)
# List all assets under a path and wirte it to default CSV file
logging.debug ('List all assets under a path and wirte it to default CSV file')
list = aem.dam.list('/content/dam/we-retail', True)
for asset in list:
logging.debug (asset)
# List all assets under a path and wite it to the CSV file specified
logging.debug ('List all assets under a path and wite it to the CSV file specified')
list = aem.dam.list('/content/dam/we-retail/en/products', True, 'output/all_products.csv')
for asset in list:
logging.debug (asset)
# Create the new folder
logging.debug ('Create the new folder')
status = aem.dam.createFolder('/content/dam/dampy/test/samples')
logging.debug('Status : '+str(status))
# Create the new folder, specifying a title
logging.debug ('Create the new folder, specifying a title')
status = aem.dam.createFolder('/content/dam/dampy/test/new_samples', 'My New Sample')
logging.debug('Status : '+str(status))
# Create the folder tree structure in DAM
logging.debug ('Create folder tree, based on local folder structure under the path /content/dam/dampy/test')
status = aem.dam.createFolderTree(path='/content/dam/dampy/test', srcDir='upload/Folder Tree Dir')
logging.debug('Status : '+str(status))
# Create the folder tree structure in DAM
logging.debug ('Create folder tree, based on entries in input text file')
status = aem.dam.createFolderTree( srcList='input/flist.txt')
logging.debug('Status : '+str(status))
# Create the folder tree structure in DAM
logging.debug ('Create folder tree, based on entries in input CSV file')
status = aem.dam.createFolderTree(srcList='input/Folder_tree.csv')
logging.debug('Status : '+str(status))
# Create the folder tree structure in DAM
logging.debug ('Create folder tree, based on input provided as a list')
status = aem.dam.createFolderTree(srcList=['/content/dam/dampy/test/Folder Tree LIST', '/content/dam/dampy/test/Folder Tree LIST/New EVENT'])
logging.debug('Status : '+str(status))
# Update the title of the folder to the new value provided
logging.debug ('Update the title of the folder to the new value provided')
status = aem.dam.updateFolderTitle(path='dampy/test/folder-tree-txt', newTitle='Root Folder from Text tree')
logging.debug('Status : '+str(status))
# Move the folder from the source path to the destination path
logging.debug ('Move the folder from the source path to the destination path')
status = aem.dam.move(srcPath='/content/dam/dampy/test/folder-tree-txt', destPath='/content/dam/dampy/test/folder-tree-list')
logging.debug('Status : '+str(status))
# Move the folder from the source path to the destination path with a new name
logging.debug ('Move the folder from the source path to the destination path with a new name')
status = aem.dam.move(srcPath='/content/dam/dampy/test/folder-tree-list/folder-tree-txt', destPath='/content/dam/dampy/test/folder-tree-list', newName='text-tree')
logging.debug('Status : '+str(status))
# Fetch the folder tree structure from DAM and write it to the default CSV file
logging.debug ('Fetch the folder tree structure from DAM and write it to CSV file ')
status = aem.dam.fetchFolderTree(path='/content/dam/dampy/test')
logging.debug('Status : '+str(status))
# Restructure the folders in DAM, moving and deleting folders and updating folder title based on input CSV file
logging.debug ('Restructure the folders in DAM, moving and deleting folders and updating folder title based on input CSV file')
status = aem.dam.restructure(inputCSV='input/restructure.csv')
logging.debug('Status : '+str(status))
# Fetch the folder tree structure from DAM and write it to the specified CSV file
logging.debug ('Fetch the folder tree structure from DAM and write it to CSV file ')
status = aem.dam.fetchFolderTree(path='/content/dam/dampy/test', csv_file='output/re_folder_tree.csv')
logging.debug('Status : '+str(status))
# Upload an asset. Uploads under /content/dam as path is not specified
logging.debug ('Upload an asset at the specified path')
status = aem.dam.uploadAsset('upload/Shorts_men.jpg')
logging.debug('Status : '+str(status))
# Upload an asset at the specified path - dampy/test/samples.
logging.debug ('Upload an asset at the specified path')
status = aem.dam.uploadAsset('upload/Shorts_men.jpg', '/content/dam/dampy/test/samples')
logging.debug('Status : '+str(status))
# Upload all assets in a local upload folder to DAM under dampy/test/new_samples. By default uploads all assets from the folder named 'upload'
logging.debug ('Upload all assets in a local folder to DAM')
status = aem.dam.uploadFolder(path='/content/dam/dampy/test/new_samples')
logging.debug('Status : '+str(status))
# Upload all assets in a local folder 'upload_test' to DAM under dampy/test/samples.
logging.debug ('Upload all assets in a local folder to DAM at the specified path')
status = aem.dam.uploadFolder(dir='upload/products', path='/content/dam/dampy/test/samples')
logging.debug('Status : '+str(status))
# Download an asset to a local folder. By default gets downloaded to a folder named 'download'
logging.debug ('Download an asset to a local folder')
status = aem.dam.downloadAsset('/content/dam/dampy/test/samples/Shorts_men.jpg')
logging.debug('Status : '+str(status))
# Download an asset to a local folder, retaining the DAM path in local. By default gets downloaded to a folder named 'download'
logging.debug ('Download an asset to a local folder, retaining the DAM path in local')
status = aem.dam.downloadAsset('/content/dam/dampy/test/samples/Shorts_men.jpg', retain_dam_path=True)
logging.debug('Status : '+str(status))
# Download all assets under a path. By default assets tree get downloaded under a folder named 'download'
logging.debug ('Download all assets under a path')
status = aem.dam.downloadFolder('/content/dam/dampy/test/samples')
logging.debug('Status : '+str(status))
# Download all assets under a DAM path to local, ignoring the DAM folder tree hierarchy. By default assets tree get downloaded under a folder named 'download'
logging.debug ('Download all assets under a DAM path to local, ignoring the DAM folder tree hierarchy')
status = aem.dam.downloadFolder('/content/dam/dampy/test/new_samples', 'download/test', False)
logging.debug('Status : '+str(status))
# Get Metadata of an asset
logging.debug ('Get Metadata of an asset')
metadata = aem.dam.metadata('/content/dam/dampy/test/samples/Shorts_men.jpg')
logging.debug(metadata)
# Extract default properties of assets under the given path and write it to a CSV file
logging.debug ('Extract properties of assets under the given path and write it to a CSV file')
status = aem.dam.xprops('/content/dam/dampy/test/samples')
logging.debug('Status : '+str(status))
# Extract specific properties of assets under the given path and write it to a CSV file
logging.debug ('Extract specific properties of assets under the given path and write it to a CSV file')
status = aem.dam.xprops('/content/dam/dampy/test', ['jcr:path', 'jcr:content/metadata/dc:title','jcr:content/metadata/jcr:title'])
logging.debug('Status : '+str(status))
# Update properties of assets based on an input CSV file
logging.debug ('Update properties of assets based on an input CSV file')
status = aem.dam.uprops()
logging.debug('Status : '+str(status))
# Update properties of assets based on an input CSV file
logging.debug ('Update properties of assets based on an input CSV file')
status = aem.dam.uprops('input/my_asset_update.csv')
logging.debug('Status : '+str(status))
# Update properties of assets based on an input CSV file
logging.debug ('Update properties of assets based on an input CSV file, including tag values')
status = aem.dam.uprops('input/asset_props_tags.csv')
logging.debug('Status : '+str(status))
# Extract specific properties of assets under the given path and write it to a CSV file
logging.debug ('Extract specific properties of assets under the given path and write it to a CSV file')
status = aem.dam.xprops('/content/dam/dampy/test', ['jcr:path', 'jcr:content/metadata/dc:title','jcr:content/metadata/jcr:title'], 'output/after_my_update.csv')
logging.debug('Status : '+str(status))
# Activate an asset
logging.debug ('Activate an asset')
status = aem.dam.activate('/content/dam/dampy/test/samples/Shorts_men.jpg')
logging.debug('Status : '+str(status))
# Activate a folder
logging.debug ('Activate a folder')
status = aem.dam.activate('/content/dam/dampy/test/samples')
logging.debug('Status : '+str(status))
# Activate a list of assets in text file
logging.debug ('Activate a list of assets in text file')
status = aem.dam.activateList(listSrc='input/alist.txt')
logging.debug('Status : '+str(status))
# Activate a list of assets in a CSV file
logging.debug ('Activate a list of assets in a CSV file')
status = aem.dam.activateList(listSrc='input/alist.csv')
logging.debug('Status : '+str(status))
# Activate a list of assets passed in as parameter
logging.debug ('Activate a list of assets passed in as parameter')
status = aem.dam.activateList(listSrc=['/content/dam/dampy/test/new_samples/activities/hiking-camping/alpinists-himalayas.jpg', '/content/dam/dampy/test/new_samples/activities/running/fitness-woman.jpg'])
logging.debug('Status : '+str(status))
# Deactivate an asset
logging.debug ('Deactivate an asset')
status = aem.dam.deactivate('/content/dam/dampy/test/samples/Shorts_men.jpg')
logging.debug('Status : '+str(status))
# Deactivate a folder
logging.debug ('Deactivate a folder')
status = aem.dam.deactivate('/content/dam/dampy/test/samples')
logging.debug('Status : '+str(status))
# Deactivate a list of assets in text file
logging.debug ('Deactivate a list of assets in text file')
status = aem.dam.deactivateList(listSrc='input/alist.txt')
logging.debug('Status : '+str(status))
# Deactivate a list of assets in a CSV file
logging.debug ('Deactivate a list of assets in a CSV file')
status = aem.dam.deactivateList(listSrc='input/alist.csv')
logging.debug('Status : '+str(status))
# Deactivate a list of assets passed in as parameter
logging.debug ('Deactivate a list of assets passed in as parameter')
status = aem.dam.deactivateList(listSrc=['/content/dam/dampy/test/new_samples/activities/hiking-camping/alpinists-himalayas.jpg', '/content/dam/dampy/test/new_samples/activities/running/fitness-woman.jpg'])
logging.debug('Status : '+str(status))
# Delete an asset
logging.debug ('Delete an asset')
status = aem.dam.delete('/content/dam/Shorts_men.jpg')
logging.debug('Status : '+str(status))
# Delete a list of assets in text file
logging.debug ('Delete a list of assets in text file')
status = aem.dam.deleteList(listSrc='input/alist.txt')
logging.debug('Status : '+str(status))
# Delete a list of assets in a CSV file
logging.debug ('Delete a list of assets in a CSV file')
status = aem.dam.deleteList(listSrc='input/alist.csv')
logging.debug('Status : '+str(status))
# Delete a list of assets passed in as parameter
logging.debug ('Delete a list of assets passed in as parameter')
status = aem.dam.deleteList(listSrc=['/content/dam/dampy/test/new_samples/activities/hiking-camping/alpinists-himalayas.jpg', '/content/dam/dampy/test/new_samples/activities/running/fitness-woman.jpg'])
logging.debug('Status : '+str(status))
# Delete an asset
logging.debug ('Delete a folder')
status = aem.dam.delete('/content/dam/dampy/test')
logging.debug('Status : '+str(status))
# Check if an asset exits in DAM and return the paths under which its present
logging.debug ('Check if an asset exits (positive) in DAM and return the paths under which its present ')
status = aem.dam.exists('upload/Shorts_men.jpg')
logging.debug('Status : '+str(status))
# Check if an asset exits in DAM and return the paths under which its present
logging.debug ('Check if an asset exits (negative) in DAM and return the paths under which its present ')
status = aem.dam.exists('upload/AEM6.1.jpg')
logging.debug('Status : '+str(status))
# List all duplicate assets in DAM under the given path
logging.debug ('List all duplicate assets in DAM under the given path')
status = aem.dam.duplicates('/content/dam/dampy')
logging.debug('Status : '+str(status))
# List all duplicate assets in DAM
logging.debug ('List all duplicate assets in DAM')
status = aem.dam.duplicates()
logging.debug('Status : '+str(status))