daselement_api.api

Documentation for the API

API works for both Python 2 & 3

Available in version 1.2+


Install

Download folder: daselement_api

In the background the CLI version of _das element_ is exectued.
Please link the correct executable das-element-cli in the file daselement_api/manager.py

from daselement_api import api as de
libraries = de.get_libraries()
for library, library_config_data in libraries.items():
   print(library)
   print(library_config_data)

The library information is taken from the config file that is set for the current workstation.
Either defined in the ~/.das-element/setup.ini file or by the environment variable DASELEMENT_CONFIG_PATH

  1#           __                   __                          __
  2#      ____/ /___ ______   ___  / /__  ____ ___  ___  ____  / /_
  3#     / __  / __ `/ ___/  / _ \/ / _ \/ __ `__ \/ _ \/ __ \/ __/
  4#    / /_/ / /_/ (__  )  /  __/ /  __/ / / / / /  __/ / / / /_
  5#    \__,_/\__,_/____/   \___/_/\___/_/ /_/ /_/\___/_/ /_/\__/
  6#
  7#                  Copyright (c) 2024 das element
  8'''
  9## Documentation for the API
 10
 11API works for both Python 2 & 3
 12
 13Available in version **1.2+**
 14
 15
 16---
 17
 18### Install
 19
 20[Download](https://github.com/das-element/python-api) folder: `daselement_api`
 21
 22In the background the CLI version of _das element_ is exectued.  
 23Please link the correct executable **das-element-cli** in the file **daselement_api/manager.py**
 24
 25```
 26from daselement_api import api as de
 27libraries = de.get_libraries()
 28for library, library_config_data in libraries.items():
 29   print(library)
 30   print(library_config_data)
 31```
 32
 33---
 34
 35The library information is taken from the config file that is set for the current workstation.  
 36Either defined in the `~/.das-element/setup.ini` file or by the environment variable `DASELEMENT_CONFIG_PATH`
 37
 38'''
 39
 40from .manager import execute_command, as_quoted_string, as_quoted_dict
 41
 42config = None
 43'''
 44Variabel to define a custom config file path (.conf)
 45
 46---
 47'''
 48
 49
 50def get_libraries():
 51    '''
 52    Get all libraries data for current config.
 53
 54    **Returns**:
 55    > - Dict[str, Dict]: *Key is the library file path (.lib) - Value is the library data*
 56
 57    **Example code**:
 58    ```
 59    from daselement_api import api as de
 60
 61    libraries = de.get_libraries()
 62    for library, library_config_data in libraries.items():
 63        print(library)
 64        print(library_config_data)
 65    ```
 66    '''
 67    command = ['--config', config] if config else []
 68    command += ['get-libraries']
 69    return execute_command(command)
 70
 71
 72def get_library_template_mappings(library_path):
 73    '''
 74    Get all template mappings data for library.
 75
 76    **Args**:
 77    > - **library_path** (str): *File path to the library file (.lib)*
 78
 79    **Returns**:
 80    > - List[Dict]
 81
 82    **Example code**:
 83    ```
 84    from daselement_api import api as de
 85
 86    library_path = '/some/path/das-element.lib'
 87
 88    template_mappings = de.get_library_template_mappings(library_path)
 89    for template_mapping in template_mappings:
 90        print(template_mapping)
 91    ```
 92
 93    **Example result**:
 94    `[{'key': 'copy & rename', 'value': {'extra': ['extra-job'], 'filmstrip': 'filmstrip', 'main': 'main', 'proxy': 'proxy mov', 'thumbnail': 'thumbnail'}}]`
 95    '''
 96    command = ['--config', config] if config else []
 97    command += [
 98        'get-library-template-mappings',
 99        as_quoted_string(library_path)
100    ]
101    return execute_command(command)
102
103
104def get_categories(library_path):
105    '''
106    Get all categories from the database for the library.
107
108    **Args**:
109    > - **library_path** (str): *File path to the library file (.lib)*
110
111    **Returns**:
112    > - List[Dict]
113
114    **Example code**:
115    ```
116    from daselement_api import api as de
117
118    library_path = '/some/path/das-element.lib'
119
120    categories = de.get_categories(library_path)
121    for category in categories:
122        print(category)
123    ```
124
125    **Example result**:
126    `[{'id': 'Q235544', 'type': 'default', 'name': 'flame', 'child_count': 5, 'child_counter': 5, 'parents': [{'description': 'rapid oxidation of a material; phenomenon that emits light and heat', 'id': 'Q3196', 'name': 'fire', 'synonyms': [{'language': 'en', 'value': 'fire'}, {'language': 'en', 'value': 'fires'}], 'type': 'default'}], 'children': [{'id': 'Q327954', 'name': 'torch'}], 'synonyms': [{'language': 'en', 'value': 'flame'}]}]`
127    '''
128    command = ['--config', config] if config else []
129    command += ['get-categories', as_quoted_string(library_path)]
130    return execute_command(command)
131
132
133def get_category(library_path, category_value):
134    '''
135    Get category entity from the database for the library.
136
137    **Args**:
138    > - **library_path** (str): *File path to the library file (.lib)*
139    > - **category_value** (str): *the ID ('Q3196') or name ('fire') of the category in the database*
140
141    **Returns**:
142    > - Dict[str, Union[str, int]]: *child_count: actual number of children - child_counter: increasing counter, even if children get deleted*
143
144
145
146    **Example code**:
147    ```
148    from daselement_api import api as de
149
150    library_path = '/some/path/das-element.lib'
151
152    category_entity = de.get_category(library_path, 'Q3196')
153    category_entity = de.get_category(library_path, 'fire')
154    ```
155
156    **Example result**:
157    `{"id": "Q3196", "type": "default", "name": "fire", "child_count": 130, "child_counter": 135}`
158    '''
159    command = ['--config', config] if config else []
160    command += [
161        'get-category',
162        as_quoted_string(library_path),
163        as_quoted_string(category_value)
164    ]
165    return execute_command(command)
166
167
168def get_tags(library_path):
169    '''
170    Get all tags from the database for the library.
171
172    **Args**:
173    > - **library_path** (str): *File path to the library file (.lib)*
174
175    **Returns**:
176    > - List[Dict]
177
178    **Example code**:
179    ```
180    from daselement_api import api as de
181
182    library_path = '/some/path/das-element.lib'
183
184    tags = de.get_tags(library_path)
185    for tag in tags:
186        print(tag)
187    ```
188
189    **Example result**:
190    `[{'id': 'Q235544', 'name': 'flame', 'type': 'default', 'elements_count': 3, 'synonyms': [{'language': 'en', 'value': 'flame'}]}]`
191    '''
192    command = ['--config', config] if config else []
193    command += ['get-tags', as_quoted_string(library_path)]
194    return execute_command(command)
195
196
197def get_tag(library_path, tag_value):
198    '''
199    Get tag entity from the database for the library.
200
201    **Args**:
202    > - **library_path** (str): *File path to the library file (.lib)*
203    > - **tag_value** (str): *the ID ('Q3196') or name ('fire') of the tag in the database*
204
205    **Returns**:
206    > - Dict[str, Union[str, int]]
207
208    **Example code**:
209    ```
210    from daselement_api import api as de
211
212    library_path = '/some/path/das-element.lib'
213
214    tag_entity = de.get_tag(library_path, 'Q3196')
215    tag_entity = de.get_tag(library_path, 'fire')
216    ```
217
218    **Example result**:
219    `{"id": "Q3196", "name": "fire", "type": "default", "elements_count": 130}`
220    '''
221    command = ['--config', config] if config else []
222    command += [
223        'get-tag',
224        as_quoted_string(library_path),
225        as_quoted_string(tag_value)
226    ]
227    return execute_command(command)
228
229
230def get_elements(library_path):
231    '''
232    Get all elements from the database for the library.
233
234    **Args**:
235    > - **library_path** (str): *File path to the library file (.lib)*
236
237    **Returns**:
238    > - List[Dict]
239
240    **Example code**:
241    ```
242    from daselement_api import api as de
243
244    library_path = '/some/path/das-element.lib'
245
246    elements = de.get_elements(library_path)
247    for element in elements:
248        print(element)
249        print(element.get('path'))
250    ```
251
252    **Example result**:
253    `[{"category": {"child_counter": 1,"description": "stick with a flaming end used as a source of light","id": "Q327954","name": "torch","type": "default"},"category_id": "Q327954","channel": 3,"colorspace": "sRGB","colorspace_source": "sRGB","created_at": "2022-05-16T08:26:52.854774","feature_id": 1,"frame_count": 1,"frame_first": 1,"frame_last": 1,"frame_rate": "","height": 5413,"id": 1,"media_type": "image","name": "fire_00001","number": "00001","path": "/mnt/library/fire/fire_00001/main_3342x5413_source/fire_00001.jpg","path_filmstrip": "/mnt/library/fire/fire_00001/filmstrip_11520x270_srgb/fire_00001.jpg","path_proxy": "/mnt/library/fire/fire_00001/proxy_1920x1080_srgb/fire_00001.mov","path_source": "/mnt/source/lication/some-image.jpg","path_thumbnail": "/mnt/library/fire/fire_00001/thumb_960x540_srgb/fire_00001.jpg","pixel_aspect": "1","popularity": "None","rating": "None","tags": [{"elements_count": 3,"id": "Q235544","name": "flame","type": "default"},{"elements_count": 56,"id": "Q3196","name": "fire","type": "default"},{"elements_count": 3,"id": "Q327954","name": "torch","type": "default"}],"uuid": "9947c549c6014a3ca831983275884051","width": 3342}]`
254    '''
255    command = ['--config', config] if config else []
256    command += ['get-elements', as_quoted_string(library_path)]
257    return execute_command(command)
258
259
260def get_element_by_id(library_path, element_id):
261    '''
262    Get element entity based on the **element ID** from the database for the library.
263
264    **Args**:
265    > - **library_path** (str): *File path to the library file (.lib)*
266    > - **element_id** (int): *Element ID in the database*
267
268    **Returns**:
269    > - Dict
270
271    **Example code**:
272    ```
273    from daselement_api import api as de
274
275    library_path = '/some/path/das-element.lib'
276    element_id = 1
277
278    element = de.get_element_by_id(library_path, element_id)
279    print(element)
280    print(element.get('path'))
281    ```
282
283    **Example result**:
284    `{"category": {"child_counter": 1,"description": "stick with a flaming end used as a source of light","id": "Q327954","name": "torch","type": "default"},"category_id": "Q327954","channel": 3,"colorspace": "sRGB","colorspace_source": "sRGB","created_at": "2022-05-16T08:26:52.854774","feature_id": 1,"frame_count": 1,"frame_first": 1,"frame_last": 1,"frame_rate": "","height": 5413,"id": 1,"media_type": "image","name": "fire_00001","number": "00001","path": "/mnt/library/fire/fire_00001/main_3342x5413_source/fire_00001.jpg","path_filmstrip": "/mnt/library/fire/fire_00001/filmstrip_11520x270_srgb/fire_00001.jpg","path_proxy": "/mnt/library/fire/fire_00001/proxy_1920x1080_srgb/fire_00001.mov","path_source": "/mnt/source/lication/some-image.jpg","path_thumbnail": "/mnt/library/fire/fire_00001/thumb_960x540_srgb/fire_00001.jpg","pixel_aspect": "1","popularity": "None","rating": "None","tags": [{"elements_count": 3,"id": "Q235544","name": "flame","type": "default"},{"elements_count": 56,"id": "Q3196","name": "fire","type": "default"},{"elements_count": 3,"id": "Q327954","name": "torch","type": "default"}],"uuid": "9947c549c6014a3ca831983275884051","width": 3342}`
285    '''
286    command = ['--config', config] if config else []
287    command += [
288        'get-element-by-id',
289        as_quoted_string(library_path), element_id
290    ]
291    return execute_command(command)
292
293
294def get_element_by_uuid(element_uuid, library_path=None):
295    '''
296    Get element entity based on the **element UUID** from the database for the library.
297    If no library path is provided, all libraries of the current config will be searched.
298
299    **Args**:
300    > - **library_path** (str): *[optional] File path to the library file (.lib)*
301    > - **element_uuid** (str): *Element UUID (unique ID) in the database*
302
303    **Returns**:
304    > - Dict
305
306    **Example code**:
307    ```
308    from daselement_api import api as de
309
310    element_uuid = '9947c549c6014a3ca831983275884051'
311    library_path = '/some/path/das-element.lib'  # optional
312
313    element = de.get_element_by_uuid(element_uuid, library_path=library_path)
314
315    # without the library path each linked library in the config file will searched
316    element = de.get_element_by_uuid(element_uuid)
317
318    print(element)
319    print(element.get('path'))
320    ```
321
322    **Example result**:
323    `{"category": {"child_counter": 1,"description": "stick with a flaming end used as a source of light","id": "Q327954","name": "torch","type": "default"},"category_id": "Q327954","channel": 3,"colorspace": "sRGB","colorspace_source": "sRGB","created_at": "2022-05-16T08:26:52.854774","feature_id": 1,"frame_count": 1,"frame_first": 1,"frame_last": 1,"frame_rate": "","height": 5413,"id": 1,"media_type": "image","name": "fire_00001","number": "00001","path": "/mnt/library/fire/fire_00001/main_3342x5413_source/fire_00001.jpg","path_filmstrip": "/mnt/library/fire/fire_00001/filmstrip_11520x270_srgb/fire_00001.jpg","path_proxy": "/mnt/library/fire/fire_00001/proxy_1920x1080_srgb/fire_00001.mov","path_source": "/mnt/source/lication/some-image.jpg","path_thumbnail": "/mnt/library/fire/fire_00001/thumb_960x540_srgb/fire_00001.jpg","pixel_aspect": "1","popularity": "None","rating": "None","tags": [{"elements_count": 3,"id": "Q235544","name": "flame","type": "default"},{"elements_count": 56,"id": "Q3196","name": "fire","type": "default"},{"elements_count": 3,"id": "Q327954","name": "torch","type": "default"}],"uuid": "9947c549c6014a3ca831983275884051","width": 3342}`
324    '''
325    command = ['--config', config] if config else []
326    command += ['get-element-by-uuid', element_uuid]
327    if library_path:
328        command += ['--library', as_quoted_string(library_path)]
329    return execute_command(command)
330
331
332def get_element_by_name(library_path, element_name):
333    '''
334    Get element entity based on the **element name** from the database for the library.
335
336    **Args**:
337    > - **library_path** (str): *File path to the library file (.lib)*
338    > - **element_name** (str): *Element name in the database*
339
340    **Returns**:
341    > - Dict
342
343    **Example code**:
344    ```
345    from daselement_api import api as de
346
347    library_path = '/some/path/das-element.lib'
348    element_name = 'fire_00001'
349
350    element = de.get_element_by_name(library_path, element_name)
351    print(element)
352    print(element.get('path'))
353    ```
354
355    **Example result**:
356    `{"category": {"child_counter": 1,"description": "stick with a flaming end used as a source of light","id": "Q327954","name": "torch","type": "default"},"category_id": "Q327954","channel": 3,"colorspace": "sRGB","colorspace_source": "sRGB","created_at": "2022-05-16T08:26:52.854774","feature_id": 1,"frame_count": 1,"frame_first": 1,"frame_last": 1,"frame_rate": "","height": 5413,"id": 1,"media_type": "image","name": "fire_00001","number": "00001","path": "/mnt/library/fire/fire_00001/main_3342x5413_source/fire_00001.jpg","path_filmstrip": "/mnt/library/fire/fire_00001/filmstrip_11520x270_srgb/fire_00001.jpg","path_proxy": "/mnt/library/fire/fire_00001/proxy_1920x1080_srgb/fire_00001.mov","path_source": "/mnt/source/lication/some-image.jpg","path_thumbnail": "/mnt/library/fire/fire_00001/thumb_960x540_srgb/fire_00001.jpg","pixel_aspect": "1","popularity": "None","rating": "None","tags": [{"elements_count": 3,"id": "Q235544","name": "flame","type": "default"},{"elements_count": 56,"id": "Q3196","name": "fire","type": "default"},{"elements_count": 3,"id": "Q327954","name": "torch","type": "default"}],"uuid": "9947c549c6014a3ca831983275884051","width": 3342}`
357    '''
358    command = ['--config', config] if config else []
359    command += [
360        'get-element-by-name',
361        as_quoted_string(library_path), element_name
362    ]
363    return execute_command(command)
364
365
366def update(library_path, entity_type, entity_id, data):
367    '''
368    Updates database entity with new data
369
370
371    **Args**:
372    > - **library_path** (str): *File path to the library file (.lib)*
373    > - **entity_type** (str): *Type of entity to update. Options: [Category, Element, Tag]*
374    > - **entity_id** (Union[str, int]): *the ID of the entity to update in the database*
375    > - **data** (Dict): *data to update. Dictionary with key/value pairs formated as JSON.*  
376        *Example:* `"{\\\"rating\\\": 3}"`
377
378    **Returns**:
379    > - Dict: *Entity of the updated entity*
380
381    **Example code**:
382    ```
383    from daselement_api import api as de
384
385    library_path = '/some/path/das-element.lib'
386    entity_type = 'Element'
387    entity_id = 23
388    new_data = {'category_id': 'Q327954',  # or: 'category': 'torch',
389                'tags': ['flame', 'fire', 'torch', 'something custom tag'],
390                'metadata': {'foo': 'bar'}}
391
392    entity = de.update(library_path, entity_type, entity_id, new_data)
393    print(entity)
394    print(entity.get('rating'))
395    ```
396
397    **Example result**:
398    `{"category": {"child_counter": 1,"description": "stick with a flaming end used as a source of light","id": "Q327954","name": "torch","type": "default"},"category_id": "Q327954","channel": 3,"colorspace": "sRGB","colorspace_source": "sRGB","created_at": "2022-05-16T08:26:52.854774","feature_id": 1,"frame_count": 1,"frame_first": 1,"frame_last": 1,"frame_rate": "","height": 5413,"id": 1,"media_type": "image","name": "fire_00001","number": "00001","path": "/mnt/library/fire/fire_00001/main_3342x5413_source/fire_00001.jpg","path_filmstrip": "/mnt/library/fire/fire_00001/filmstrip_11520x270_srgb/fire_00001.jpg","path_proxy": "/mnt/library/fire/fire_00001/proxy_1920x1080_srgb/fire_00001.mov","path_source": "/mnt/source/lication/some-image.jpg","path_thumbnail": "/mnt/library/fire/fire_00001/thumb_960x540_srgb/fire_00001.jpg","pixel_aspect": "1","popularity": "None","rating": "None","tags": [{"elements_count": 3,"id": "Q235544","name": "flame","type": "default"},{"elements_count": 56,"id": "Q3196","name": "fire","type": "default"},{"elements_count": 3,"id": "Q327954","name": "torch","type": "default"}, {"id": "something","name": "something custom tag", "type": "custom", "elements_count": 1}],"uuid": "9947c549c6014a3ca831983275884051","width": 3342}`
399
400    **Example command line command**:  
401    ##### Windows  
402    `das-element-cli.exe update C:\\mnt\\library\\das-element.lib element 1 "{\\\"rating\\\": 3}"`  
403    ##### Linux/MacOS  
404    `das-element-cli update /mnt/library/das-element.lib element 1 '{\"rating\": 3}'`
405    '''
406    command = ['--config', config] if config else []
407    command += [
408        'update',
409        as_quoted_string(library_path),
410        as_quoted_string(entity_type),
411        as_quoted_string(entity_id),
412        as_quoted_dict(data)
413    ]
414    return execute_command(command)
415
416
417def delete_element(element_uuid,
418                   delete_from_database=False,
419                   delete_from_disk=False,
420                   library_path=None):
421    '''
422    Deletes an element entity based on the **element UUID**.
423    The options are to delete the element data from the database, delete the element files on disk or delete from both the database and files on disk.
424
425    **Args**:
426    > - **element_uuid** (str): *Element UUID (unique ID) in the database*
427    > - **delete_from_database** (bool): *[optional] delete data from the database*
428    > - **delete_from_disk** (bool): *[optional] delete all element files from disk*
429    > - **library_path** (str): *[optional] File path to the library file (.lib)*
430
431    **Returns**:
432    > - bool
433
434    **Example code**:
435    ```
436    from daselement_api import api as de
437
438    element_uuid = '9947c549c6014a3ca831983275884051'
439    delete_from_database = True
440    delete_from_disk = True
441    library_path = '/some/path/das-element.lib'  # optional
442
443    de.delete_element(element_uuid, delete_from_database, delete_from_disk, library_path=library_path)
444
445    ```
446
447    **Example result**:
448    `true`
449    '''
450    command = ['--config', config] if config else []
451    command += [
452        'delete-element',
453        element_uuid,
454    ]
455    if delete_from_database:
456        command += ['--database']
457    if delete_from_disk:
458        command += ['--disk']
459    if library_path:
460        command += ['--library', as_quoted_string(library_path)]
461    return execute_command(command, cli_full=True)
462
463
464def ingest(library_path,
465           mapping,
466           path,
467           category,
468           path_thumbnail='',
469           path_proxy='',
470           tags=[]):
471    '''
472    Ingest a new element to the library
473
474    Ingesting a file sequence requires the path to be in a [fileseq.FileSequence notation](https://github.com/justinfx/fileseq#filesequence)  
475    Thank you to the developers of [fileseq](https://github.com/justinfx/fileseq)!
476
477    Example: `/some/folder/files.1001-1099#.exr`
478
479
480    **Args**:
481    > - **library_path** (str): *File path to the library file (.lib)*
482    > - **mapping** (str): *Name of the transcoding mapping used to ingest*
483    > - **path** (str): *File path to the new element*
484    > - **path_thumbnail** (str): *[optional] File path to custom thumbnail*
485    > - **path_proxy** (str): *[optional] File path to custom proxy. Movie file, OBJ or FBX*
486    > - **category** (str): *Category name of new element (can be WikiData-ID or human-readable text)*
487    > - **tags** (List[str]): *[optional] List of tags*
488
489    **Returns**:
490    > - Dict: *Element entity for the newly created element*
491
492    **Example code**:
493    ```
494    from daselement_api import api as de
495
496    library_path = '/some/path/das-element.lib'
497    mapping = 'copy & rename'
498    path = '/some/folder/files.1001-1099#.exr'
499    path_thumbnail = '/some/folder/custom_thumbnail.jpg'
500    path_proxy = '/some/folder/custom_proxy.mov'
501    category = 'Q235544'  #  or: 'flame'
502    tags = ['Q3196', 'foo', 'bar']
503
504    entity = de.ingest(library_path, mapping, path, category, path_thumbnail=path_thumbnail, path_proxy=path_proxy, tags=tags)
505    print(entity)
506    print(entity.get('path'))
507    ```
508
509    **Example result**:
510    `{"category": {"child_counter": 1,"description": "stick with a flaming end used as a source of light","id": "Q327954","name": "torch","type": "default"},"category_id": "Q327954","channel": 3,"colorspace": "sRGB","colorspace_source": "sRGB","created_at": "2022-05-16T08:26:52.854774","feature_id": 1,"frame_count": 1,"frame_first": 1,"frame_last": 1,"frame_rate": "","height": 5413,"id": 1,"media_type": "image","name": "fire_00001","number": "00001","path": "/mnt/library/fire/fire_00001/main_3342x5413_source/fire_00001.jpg","path_filmstrip": "/mnt/library/fire/fire_00001/filmstrip_11520x270_srgb/fire_00001.jpg","path_proxy": "/mnt/library/fire/fire_00001/proxy_1920x1080_srgb/fire_00001.mov","path_source": "/mnt/source/lication/some-image.jpg","path_thumbnail": "/mnt/library/fire/fire_00001/thumb_960x540_srgb/fire_00001.jpg","pixel_aspect": "1","popularity": "None","rating": "None","tags": [{"elements_count": 3,"id": "Q235544","name": "flame","type": "default"},{"elements_count": 56,"id": "Q3196","name": "fire","type": "default"},{"elements_count": 3,"id": "Q327954","name": "torch","type": "default"}],"uuid": "9947c549c6014a3ca831983275884051","width": 3342}`
511
512    **Example command line command**:
513    `das-element-cli ingest --library /mnt/library/das-element.lib --mapping "copy & rename" --path /some/file/path.1001-1099#.exr --path_thumbnail /some/file/custom_thumbnail.jpg --path_proxy /some/file/custom_proxy.mov --category Q235544 --tags Q3196,foo,bar`
514    '''
515    command = ['--config', config] if config else []
516    command += [
517        'ingest', '--library',
518        as_quoted_string(library_path), '--mapping',
519        as_quoted_string(mapping), '--path',
520        as_quoted_string(path), '--path_thumbnail',
521        as_quoted_string(path_thumbnail), '--path_proxy',
522        as_quoted_string(path_proxy), '--category',
523        as_quoted_string(category), '--tags',
524        as_quoted_string(','.join(tags))
525    ]
526    return execute_command(command, cli_full=True)
527
528
529def predict(path, model, top=2, filmstrip_frames=36):
530    '''
531    Predict the category for a give file path.
532
533    The give path can be a file or a directory.  
534    If a directory is provided, all sub-directories will be searched for files and sequences.
535
536
537    **Args**:
538
539    > - **model** (str): *Define a custom model file path (.wit)*
540    > - **filmstrip_frames** (int): [optional] *Number of frames to validated for a movie file or sequence. The higher the number, the better the result might be, but it also takes longer*
541    > - **top** (int): [optional] *Return the top X predictions*
542
543
544    **Returns**:
545    > - Dict[str, List[Dict]]: *Key is the file path. The value a list of predicted categories*
546
547
548    **Example result**:
549    `{"/some/file/path.1001-1099#.exr": [{"tag": "flame", "description": "visible, gaseous part of a fire", "id": "Q235544", "value": "Q235544", "parents": [{"description": "rapid oxidation of a material; phenomenon that emits light and heat", "id": "Q3196", "name": "fire", "synonyms": [{"language": "en", "value": "fire"}, {"language": "en", "value": "fires"}}]}]}`
550
551
552    **Example command line command**:
553    `das-element-cli predict --top=2 /some/file/path`
554
555    '''
556    command = ['predict', '--top', top, '--filmstrip_frames', filmstrip_frames]
557    command += ['--model', as_quoted_string(model)]
558    command += ['--filmstrip_frames', filmstrip_frames]
559    command += ['--top', top]
560    command += [as_quoted_string(path)]
561    return execute_command(command, cli_full=True)
562
563
564def get_paths_from_disk(path, as_sequence=True):
565    '''
566    Recursivly searches for files and sequences in a given directory. Since version 1.2.5
567
568    The give path can be a file or a directory.  
569    If a directory is provided, all sub-directories will be searched for files and sequences.
570
571
572    **Args**:
573
574    > - **as_sequence / as_single_files** (bool): [optional] defines if files with a sequential naming should be detected as a file sequence or individual files
575
576
577    **Returns**:
578    > - List[str]: *List of file paths found in the give directory*
579
580
581    **Example result**:
582    `["/some/file/path.1001-1099#.exr", "/other/path.mov"]`
583
584
585    **Example command line command**:
586    `das-element-cli get-paths-from-disk --as_sequence /some/file/path`
587
588    '''
589    command = ['get-paths-from-disk']
590
591    if as_sequence:
592        command += ['--as_sequence']
593    else:
594        command += ['--as_single_files']
595
596    command += [path]
597    return execute_command(command, cli_full=True)
598
599
600def get_meaningful_frame(path):
601    '''
602    Validate meaningful thumbnail frame number for movie file or image sequence
603
604
605    **Args**:
606
607    > - **path** (str): *file path to movie file or image sequence - single frame of a file sequence can be provided*
608
609
610    **Returns**:
611    > - int: *Returns frame number of meaningful thumbnail frame*
612
613
614    **Example result**:
615    `1042`
616
617
618    **Example command line command**:
619    `das-element-cli get-meaningful-frame /folder/some_file.mov`
620    `das-element-cli get-meaningful-frame /folder/frame_sequence.1001.exr`
621    `das-element-cli get-meaningful-frame /folder/frame_sequence.####.exr`
622    `das-element-cli get-meaningful-frame /folder/frame_sequence.%04d.exr`
623
624    '''
625    command = ['get-meaningful-frame', path]
626
627    return execute_command(command, cli_full=True)
628
629
630def render_element_proxies(element_uuid, mapping, library_path=None):
631    '''
632    Render the proxy files for an element based on a template mapping
633
634    If the library is provided it will directly try to get to element for that library.
635    Otherwise it tries to get the entity each library that's defined in the config.
636
637    **Args**:
638    > - **element_uuid** (str): *Element UUID (unique ID) in the database*
639    > - **mapping** (str): *name of the template mapping that gets rendered*
640    > - **library_path** (str): *[optional] File path to the library file (.lib)*
641
642    **Returns**:
643    > - bool: *Result of render jobs*
644
645
646    **Example result**:
647    `true`
648
649
650    **Example command line command**:
651    `das-element-cli render-element-proxies 9947c549c6014a3ca831983275884051 "render proxies" --library /some/path/das-element.lib`
652
653    '''
654    command = ['render-element-proxies', element_uuid, mapping]
655
656    if library_path:
657        command += ['--library', library_path]
658
659    return execute_command(command, cli_full=True)
config = None

Variabel to define a custom config file path (.conf)


def get_libraries()
51def get_libraries():
52    '''
53    Get all libraries data for current config.
54
55    **Returns**:
56    > - Dict[str, Dict]: *Key is the library file path (.lib) - Value is the library data*
57
58    **Example code**:
59    ```
60    from daselement_api import api as de
61
62    libraries = de.get_libraries()
63    for library, library_config_data in libraries.items():
64        print(library)
65        print(library_config_data)
66    ```
67    '''
68    command = ['--config', config] if config else []
69    command += ['get-libraries']
70    return execute_command(command)

Get all libraries data for current config.

Returns:

  • Dict[str, Dict]: Key is the library file path (.lib) - Value is the library data

Example code:

from daselement_api import api as de

libraries = de.get_libraries()
for library, library_config_data in libraries.items():
    print(library)
    print(library_config_data)
def get_library_template_mappings(library_path)
 73def get_library_template_mappings(library_path):
 74    '''
 75    Get all template mappings data for library.
 76
 77    **Args**:
 78    > - **library_path** (str): *File path to the library file (.lib)*
 79
 80    **Returns**:
 81    > - List[Dict]
 82
 83    **Example code**:
 84    ```
 85    from daselement_api import api as de
 86
 87    library_path = '/some/path/das-element.lib'
 88
 89    template_mappings = de.get_library_template_mappings(library_path)
 90    for template_mapping in template_mappings:
 91        print(template_mapping)
 92    ```
 93
 94    **Example result**:
 95    `[{'key': 'copy & rename', 'value': {'extra': ['extra-job'], 'filmstrip': 'filmstrip', 'main': 'main', 'proxy': 'proxy mov', 'thumbnail': 'thumbnail'}}]`
 96    '''
 97    command = ['--config', config] if config else []
 98    command += [
 99        'get-library-template-mappings',
100        as_quoted_string(library_path)
101    ]
102    return execute_command(command)

Get all template mappings data for library.

Args:

  • library_path (str): File path to the library file (.lib)

Returns:

  • List[Dict]

Example code:

from daselement_api import api as de

library_path = '/some/path/das-element.lib'

template_mappings = de.get_library_template_mappings(library_path)
for template_mapping in template_mappings:
    print(template_mapping)

Example result: [{'key': 'copy & rename', 'value': {'extra': ['extra-job'], 'filmstrip': 'filmstrip', 'main': 'main', 'proxy': 'proxy mov', 'thumbnail': 'thumbnail'}}]

def get_categories(library_path)
105def get_categories(library_path):
106    '''
107    Get all categories from the database for the library.
108
109    **Args**:
110    > - **library_path** (str): *File path to the library file (.lib)*
111
112    **Returns**:
113    > - List[Dict]
114
115    **Example code**:
116    ```
117    from daselement_api import api as de
118
119    library_path = '/some/path/das-element.lib'
120
121    categories = de.get_categories(library_path)
122    for category in categories:
123        print(category)
124    ```
125
126    **Example result**:
127    `[{'id': 'Q235544', 'type': 'default', 'name': 'flame', 'child_count': 5, 'child_counter': 5, 'parents': [{'description': 'rapid oxidation of a material; phenomenon that emits light and heat', 'id': 'Q3196', 'name': 'fire', 'synonyms': [{'language': 'en', 'value': 'fire'}, {'language': 'en', 'value': 'fires'}], 'type': 'default'}], 'children': [{'id': 'Q327954', 'name': 'torch'}], 'synonyms': [{'language': 'en', 'value': 'flame'}]}]`
128    '''
129    command = ['--config', config] if config else []
130    command += ['get-categories', as_quoted_string(library_path)]
131    return execute_command(command)

Get all categories from the database for the library.

Args:

  • library_path (str): File path to the library file (.lib)

Returns:

  • List[Dict]

Example code:

from daselement_api import api as de

library_path = '/some/path/das-element.lib'

categories = de.get_categories(library_path)
for category in categories:
    print(category)

Example result: [{'id': 'Q235544', 'type': 'default', 'name': 'flame', 'child_count': 5, 'child_counter': 5, 'parents': [{'description': 'rapid oxidation of a material; phenomenon that emits light and heat', 'id': 'Q3196', 'name': 'fire', 'synonyms': [{'language': 'en', 'value': 'fire'}, {'language': 'en', 'value': 'fires'}], 'type': 'default'}], 'children': [{'id': 'Q327954', 'name': 'torch'}], 'synonyms': [{'language': 'en', 'value': 'flame'}]}]

def get_category(library_path, category_value)
134def get_category(library_path, category_value):
135    '''
136    Get category entity from the database for the library.
137
138    **Args**:
139    > - **library_path** (str): *File path to the library file (.lib)*
140    > - **category_value** (str): *the ID ('Q3196') or name ('fire') of the category in the database*
141
142    **Returns**:
143    > - Dict[str, Union[str, int]]: *child_count: actual number of children - child_counter: increasing counter, even if children get deleted*
144
145
146
147    **Example code**:
148    ```
149    from daselement_api import api as de
150
151    library_path = '/some/path/das-element.lib'
152
153    category_entity = de.get_category(library_path, 'Q3196')
154    category_entity = de.get_category(library_path, 'fire')
155    ```
156
157    **Example result**:
158    `{"id": "Q3196", "type": "default", "name": "fire", "child_count": 130, "child_counter": 135}`
159    '''
160    command = ['--config', config] if config else []
161    command += [
162        'get-category',
163        as_quoted_string(library_path),
164        as_quoted_string(category_value)
165    ]
166    return execute_command(command)

Get category entity from the database for the library.

Args:

  • library_path (str): File path to the library file (.lib)
  • category_value (str): the ID ('Q3196') or name ('fire') of the category in the database

Returns:

  • Dict[str, Union[str, int]]: child_count: actual number of children - child_counter: increasing counter, even if children get deleted

Example code:

from daselement_api import api as de

library_path = '/some/path/das-element.lib'

category_entity = de.get_category(library_path, 'Q3196')
category_entity = de.get_category(library_path, 'fire')

Example result: {"id": "Q3196", "type": "default", "name": "fire", "child_count": 130, "child_counter": 135}

def get_tags(library_path)
169def get_tags(library_path):
170    '''
171    Get all tags from the database for the library.
172
173    **Args**:
174    > - **library_path** (str): *File path to the library file (.lib)*
175
176    **Returns**:
177    > - List[Dict]
178
179    **Example code**:
180    ```
181    from daselement_api import api as de
182
183    library_path = '/some/path/das-element.lib'
184
185    tags = de.get_tags(library_path)
186    for tag in tags:
187        print(tag)
188    ```
189
190    **Example result**:
191    `[{'id': 'Q235544', 'name': 'flame', 'type': 'default', 'elements_count': 3, 'synonyms': [{'language': 'en', 'value': 'flame'}]}]`
192    '''
193    command = ['--config', config] if config else []
194    command += ['get-tags', as_quoted_string(library_path)]
195    return execute_command(command)

Get all tags from the database for the library.

Args:

  • library_path (str): File path to the library file (.lib)

Returns:

  • List[Dict]

Example code:

from daselement_api import api as de

library_path = '/some/path/das-element.lib'

tags = de.get_tags(library_path)
for tag in tags:
    print(tag)

Example result: [{'id': 'Q235544', 'name': 'flame', 'type': 'default', 'elements_count': 3, 'synonyms': [{'language': 'en', 'value': 'flame'}]}]

def get_tag(library_path, tag_value)
198def get_tag(library_path, tag_value):
199    '''
200    Get tag entity from the database for the library.
201
202    **Args**:
203    > - **library_path** (str): *File path to the library file (.lib)*
204    > - **tag_value** (str): *the ID ('Q3196') or name ('fire') of the tag in the database*
205
206    **Returns**:
207    > - Dict[str, Union[str, int]]
208
209    **Example code**:
210    ```
211    from daselement_api import api as de
212
213    library_path = '/some/path/das-element.lib'
214
215    tag_entity = de.get_tag(library_path, 'Q3196')
216    tag_entity = de.get_tag(library_path, 'fire')
217    ```
218
219    **Example result**:
220    `{"id": "Q3196", "name": "fire", "type": "default", "elements_count": 130}`
221    '''
222    command = ['--config', config] if config else []
223    command += [
224        'get-tag',
225        as_quoted_string(library_path),
226        as_quoted_string(tag_value)
227    ]
228    return execute_command(command)

Get tag entity from the database for the library.

Args:

  • library_path (str): File path to the library file (.lib)
  • tag_value (str): the ID ('Q3196') or name ('fire') of the tag in the database

Returns:

  • Dict[str, Union[str, int]]

Example code:

from daselement_api import api as de

library_path = '/some/path/das-element.lib'

tag_entity = de.get_tag(library_path, 'Q3196')
tag_entity = de.get_tag(library_path, 'fire')

Example result: {"id": "Q3196", "name": "fire", "type": "default", "elements_count": 130}

def get_elements(library_path)
231def get_elements(library_path):
232    '''
233    Get all elements from the database for the library.
234
235    **Args**:
236    > - **library_path** (str): *File path to the library file (.lib)*
237
238    **Returns**:
239    > - List[Dict]
240
241    **Example code**:
242    ```
243    from daselement_api import api as de
244
245    library_path = '/some/path/das-element.lib'
246
247    elements = de.get_elements(library_path)
248    for element in elements:
249        print(element)
250        print(element.get('path'))
251    ```
252
253    **Example result**:
254    `[{"category": {"child_counter": 1,"description": "stick with a flaming end used as a source of light","id": "Q327954","name": "torch","type": "default"},"category_id": "Q327954","channel": 3,"colorspace": "sRGB","colorspace_source": "sRGB","created_at": "2022-05-16T08:26:52.854774","feature_id": 1,"frame_count": 1,"frame_first": 1,"frame_last": 1,"frame_rate": "","height": 5413,"id": 1,"media_type": "image","name": "fire_00001","number": "00001","path": "/mnt/library/fire/fire_00001/main_3342x5413_source/fire_00001.jpg","path_filmstrip": "/mnt/library/fire/fire_00001/filmstrip_11520x270_srgb/fire_00001.jpg","path_proxy": "/mnt/library/fire/fire_00001/proxy_1920x1080_srgb/fire_00001.mov","path_source": "/mnt/source/lication/some-image.jpg","path_thumbnail": "/mnt/library/fire/fire_00001/thumb_960x540_srgb/fire_00001.jpg","pixel_aspect": "1","popularity": "None","rating": "None","tags": [{"elements_count": 3,"id": "Q235544","name": "flame","type": "default"},{"elements_count": 56,"id": "Q3196","name": "fire","type": "default"},{"elements_count": 3,"id": "Q327954","name": "torch","type": "default"}],"uuid": "9947c549c6014a3ca831983275884051","width": 3342}]`
255    '''
256    command = ['--config', config] if config else []
257    command += ['get-elements', as_quoted_string(library_path)]
258    return execute_command(command)

Get all elements from the database for the library.

Args:

  • library_path (str): File path to the library file (.lib)

Returns:

  • List[Dict]

Example code:

from daselement_api import api as de

library_path = '/some/path/das-element.lib'

elements = de.get_elements(library_path)
for element in elements:
    print(element)
    print(element.get('path'))

Example result: [{"category": {"child_counter": 1,"description": "stick with a flaming end used as a source of light","id": "Q327954","name": "torch","type": "default"},"category_id": "Q327954","channel": 3,"colorspace": "sRGB","colorspace_source": "sRGB","created_at": "2022-05-16T08:26:52.854774","feature_id": 1,"frame_count": 1,"frame_first": 1,"frame_last": 1,"frame_rate": "","height": 5413,"id": 1,"media_type": "image","name": "fire_00001","number": "00001","path": "/mnt/library/fire/fire_00001/main_3342x5413_source/fire_00001.jpg","path_filmstrip": "/mnt/library/fire/fire_00001/filmstrip_11520x270_srgb/fire_00001.jpg","path_proxy": "/mnt/library/fire/fire_00001/proxy_1920x1080_srgb/fire_00001.mov","path_source": "/mnt/source/lication/some-image.jpg","path_thumbnail": "/mnt/library/fire/fire_00001/thumb_960x540_srgb/fire_00001.jpg","pixel_aspect": "1","popularity": "None","rating": "None","tags": [{"elements_count": 3,"id": "Q235544","name": "flame","type": "default"},{"elements_count": 56,"id": "Q3196","name": "fire","type": "default"},{"elements_count": 3,"id": "Q327954","name": "torch","type": "default"}],"uuid": "9947c549c6014a3ca831983275884051","width": 3342}]

def get_element_by_id(library_path, element_id)
261def get_element_by_id(library_path, element_id):
262    '''
263    Get element entity based on the **element ID** from the database for the library.
264
265    **Args**:
266    > - **library_path** (str): *File path to the library file (.lib)*
267    > - **element_id** (int): *Element ID in the database*
268
269    **Returns**:
270    > - Dict
271
272    **Example code**:
273    ```
274    from daselement_api import api as de
275
276    library_path = '/some/path/das-element.lib'
277    element_id = 1
278
279    element = de.get_element_by_id(library_path, element_id)
280    print(element)
281    print(element.get('path'))
282    ```
283
284    **Example result**:
285    `{"category": {"child_counter": 1,"description": "stick with a flaming end used as a source of light","id": "Q327954","name": "torch","type": "default"},"category_id": "Q327954","channel": 3,"colorspace": "sRGB","colorspace_source": "sRGB","created_at": "2022-05-16T08:26:52.854774","feature_id": 1,"frame_count": 1,"frame_first": 1,"frame_last": 1,"frame_rate": "","height": 5413,"id": 1,"media_type": "image","name": "fire_00001","number": "00001","path": "/mnt/library/fire/fire_00001/main_3342x5413_source/fire_00001.jpg","path_filmstrip": "/mnt/library/fire/fire_00001/filmstrip_11520x270_srgb/fire_00001.jpg","path_proxy": "/mnt/library/fire/fire_00001/proxy_1920x1080_srgb/fire_00001.mov","path_source": "/mnt/source/lication/some-image.jpg","path_thumbnail": "/mnt/library/fire/fire_00001/thumb_960x540_srgb/fire_00001.jpg","pixel_aspect": "1","popularity": "None","rating": "None","tags": [{"elements_count": 3,"id": "Q235544","name": "flame","type": "default"},{"elements_count": 56,"id": "Q3196","name": "fire","type": "default"},{"elements_count": 3,"id": "Q327954","name": "torch","type": "default"}],"uuid": "9947c549c6014a3ca831983275884051","width": 3342}`
286    '''
287    command = ['--config', config] if config else []
288    command += [
289        'get-element-by-id',
290        as_quoted_string(library_path), element_id
291    ]
292    return execute_command(command)

Get element entity based on the element ID from the database for the library.

Args:

  • library_path (str): File path to the library file (.lib)
  • element_id (int): Element ID in the database

Returns:

  • Dict

Example code:

from daselement_api import api as de

library_path = '/some/path/das-element.lib'
element_id = 1

element = de.get_element_by_id(library_path, element_id)
print(element)
print(element.get('path'))

Example result: {"category": {"child_counter": 1,"description": "stick with a flaming end used as a source of light","id": "Q327954","name": "torch","type": "default"},"category_id": "Q327954","channel": 3,"colorspace": "sRGB","colorspace_source": "sRGB","created_at": "2022-05-16T08:26:52.854774","feature_id": 1,"frame_count": 1,"frame_first": 1,"frame_last": 1,"frame_rate": "","height": 5413,"id": 1,"media_type": "image","name": "fire_00001","number": "00001","path": "/mnt/library/fire/fire_00001/main_3342x5413_source/fire_00001.jpg","path_filmstrip": "/mnt/library/fire/fire_00001/filmstrip_11520x270_srgb/fire_00001.jpg","path_proxy": "/mnt/library/fire/fire_00001/proxy_1920x1080_srgb/fire_00001.mov","path_source": "/mnt/source/lication/some-image.jpg","path_thumbnail": "/mnt/library/fire/fire_00001/thumb_960x540_srgb/fire_00001.jpg","pixel_aspect": "1","popularity": "None","rating": "None","tags": [{"elements_count": 3,"id": "Q235544","name": "flame","type": "default"},{"elements_count": 56,"id": "Q3196","name": "fire","type": "default"},{"elements_count": 3,"id": "Q327954","name": "torch","type": "default"}],"uuid": "9947c549c6014a3ca831983275884051","width": 3342}

def get_element_by_uuid(element_uuid, library_path=None)
295def get_element_by_uuid(element_uuid, library_path=None):
296    '''
297    Get element entity based on the **element UUID** from the database for the library.
298    If no library path is provided, all libraries of the current config will be searched.
299
300    **Args**:
301    > - **library_path** (str): *[optional] File path to the library file (.lib)*
302    > - **element_uuid** (str): *Element UUID (unique ID) in the database*
303
304    **Returns**:
305    > - Dict
306
307    **Example code**:
308    ```
309    from daselement_api import api as de
310
311    element_uuid = '9947c549c6014a3ca831983275884051'
312    library_path = '/some/path/das-element.lib'  # optional
313
314    element = de.get_element_by_uuid(element_uuid, library_path=library_path)
315
316    # without the library path each linked library in the config file will searched
317    element = de.get_element_by_uuid(element_uuid)
318
319    print(element)
320    print(element.get('path'))
321    ```
322
323    **Example result**:
324    `{"category": {"child_counter": 1,"description": "stick with a flaming end used as a source of light","id": "Q327954","name": "torch","type": "default"},"category_id": "Q327954","channel": 3,"colorspace": "sRGB","colorspace_source": "sRGB","created_at": "2022-05-16T08:26:52.854774","feature_id": 1,"frame_count": 1,"frame_first": 1,"frame_last": 1,"frame_rate": "","height": 5413,"id": 1,"media_type": "image","name": "fire_00001","number": "00001","path": "/mnt/library/fire/fire_00001/main_3342x5413_source/fire_00001.jpg","path_filmstrip": "/mnt/library/fire/fire_00001/filmstrip_11520x270_srgb/fire_00001.jpg","path_proxy": "/mnt/library/fire/fire_00001/proxy_1920x1080_srgb/fire_00001.mov","path_source": "/mnt/source/lication/some-image.jpg","path_thumbnail": "/mnt/library/fire/fire_00001/thumb_960x540_srgb/fire_00001.jpg","pixel_aspect": "1","popularity": "None","rating": "None","tags": [{"elements_count": 3,"id": "Q235544","name": "flame","type": "default"},{"elements_count": 56,"id": "Q3196","name": "fire","type": "default"},{"elements_count": 3,"id": "Q327954","name": "torch","type": "default"}],"uuid": "9947c549c6014a3ca831983275884051","width": 3342}`
325    '''
326    command = ['--config', config] if config else []
327    command += ['get-element-by-uuid', element_uuid]
328    if library_path:
329        command += ['--library', as_quoted_string(library_path)]
330    return execute_command(command)

Get element entity based on the element UUID from the database for the library. If no library path is provided, all libraries of the current config will be searched.

Args:

  • library_path (str): [optional] File path to the library file (.lib)
  • element_uuid (str): Element UUID (unique ID) in the database

Returns:

  • Dict

Example code:

from daselement_api import api as de

element_uuid = '9947c549c6014a3ca831983275884051'
library_path = '/some/path/das-element.lib'  # optional

element = de.get_element_by_uuid(element_uuid, library_path=library_path)

# without the library path each linked library in the config file will searched
element = de.get_element_by_uuid(element_uuid)

print(element)
print(element.get('path'))

Example result: {"category": {"child_counter": 1,"description": "stick with a flaming end used as a source of light","id": "Q327954","name": "torch","type": "default"},"category_id": "Q327954","channel": 3,"colorspace": "sRGB","colorspace_source": "sRGB","created_at": "2022-05-16T08:26:52.854774","feature_id": 1,"frame_count": 1,"frame_first": 1,"frame_last": 1,"frame_rate": "","height": 5413,"id": 1,"media_type": "image","name": "fire_00001","number": "00001","path": "/mnt/library/fire/fire_00001/main_3342x5413_source/fire_00001.jpg","path_filmstrip": "/mnt/library/fire/fire_00001/filmstrip_11520x270_srgb/fire_00001.jpg","path_proxy": "/mnt/library/fire/fire_00001/proxy_1920x1080_srgb/fire_00001.mov","path_source": "/mnt/source/lication/some-image.jpg","path_thumbnail": "/mnt/library/fire/fire_00001/thumb_960x540_srgb/fire_00001.jpg","pixel_aspect": "1","popularity": "None","rating": "None","tags": [{"elements_count": 3,"id": "Q235544","name": "flame","type": "default"},{"elements_count": 56,"id": "Q3196","name": "fire","type": "default"},{"elements_count": 3,"id": "Q327954","name": "torch","type": "default"}],"uuid": "9947c549c6014a3ca831983275884051","width": 3342}

def get_element_by_name(library_path, element_name)
333def get_element_by_name(library_path, element_name):
334    '''
335    Get element entity based on the **element name** from the database for the library.
336
337    **Args**:
338    > - **library_path** (str): *File path to the library file (.lib)*
339    > - **element_name** (str): *Element name in the database*
340
341    **Returns**:
342    > - Dict
343
344    **Example code**:
345    ```
346    from daselement_api import api as de
347
348    library_path = '/some/path/das-element.lib'
349    element_name = 'fire_00001'
350
351    element = de.get_element_by_name(library_path, element_name)
352    print(element)
353    print(element.get('path'))
354    ```
355
356    **Example result**:
357    `{"category": {"child_counter": 1,"description": "stick with a flaming end used as a source of light","id": "Q327954","name": "torch","type": "default"},"category_id": "Q327954","channel": 3,"colorspace": "sRGB","colorspace_source": "sRGB","created_at": "2022-05-16T08:26:52.854774","feature_id": 1,"frame_count": 1,"frame_first": 1,"frame_last": 1,"frame_rate": "","height": 5413,"id": 1,"media_type": "image","name": "fire_00001","number": "00001","path": "/mnt/library/fire/fire_00001/main_3342x5413_source/fire_00001.jpg","path_filmstrip": "/mnt/library/fire/fire_00001/filmstrip_11520x270_srgb/fire_00001.jpg","path_proxy": "/mnt/library/fire/fire_00001/proxy_1920x1080_srgb/fire_00001.mov","path_source": "/mnt/source/lication/some-image.jpg","path_thumbnail": "/mnt/library/fire/fire_00001/thumb_960x540_srgb/fire_00001.jpg","pixel_aspect": "1","popularity": "None","rating": "None","tags": [{"elements_count": 3,"id": "Q235544","name": "flame","type": "default"},{"elements_count": 56,"id": "Q3196","name": "fire","type": "default"},{"elements_count": 3,"id": "Q327954","name": "torch","type": "default"}],"uuid": "9947c549c6014a3ca831983275884051","width": 3342}`
358    '''
359    command = ['--config', config] if config else []
360    command += [
361        'get-element-by-name',
362        as_quoted_string(library_path), element_name
363    ]
364    return execute_command(command)

Get element entity based on the element name from the database for the library.

Args:

  • library_path (str): File path to the library file (.lib)
  • element_name (str): Element name in the database

Returns:

  • Dict

Example code:

from daselement_api import api as de

library_path = '/some/path/das-element.lib'
element_name = 'fire_00001'

element = de.get_element_by_name(library_path, element_name)
print(element)
print(element.get('path'))

Example result: {"category": {"child_counter": 1,"description": "stick with a flaming end used as a source of light","id": "Q327954","name": "torch","type": "default"},"category_id": "Q327954","channel": 3,"colorspace": "sRGB","colorspace_source": "sRGB","created_at": "2022-05-16T08:26:52.854774","feature_id": 1,"frame_count": 1,"frame_first": 1,"frame_last": 1,"frame_rate": "","height": 5413,"id": 1,"media_type": "image","name": "fire_00001","number": "00001","path": "/mnt/library/fire/fire_00001/main_3342x5413_source/fire_00001.jpg","path_filmstrip": "/mnt/library/fire/fire_00001/filmstrip_11520x270_srgb/fire_00001.jpg","path_proxy": "/mnt/library/fire/fire_00001/proxy_1920x1080_srgb/fire_00001.mov","path_source": "/mnt/source/lication/some-image.jpg","path_thumbnail": "/mnt/library/fire/fire_00001/thumb_960x540_srgb/fire_00001.jpg","pixel_aspect": "1","popularity": "None","rating": "None","tags": [{"elements_count": 3,"id": "Q235544","name": "flame","type": "default"},{"elements_count": 56,"id": "Q3196","name": "fire","type": "default"},{"elements_count": 3,"id": "Q327954","name": "torch","type": "default"}],"uuid": "9947c549c6014a3ca831983275884051","width": 3342}

def update(library_path, entity_type, entity_id, data)
367def update(library_path, entity_type, entity_id, data):
368    '''
369    Updates database entity with new data
370
371
372    **Args**:
373    > - **library_path** (str): *File path to the library file (.lib)*
374    > - **entity_type** (str): *Type of entity to update. Options: [Category, Element, Tag]*
375    > - **entity_id** (Union[str, int]): *the ID of the entity to update in the database*
376    > - **data** (Dict): *data to update. Dictionary with key/value pairs formated as JSON.*  
377        *Example:* `"{\\\"rating\\\": 3}"`
378
379    **Returns**:
380    > - Dict: *Entity of the updated entity*
381
382    **Example code**:
383    ```
384    from daselement_api import api as de
385
386    library_path = '/some/path/das-element.lib'
387    entity_type = 'Element'
388    entity_id = 23
389    new_data = {'category_id': 'Q327954',  # or: 'category': 'torch',
390                'tags': ['flame', 'fire', 'torch', 'something custom tag'],
391                'metadata': {'foo': 'bar'}}
392
393    entity = de.update(library_path, entity_type, entity_id, new_data)
394    print(entity)
395    print(entity.get('rating'))
396    ```
397
398    **Example result**:
399    `{"category": {"child_counter": 1,"description": "stick with a flaming end used as a source of light","id": "Q327954","name": "torch","type": "default"},"category_id": "Q327954","channel": 3,"colorspace": "sRGB","colorspace_source": "sRGB","created_at": "2022-05-16T08:26:52.854774","feature_id": 1,"frame_count": 1,"frame_first": 1,"frame_last": 1,"frame_rate": "","height": 5413,"id": 1,"media_type": "image","name": "fire_00001","number": "00001","path": "/mnt/library/fire/fire_00001/main_3342x5413_source/fire_00001.jpg","path_filmstrip": "/mnt/library/fire/fire_00001/filmstrip_11520x270_srgb/fire_00001.jpg","path_proxy": "/mnt/library/fire/fire_00001/proxy_1920x1080_srgb/fire_00001.mov","path_source": "/mnt/source/lication/some-image.jpg","path_thumbnail": "/mnt/library/fire/fire_00001/thumb_960x540_srgb/fire_00001.jpg","pixel_aspect": "1","popularity": "None","rating": "None","tags": [{"elements_count": 3,"id": "Q235544","name": "flame","type": "default"},{"elements_count": 56,"id": "Q3196","name": "fire","type": "default"},{"elements_count": 3,"id": "Q327954","name": "torch","type": "default"}, {"id": "something","name": "something custom tag", "type": "custom", "elements_count": 1}],"uuid": "9947c549c6014a3ca831983275884051","width": 3342}`
400
401    **Example command line command**:  
402    ##### Windows  
403    `das-element-cli.exe update C:\\mnt\\library\\das-element.lib element 1 "{\\\"rating\\\": 3}"`  
404    ##### Linux/MacOS  
405    `das-element-cli update /mnt/library/das-element.lib element 1 '{\"rating\": 3}'`
406    '''
407    command = ['--config', config] if config else []
408    command += [
409        'update',
410        as_quoted_string(library_path),
411        as_quoted_string(entity_type),
412        as_quoted_string(entity_id),
413        as_quoted_dict(data)
414    ]
415    return execute_command(command)

Updates database entity with new data

Args:

  • library_path (str): File path to the library file (.lib)
  • entity_type (str): Type of entity to update. Options: [Category, Element, Tag]
  • entity_id (Union[str, int]): the ID of the entity to update in the database
  • data (Dict): data to update. Dictionary with key/value pairs formated as JSON.
    Example: "{\"rating\": 3}"

Returns:

  • Dict: Entity of the updated entity

Example code:

from daselement_api import api as de

library_path = '/some/path/das-element.lib'
entity_type = 'Element'
entity_id = 23
new_data = {'category_id': 'Q327954',  # or: 'category': 'torch',
            'tags': ['flame', 'fire', 'torch', 'something custom tag'],
            'metadata': {'foo': 'bar'}}

entity = de.update(library_path, entity_type, entity_id, new_data)
print(entity)
print(entity.get('rating'))

Example result: {"category": {"child_counter": 1,"description": "stick with a flaming end used as a source of light","id": "Q327954","name": "torch","type": "default"},"category_id": "Q327954","channel": 3,"colorspace": "sRGB","colorspace_source": "sRGB","created_at": "2022-05-16T08:26:52.854774","feature_id": 1,"frame_count": 1,"frame_first": 1,"frame_last": 1,"frame_rate": "","height": 5413,"id": 1,"media_type": "image","name": "fire_00001","number": "00001","path": "/mnt/library/fire/fire_00001/main_3342x5413_source/fire_00001.jpg","path_filmstrip": "/mnt/library/fire/fire_00001/filmstrip_11520x270_srgb/fire_00001.jpg","path_proxy": "/mnt/library/fire/fire_00001/proxy_1920x1080_srgb/fire_00001.mov","path_source": "/mnt/source/lication/some-image.jpg","path_thumbnail": "/mnt/library/fire/fire_00001/thumb_960x540_srgb/fire_00001.jpg","pixel_aspect": "1","popularity": "None","rating": "None","tags": [{"elements_count": 3,"id": "Q235544","name": "flame","type": "default"},{"elements_count": 56,"id": "Q3196","name": "fire","type": "default"},{"elements_count": 3,"id": "Q327954","name": "torch","type": "default"}, {"id": "something","name": "something custom tag", "type": "custom", "elements_count": 1}],"uuid": "9947c549c6014a3ca831983275884051","width": 3342}

Example command line command:

Windows

das-element-cli.exe update C:\mnt\library\das-element.lib element 1 "{\"rating\": 3}"

Linux/MacOS

das-element-cli update /mnt/library/das-element.lib element 1 '{"rating": 3}'

def delete_element( element_uuid, delete_from_database=False, delete_from_disk=False, library_path=None)
418def delete_element(element_uuid,
419                   delete_from_database=False,
420                   delete_from_disk=False,
421                   library_path=None):
422    '''
423    Deletes an element entity based on the **element UUID**.
424    The options are to delete the element data from the database, delete the element files on disk or delete from both the database and files on disk.
425
426    **Args**:
427    > - **element_uuid** (str): *Element UUID (unique ID) in the database*
428    > - **delete_from_database** (bool): *[optional] delete data from the database*
429    > - **delete_from_disk** (bool): *[optional] delete all element files from disk*
430    > - **library_path** (str): *[optional] File path to the library file (.lib)*
431
432    **Returns**:
433    > - bool
434
435    **Example code**:
436    ```
437    from daselement_api import api as de
438
439    element_uuid = '9947c549c6014a3ca831983275884051'
440    delete_from_database = True
441    delete_from_disk = True
442    library_path = '/some/path/das-element.lib'  # optional
443
444    de.delete_element(element_uuid, delete_from_database, delete_from_disk, library_path=library_path)
445
446    ```
447
448    **Example result**:
449    `true`
450    '''
451    command = ['--config', config] if config else []
452    command += [
453        'delete-element',
454        element_uuid,
455    ]
456    if delete_from_database:
457        command += ['--database']
458    if delete_from_disk:
459        command += ['--disk']
460    if library_path:
461        command += ['--library', as_quoted_string(library_path)]
462    return execute_command(command, cli_full=True)

Deletes an element entity based on the element UUID. The options are to delete the element data from the database, delete the element files on disk or delete from both the database and files on disk.

Args:

  • element_uuid (str): Element UUID (unique ID) in the database
  • delete_from_database (bool): [optional] delete data from the database
  • delete_from_disk (bool): [optional] delete all element files from disk
  • library_path (str): [optional] File path to the library file (.lib)

Returns:

  • bool

Example code:

from daselement_api import api as de

element_uuid = '9947c549c6014a3ca831983275884051'
delete_from_database = True
delete_from_disk = True
library_path = '/some/path/das-element.lib'  # optional

de.delete_element(element_uuid, delete_from_database, delete_from_disk, library_path=library_path)

Example result: true

def ingest( library_path, mapping, path, category, path_thumbnail='', path_proxy='', tags=[])
465def ingest(library_path,
466           mapping,
467           path,
468           category,
469           path_thumbnail='',
470           path_proxy='',
471           tags=[]):
472    '''
473    Ingest a new element to the library
474
475    Ingesting a file sequence requires the path to be in a [fileseq.FileSequence notation](https://github.com/justinfx/fileseq#filesequence)  
476    Thank you to the developers of [fileseq](https://github.com/justinfx/fileseq)!
477
478    Example: `/some/folder/files.1001-1099#.exr`
479
480
481    **Args**:
482    > - **library_path** (str): *File path to the library file (.lib)*
483    > - **mapping** (str): *Name of the transcoding mapping used to ingest*
484    > - **path** (str): *File path to the new element*
485    > - **path_thumbnail** (str): *[optional] File path to custom thumbnail*
486    > - **path_proxy** (str): *[optional] File path to custom proxy. Movie file, OBJ or FBX*
487    > - **category** (str): *Category name of new element (can be WikiData-ID or human-readable text)*
488    > - **tags** (List[str]): *[optional] List of tags*
489
490    **Returns**:
491    > - Dict: *Element entity for the newly created element*
492
493    **Example code**:
494    ```
495    from daselement_api import api as de
496
497    library_path = '/some/path/das-element.lib'
498    mapping = 'copy & rename'
499    path = '/some/folder/files.1001-1099#.exr'
500    path_thumbnail = '/some/folder/custom_thumbnail.jpg'
501    path_proxy = '/some/folder/custom_proxy.mov'
502    category = 'Q235544'  #  or: 'flame'
503    tags = ['Q3196', 'foo', 'bar']
504
505    entity = de.ingest(library_path, mapping, path, category, path_thumbnail=path_thumbnail, path_proxy=path_proxy, tags=tags)
506    print(entity)
507    print(entity.get('path'))
508    ```
509
510    **Example result**:
511    `{"category": {"child_counter": 1,"description": "stick with a flaming end used as a source of light","id": "Q327954","name": "torch","type": "default"},"category_id": "Q327954","channel": 3,"colorspace": "sRGB","colorspace_source": "sRGB","created_at": "2022-05-16T08:26:52.854774","feature_id": 1,"frame_count": 1,"frame_first": 1,"frame_last": 1,"frame_rate": "","height": 5413,"id": 1,"media_type": "image","name": "fire_00001","number": "00001","path": "/mnt/library/fire/fire_00001/main_3342x5413_source/fire_00001.jpg","path_filmstrip": "/mnt/library/fire/fire_00001/filmstrip_11520x270_srgb/fire_00001.jpg","path_proxy": "/mnt/library/fire/fire_00001/proxy_1920x1080_srgb/fire_00001.mov","path_source": "/mnt/source/lication/some-image.jpg","path_thumbnail": "/mnt/library/fire/fire_00001/thumb_960x540_srgb/fire_00001.jpg","pixel_aspect": "1","popularity": "None","rating": "None","tags": [{"elements_count": 3,"id": "Q235544","name": "flame","type": "default"},{"elements_count": 56,"id": "Q3196","name": "fire","type": "default"},{"elements_count": 3,"id": "Q327954","name": "torch","type": "default"}],"uuid": "9947c549c6014a3ca831983275884051","width": 3342}`
512
513    **Example command line command**:
514    `das-element-cli ingest --library /mnt/library/das-element.lib --mapping "copy & rename" --path /some/file/path.1001-1099#.exr --path_thumbnail /some/file/custom_thumbnail.jpg --path_proxy /some/file/custom_proxy.mov --category Q235544 --tags Q3196,foo,bar`
515    '''
516    command = ['--config', config] if config else []
517    command += [
518        'ingest', '--library',
519        as_quoted_string(library_path), '--mapping',
520        as_quoted_string(mapping), '--path',
521        as_quoted_string(path), '--path_thumbnail',
522        as_quoted_string(path_thumbnail), '--path_proxy',
523        as_quoted_string(path_proxy), '--category',
524        as_quoted_string(category), '--tags',
525        as_quoted_string(','.join(tags))
526    ]
527    return execute_command(command, cli_full=True)

Ingest a new element to the library

Ingesting a file sequence requires the path to be in a fileseq.FileSequence notation
Thank you to the developers of fileseq!

Example: /some/folder/files.1001-1099#.exr

Args:

  • library_path (str): File path to the library file (.lib)
  • mapping (str): Name of the transcoding mapping used to ingest
  • path (str): File path to the new element
  • path_thumbnail (str): [optional] File path to custom thumbnail
  • path_proxy (str): [optional] File path to custom proxy. Movie file, OBJ or FBX
  • category (str): Category name of new element (can be WikiData-ID or human-readable text)
  • tags (List[str]): [optional] List of tags

Returns:

  • Dict: Element entity for the newly created element

Example code:

from daselement_api import api as de

library_path = '/some/path/das-element.lib'
mapping = 'copy & rename'
path = '/some/folder/files.1001-1099#.exr'
path_thumbnail = '/some/folder/custom_thumbnail.jpg'
path_proxy = '/some/folder/custom_proxy.mov'
category = 'Q235544'  #  or: 'flame'
tags = ['Q3196', 'foo', 'bar']

entity = de.ingest(library_path, mapping, path, category, path_thumbnail=path_thumbnail, path_proxy=path_proxy, tags=tags)
print(entity)
print(entity.get('path'))

Example result: {"category": {"child_counter": 1,"description": "stick with a flaming end used as a source of light","id": "Q327954","name": "torch","type": "default"},"category_id": "Q327954","channel": 3,"colorspace": "sRGB","colorspace_source": "sRGB","created_at": "2022-05-16T08:26:52.854774","feature_id": 1,"frame_count": 1,"frame_first": 1,"frame_last": 1,"frame_rate": "","height": 5413,"id": 1,"media_type": "image","name": "fire_00001","number": "00001","path": "/mnt/library/fire/fire_00001/main_3342x5413_source/fire_00001.jpg","path_filmstrip": "/mnt/library/fire/fire_00001/filmstrip_11520x270_srgb/fire_00001.jpg","path_proxy": "/mnt/library/fire/fire_00001/proxy_1920x1080_srgb/fire_00001.mov","path_source": "/mnt/source/lication/some-image.jpg","path_thumbnail": "/mnt/library/fire/fire_00001/thumb_960x540_srgb/fire_00001.jpg","pixel_aspect": "1","popularity": "None","rating": "None","tags": [{"elements_count": 3,"id": "Q235544","name": "flame","type": "default"},{"elements_count": 56,"id": "Q3196","name": "fire","type": "default"},{"elements_count": 3,"id": "Q327954","name": "torch","type": "default"}],"uuid": "9947c549c6014a3ca831983275884051","width": 3342}

Example command line command: das-element-cli ingest --library /mnt/library/das-element.lib --mapping "copy & rename" --path /some/file/path.1001-1099#.exr --path_thumbnail /some/file/custom_thumbnail.jpg --path_proxy /some/file/custom_proxy.mov --category Q235544 --tags Q3196,foo,bar

def predict(path, model, top=2, filmstrip_frames=36)
530def predict(path, model, top=2, filmstrip_frames=36):
531    '''
532    Predict the category for a give file path.
533
534    The give path can be a file or a directory.  
535    If a directory is provided, all sub-directories will be searched for files and sequences.
536
537
538    **Args**:
539
540    > - **model** (str): *Define a custom model file path (.wit)*
541    > - **filmstrip_frames** (int): [optional] *Number of frames to validated for a movie file or sequence. The higher the number, the better the result might be, but it also takes longer*
542    > - **top** (int): [optional] *Return the top X predictions*
543
544
545    **Returns**:
546    > - Dict[str, List[Dict]]: *Key is the file path. The value a list of predicted categories*
547
548
549    **Example result**:
550    `{"/some/file/path.1001-1099#.exr": [{"tag": "flame", "description": "visible, gaseous part of a fire", "id": "Q235544", "value": "Q235544", "parents": [{"description": "rapid oxidation of a material; phenomenon that emits light and heat", "id": "Q3196", "name": "fire", "synonyms": [{"language": "en", "value": "fire"}, {"language": "en", "value": "fires"}}]}]}`
551
552
553    **Example command line command**:
554    `das-element-cli predict --top=2 /some/file/path`
555
556    '''
557    command = ['predict', '--top', top, '--filmstrip_frames', filmstrip_frames]
558    command += ['--model', as_quoted_string(model)]
559    command += ['--filmstrip_frames', filmstrip_frames]
560    command += ['--top', top]
561    command += [as_quoted_string(path)]
562    return execute_command(command, cli_full=True)

Predict the category for a give file path.

The give path can be a file or a directory.
If a directory is provided, all sub-directories will be searched for files and sequences.

Args:

  • model (str): Define a custom model file path (.wit)
  • filmstrip_frames (int): [optional] Number of frames to validated for a movie file or sequence. The higher the number, the better the result might be, but it also takes longer
  • top (int): [optional] Return the top X predictions

Returns:

  • Dict[str, List[Dict]]: Key is the file path. The value a list of predicted categories

Example result: {"/some/file/path.1001-1099#.exr": [{"tag": "flame", "description": "visible, gaseous part of a fire", "id": "Q235544", "value": "Q235544", "parents": [{"description": "rapid oxidation of a material; phenomenon that emits light and heat", "id": "Q3196", "name": "fire", "synonyms": [{"language": "en", "value": "fire"}, {"language": "en", "value": "fires"}}]}]}

Example command line command: das-element-cli predict --top=2 /some/file/path

def get_paths_from_disk(path, as_sequence=True)
565def get_paths_from_disk(path, as_sequence=True):
566    '''
567    Recursivly searches for files and sequences in a given directory. Since version 1.2.5
568
569    The give path can be a file or a directory.  
570    If a directory is provided, all sub-directories will be searched for files and sequences.
571
572
573    **Args**:
574
575    > - **as_sequence / as_single_files** (bool): [optional] defines if files with a sequential naming should be detected as a file sequence or individual files
576
577
578    **Returns**:
579    > - List[str]: *List of file paths found in the give directory*
580
581
582    **Example result**:
583    `["/some/file/path.1001-1099#.exr", "/other/path.mov"]`
584
585
586    **Example command line command**:
587    `das-element-cli get-paths-from-disk --as_sequence /some/file/path`
588
589    '''
590    command = ['get-paths-from-disk']
591
592    if as_sequence:
593        command += ['--as_sequence']
594    else:
595        command += ['--as_single_files']
596
597    command += [path]
598    return execute_command(command, cli_full=True)

Recursivly searches for files and sequences in a given directory. Since version 1.2.5

The give path can be a file or a directory.
If a directory is provided, all sub-directories will be searched for files and sequences.

Args:

  • as_sequence / as_single_files (bool): [optional] defines if files with a sequential naming should be detected as a file sequence or individual files

Returns:

  • List[str]: List of file paths found in the give directory

Example result: ["/some/file/path.1001-1099#.exr", "/other/path.mov"]

Example command line command: das-element-cli get-paths-from-disk --as_sequence /some/file/path

def get_meaningful_frame(path)
601def get_meaningful_frame(path):
602    '''
603    Validate meaningful thumbnail frame number for movie file or image sequence
604
605
606    **Args**:
607
608    > - **path** (str): *file path to movie file or image sequence - single frame of a file sequence can be provided*
609
610
611    **Returns**:
612    > - int: *Returns frame number of meaningful thumbnail frame*
613
614
615    **Example result**:
616    `1042`
617
618
619    **Example command line command**:
620    `das-element-cli get-meaningful-frame /folder/some_file.mov`
621    `das-element-cli get-meaningful-frame /folder/frame_sequence.1001.exr`
622    `das-element-cli get-meaningful-frame /folder/frame_sequence.####.exr`
623    `das-element-cli get-meaningful-frame /folder/frame_sequence.%04d.exr`
624
625    '''
626    command = ['get-meaningful-frame', path]
627
628    return execute_command(command, cli_full=True)

Validate meaningful thumbnail frame number for movie file or image sequence

Args:

  • path (str): file path to movie file or image sequence - single frame of a file sequence can be provided

Returns:

  • int: Returns frame number of meaningful thumbnail frame

Example result: 1042

Example command line command: das-element-cli get-meaningful-frame /folder/some_file.mov das-element-cli get-meaningful-frame /folder/frame_sequence.1001.exr das-element-cli get-meaningful-frame /folder/frame_sequence.####.exr das-element-cli get-meaningful-frame /folder/frame_sequence.%04d.exr

def render_element_proxies(element_uuid, mapping, library_path=None)
631def render_element_proxies(element_uuid, mapping, library_path=None):
632    '''
633    Render the proxy files for an element based on a template mapping
634
635    If the library is provided it will directly try to get to element for that library.
636    Otherwise it tries to get the entity each library that's defined in the config.
637
638    **Args**:
639    > - **element_uuid** (str): *Element UUID (unique ID) in the database*
640    > - **mapping** (str): *name of the template mapping that gets rendered*
641    > - **library_path** (str): *[optional] File path to the library file (.lib)*
642
643    **Returns**:
644    > - bool: *Result of render jobs*
645
646
647    **Example result**:
648    `true`
649
650
651    **Example command line command**:
652    `das-element-cli render-element-proxies 9947c549c6014a3ca831983275884051 "render proxies" --library /some/path/das-element.lib`
653
654    '''
655    command = ['render-element-proxies', element_uuid, mapping]
656
657    if library_path:
658        command += ['--library', library_path]
659
660    return execute_command(command, cli_full=True)

Render the proxy files for an element based on a template mapping

If the library is provided it will directly try to get to element for that library. Otherwise it tries to get the entity each library that's defined in the config.

Args:

  • element_uuid (str): Element UUID (unique ID) in the database
  • mapping (str): name of the template mapping that gets rendered
  • library_path (str): [optional] File path to the library file (.lib)

Returns:

  • bool: Result of render jobs

Example result: true

Example command line command: das-element-cli render-element-proxies 9947c549c6014a3ca831983275884051 "render proxies" --library /some/path/das-element.lib