daselement_api.api

Das Element Python API

API works for both Python 2 & 3



Install

In your Python environment run the command:

pip install daselement-api


Configuration

In the background the CLI version of Das Element is executed.
Set the environment variables to point to the CLI executable files:

DASELEMENT_CLI (for the small CLI version)
DASELEMENT_CLI_FULL (for the full CLI version)


Usage

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) 2026 das element
   8'''
   9## Das Element Python API
  10
  11API works for both Python 2 & 3
  12
  13
  14---
  15<br/>
  16### Install
  17
  18In your Python environment run the command:
  19
  20```bash
  21pip install daselement-api
  22```
  23
  24<br/>
  25
  26### Configuration
  27
  28In the background the CLI version of Das Element is executed.  
  29Set the environment variables to point to the CLI executable files:
  30<br/><br/>
  31`DASELEMENT_CLI` (for the small CLI version)  
  32`DASELEMENT_CLI_FULL` (for the full CLI version)  
  33<br/><br/>
  34
  35### Usage
  36
  37```python
  38from daselement_api import api as de
  39libraries = de.get_libraries()
  40for library, library_config_data in libraries.items():
  41   print(library)
  42   print(library_config_data)
  43```
  44
  45<br/>
  46---
  47
  48The library information is taken from the config file that is set for the current workstation.  
  49Either defined in the `~/.das-element/setup.ini` file or by the environment variable `DASELEMENT_CONFIG_PATH`
  50
  51'''
  52
  53from .manager import execute_command, as_quoted_string, as_quoted_dict
  54
  55config = None
  56'''
  57Variabel to define a custom config file path (.conf)
  58
  59---
  60'''
  61
  62
  63def create_config(config_path, preset_key='blank', preset_path=None):
  64    '''
  65    Create a new config file. Provide the preset key or file path to a config preset.
  66
  67    **Args**:
  68    > - **config_path** (str): *File path to the config .conf file*
  69    > - **preset_key** (str): *[optional] Default preset key. Options: blank | preserve_structure | restructure_comprehensive | restructure_selective*
  70    > - **preset_path** (str): *[optional] File path to config preset file*
  71
  72    **Returns**:
  73    > - bool: *Result of config creation*
  74
  75    **Example code**:
  76    ```
  77    from daselement_api import api as de
  78
  79    config_path = '/some/path/my-config.conf'
  80    preset_key = 'blank'  # or 'preserve_structure', 'restructure_comprehensive', 'restructure_selective'
  81    preset_path = '/some/path/preset.conf'  # optional
  82
  83    result = de.create_config(config_path, preset_key=preset_key)
  84
  85    # with custom preset file
  86    result = de.create_config(config_path, preset_path=preset_path)
  87    ```
  88
  89    **Example result**:
  90    `true`
  91
  92    **Example command line command**:
  93    `das-element-cli create-config /some/path/my-config.conf --preset_key blank`
  94    `das-element-cli create-config /some/path/my-config.conf --preset_path /some/path/preset.conf`
  95    '''
  96    command = ['create-config']
  97    command += ['--preset_key', as_quoted_string(preset_key)]
  98
  99    if preset_path:
 100        command += ['--preset_path', as_quoted_string(preset_path)]
 101
 102    command += [as_quoted_string(config_path)]
 103
 104    return execute_command(command, cli_full=True)
 105
 106
 107def get_config_presets():
 108    '''
 109    Get all available config presets.
 110
 111    **Returns**:
 112    > - List[Dict]: *List of available config presets*
 113
 114    **Example code**:
 115    ```
 116    from daselement_api import api as de
 117
 118    presets = de.get_config_presets()
 119    for preset in presets:
 120        print(preset)
 121    ```
 122
 123    **Example result**:
 124    `[{'key': 'blank', 'name': 'Blank Config', 'description': 'Creates a blank configuration file'}, {'key': 'preserve_structure', 'name': 'Preserve Structure', 'description': 'Preserves existing folder structure'}, {'key': 'restructure_comprehensive', 'name': 'Comprehensive Restructure', 'description': 'Complete restructuring of the library'}, {'key': 'restructure_selective', 'name': 'Selective Restructure', 'description': 'Selective restructuring based on criteria'}]`
 125
 126    **Example command line command**:
 127    `das-element-cli get-config-presets`
 128    '''
 129    command = ['get-config-presets']
 130    return execute_command(command, cli_full=True)
 131
 132
 133def get_library_presets():
 134    '''
 135    Get all available library presets.
 136
 137    **Returns**:
 138    > - List[Dict]: *List of available library presets*
 139
 140    **Example code**:
 141    ```
 142    from daselement_api import api as de
 143
 144    presets = de.get_library_presets()
 145    for preset in presets:
 146        print(preset)
 147    ```
 148
 149    **Example result**:
 150    `[{'key': 'basic', 'name': 'Basic Library', 'description': 'Basic library setup with standard templates'}, {'key': 'advanced', 'name': 'Advanced Library', 'description': 'Advanced library setup with comprehensive templates'}, {'key': 'custom', 'name': 'Custom Library', 'description': 'Custom library setup for specific workflows'}]`
 151
 152    **Example command line command**:
 153    `das-element-cli get-library-presets`
 154    '''
 155    command = ['get-library-presets']
 156    return execute_command(command, cli_full=True)
 157
 158
 159def create_library(library_path,
 160                   name=None,
 161                   path_lin=None,
 162                   path_mac=None,
 163                   path_win=None,
 164                   root=None,
 165                   root_lin=None,
 166                   root_mac=None,
 167                   root_win=None,
 168                   preset_key='blank',
 169                   preset_path=None,
 170                   create_defaults=True,
 171                   db_type=None,
 172                   db_path=None,
 173                   db_path_lin=None,
 174                   db_path_mac=None,
 175                   db_path_win=None,
 176                   db_user=None,
 177                   db_password=None,
 178                   db_uri=None,
 179                   db_port=None,
 180                   db_name=None,
 181                   db_sslmode='disable',
 182                   db_sslcert=None,
 183                   db_sslcert_lin=None,
 184                   db_sslcert_mac=None,
 185                   db_sslcert_win=None,
 186                   db_sslkey=None,
 187                   db_sslkey_lin=None,
 188                   db_sslkey_mac=None,
 189                   db_sslkey_win=None,
 190                   db_sslrootcert=None,
 191                   db_sslrootcert_lin=None,
 192                   db_sslrootcert_mac=None,
 193                   db_sslrootcert_win=None,
 194                   db_sslca=None,
 195                   db_sslca_lin=None,
 196                   db_sslca_mac=None,
 197                   db_sslca_win=None):
 198    '''
 199    Create a new library and database.
 200
 201    **Args**:
 202    > - **library_path** (str): *File path to library (.lib) file for current OS*
 203    > - **name** (str): *[optional] Library name*
 204    > - **path_lin** (str): *[optional] File path to library (.lib) file for Linux*
 205    > - **path_mac** (str): *[optional] File path to library (.lib) file for MacOS*
 206    > - **path_win** (str): *[optional] File path to library (.lib) file for Windows*
 207    > - **root** (str): *[optional] Library root path for current OS*
 208    > - **root_lin** (str): *[optional] Library root path for Linux*
 209    > - **root_mac** (str): *[optional] Library root path for MacOS*
 210    > - **root_win** (str): *[optional] Library root path for Windows*
 211    > - **preset_key** (str): *[optional] Default preset key. Options: blank | preserve_structure | restructure_comprehensive | restructure_selective*
 212    > - **preset_path** (str): *[optional] File path to library preset file*
 213    > - **create_defaults** (bool): *[optional] Create default tags and categories*
 214    > - **db_type** (str): *Type of database. Options: sqlite | postgres | mysql*
 215    > - **db_path** (str): *[optional] SQLite only: Database path for current OS*
 216    > - **db_path_lin** (str): *[optional] SQLite only: Database path for Linux*
 217    > - **db_path_mac** (str): *[optional] SQLite only: Database path for MacOS*
 218    > - **db_path_win** (str): *[optional] SQLite only: Database path for Windows*
 219    > - **db_user** (str): *[optional] Server-side database: Database user name*
 220    > - **db_password** (str): *[optional] Server-side database: Database user password*
 221    > - **db_uri** (str): *[optional] Server-side database: Database host URI*
 222    > - **db_port** (int): *[optional] Server-side database: Database host port*
 223    > - **db_name** (str): *[optional] Server-side database: Database name of library*
 224    > - **db_sslmode** (str): *[optional] SSL encryption mode*
 225    > - **db_sslcert** (str): *[optional] Client certificate/public key for current OS*
 226    > - **db_sslcert_lin** (str): *[optional] Client certificate/public key for Linux*
 227    > - **db_sslcert_mac** (str): *[optional] Client certificate/public key for MacOS*
 228    > - **db_sslcert_win** (str): *[optional] Client certificate/public key for Windows*
 229    > - **db_sslkey** (str): *[optional] Client certificate key/private key for current OS*
 230    > - **db_sslkey_lin** (str): *[optional] Client certificate key/private key for Linux*
 231    > - **db_sslkey_mac** (str): *[optional] Client certificate key/private key for MacOS*
 232    > - **db_sslkey_win** (str): *[optional] Client certificate key/private key for Windows*
 233    > - **db_sslrootcert** (str): *[optional] PostgreSQL only: Root certificate file for current OS*
 234    > - **db_sslrootcert_lin** (str): *[optional] PostgreSQL only: Root certificate file for Linux*
 235    > - **db_sslrootcert_mac** (str): *[optional] PostgreSQL only: Root certificate file for MacOS*
 236    > - **db_sslrootcert_win** (str): *[optional] PostgreSQL only: Root certificate file for Windows*
 237    > - **db_sslca** (str): *[optional] MySQL/MariaDB only: Certificate Authority file for current OS*
 238    > - **db_sslca_lin** (str): *[optional] MySQL/MariaDB only: Certificate Authority file for Linux*
 239    > - **db_sslca_mac** (str): *[optional] MySQL/MariaDB only: Certificate Authority file for MacOS*
 240    > - **db_sslca_win** (str): *[optional] MySQL/MariaDB only: Certificate Authority file for Windows*
 241
 242    **Returns**:
 243    > - bool: *Result of library creation*
 244
 245    **Example code**:
 246    ```
 247    from daselement_api import api as de
 248
 249    # SQLite example
 250    result = de.create_library(
 251        library_path='/mnt/library/das-element.lib',
 252        name='My Library',
 253        root='/mnt/library',
 254        db_type='sqlite',
 255        db_path='/mnt/library/das-element.db',
 256        preset_key='preserve_structure'
 257    )
 258
 259    # PostgreSQL example
 260    result = de.create_library(
 261        library_path='/mnt/library/das-element.lib',
 262        name='My Library',
 263        root='/mnt/library',
 264        db_type='postgres',
 265        db_user='user',
 266        db_password='password',
 267        db_uri='my-database',
 268        db_port=5432,
 269        db_name='my_library'
 270    )
 271    ```
 272
 273    **Example result**:
 274    `true`
 275
 276    **Example command line command**:
 277    `das-element-cli create-library --path /mnt/library/das-element.lib --root /mnt/library --db_type sqlite --db_path /mnt/library/das-element.db --preset_key preserve_structure`
 278    '''
 279    command = ['create-library']
 280
 281    if name:
 282        command += ['--name', as_quoted_string(name)]
 283
 284    command += ['--path', as_quoted_string(library_path)]
 285
 286    if path_lin:
 287        command += ['--path_lin', as_quoted_string(path_lin)]
 288    if path_mac:
 289        command += ['--path_mac', as_quoted_string(path_mac)]
 290    if path_win:
 291        command += ['--path_win', as_quoted_string(path_win)]
 292
 293    if root:
 294        command += ['--root', as_quoted_string(root)]
 295    if root_lin:
 296        command += ['--root_lin', as_quoted_string(root_lin)]
 297    if root_mac:
 298        command += ['--root_mac', as_quoted_string(root_mac)]
 299    if root_win:
 300        command += ['--root_win', as_quoted_string(root_win)]
 301
 302    command += ['--preset_key', as_quoted_string(preset_key)]
 303
 304    if preset_path:
 305        command += ['--preset_path', as_quoted_string(preset_path)]
 306
 307    if create_defaults is not None:
 308        command += ['--create_defaults', str(create_defaults).lower()]
 309
 310    if db_type:
 311        command += ['--db_type', as_quoted_string(db_type)]
 312
 313    # SQLite database options
 314    if db_path:
 315        command += ['--db_path', as_quoted_string(db_path)]
 316    if db_path_lin:
 317        command += ['--db_path_lin', as_quoted_string(db_path_lin)]
 318    if db_path_mac:
 319        command += ['--db_path_mac', as_quoted_string(db_path_mac)]
 320    if db_path_win:
 321        command += ['--db_path_win', as_quoted_string(db_path_win)]
 322
 323    # Server-side database options
 324    if db_user:
 325        command += ['--db_user', as_quoted_string(db_user)]
 326    if db_password:
 327        command += ['--db_password', as_quoted_string(db_password)]
 328    if db_uri:
 329        command += ['--db_uri', as_quoted_string(db_uri)]
 330    if db_port:
 331        command += ['--db_port', str(db_port)]
 332    if db_name:
 333        command += ['--db_name', as_quoted_string(db_name)]
 334
 335    # SSL options / ignore for SQLite
 336    if db_sslmode and db_type.lower() != 'sqlite':
 337        command += ['--db_sslmode', as_quoted_string(db_sslmode)]
 338
 339    if db_sslcert:
 340        command += ['--db_sslcert', as_quoted_string(db_sslcert)]
 341    if db_sslcert_lin:
 342        command += ['--db_sslcert_lin', as_quoted_string(db_sslcert_lin)]
 343    if db_sslcert_mac:
 344        command += ['--db_sslcert_mac', as_quoted_string(db_sslcert_mac)]
 345    if db_sslcert_win:
 346        command += ['--db_sslcert_win', as_quoted_string(db_sslcert_win)]
 347
 348    if db_sslkey:
 349        command += ['--db_sslkey', as_quoted_string(db_sslkey)]
 350    if db_sslkey_lin:
 351        command += ['--db_sslkey_lin', as_quoted_string(db_sslkey_lin)]
 352    if db_sslkey_mac:
 353        command += ['--db_sslkey_mac', as_quoted_string(db_sslkey_mac)]
 354    if db_sslkey_win:
 355        command += ['--db_sslkey_win', as_quoted_string(db_sslkey_win)]
 356
 357    # PostgreSQL SSL options
 358    if db_sslrootcert:
 359        command += ['--db_sslrootcert', as_quoted_string(db_sslrootcert)]
 360    if db_sslrootcert_lin:
 361        command += [
 362            '--db_sslrootcert_lin',
 363            as_quoted_string(db_sslrootcert_lin)
 364        ]
 365    if db_sslrootcert_mac:
 366        command += [
 367            '--db_sslrootcert_mac',
 368            as_quoted_string(db_sslrootcert_mac)
 369        ]
 370    if db_sslrootcert_win:
 371        command += [
 372            '--db_sslrootcert_win',
 373            as_quoted_string(db_sslrootcert_win)
 374        ]
 375
 376    # MySQL/MariaDB SSL options
 377    if db_sslca:
 378        command += ['--db_sslca', as_quoted_string(db_sslca)]
 379    if db_sslca_lin:
 380        command += ['--db_sslca_lin', as_quoted_string(db_sslca_lin)]
 381    if db_sslca_mac:
 382        command += ['--db_sslca_mac', as_quoted_string(db_sslca_mac)]
 383    if db_sslca_win:
 384        command += ['--db_sslca_win', as_quoted_string(db_sslca_win)]
 385
 386    return execute_command(command, cli_full=True)
 387
 388
 389def get_libraries():
 390    '''
 391    Get all libraries data for current config.
 392
 393    **Returns**:
 394    > - Dict[str, Dict]: *Key is the library file path (.lib) - Value is the library data*
 395
 396    **Example code**:
 397    ```
 398    from daselement_api import api as de
 399
 400    libraries = de.get_libraries()
 401    for library, library_config_data in libraries.items():
 402        print(library)
 403        print(library_config_data)
 404    ```
 405    '''
 406    command = ['--config', config] if config else []
 407    command += ['get-libraries']
 408    return execute_command(command)
 409
 410
 411def get_library_template_mappings(library_path):
 412    '''
 413    Get all template mappings data for library.
 414
 415    **Args**:
 416    > - **library_path** (str): *File path to the library file (.lib)*
 417
 418    **Returns**:
 419    > - List[Dict]
 420
 421    **Example code**:
 422    ```
 423    from daselement_api import api as de
 424
 425    library_path = '/some/path/das-element.lib'
 426
 427    template_mappings = de.get_library_template_mappings(library_path)
 428    for template_mapping in template_mappings:
 429        print(template_mapping)
 430    ```
 431
 432    **Example result**:
 433    `[{'key': 'copy & rename', 'value': {'extra': ['extra-job'], 'filmstrip': 'filmstrip', 'main': 'main', 'proxy': 'proxy mov', 'thumbnail': 'thumbnail'}}]`
 434    '''
 435    command = ['--config', config] if config else []
 436    command += [
 437        'get-library-template-mappings',
 438        as_quoted_string(library_path)
 439    ]
 440    return execute_command(command)
 441
 442
 443def add_library(library_path, os_platform=None):
 444    '''
 445    Add an existing library to the current config.
 446
 447    **Args**:
 448    > - **library_path** (str): *File path to the library file (.lib)*
 449    > - **os_platform** (str): *[optional] Operating system (Default: current OS). Options: ['lin', 'mac', 'win']*
 450
 451    **Returns**:
 452    > - bool: *Result of adding the library to the config*
 453
 454    **Example code to add library for the current operating system**:
 455    ```
 456    from daselement_api import api as de
 457
 458    library_path = '/some/path/das-element.lib'
 459
 460    result = de.add_library(library_path)
 461    ```
 462
 463    **Example result**:
 464    `true`
 465    '''
 466    command = ['--config', config] if config else []
 467    command += ['add-library']
 468    if os_platform is not None:
 469        command += ['--os', as_quoted_string(os_platform)]
 470    command += [as_quoted_string(library_path)]
 471    return execute_command(command)
 472
 473
 474def remove_library(library_path, os_platform=None):
 475    '''
 476    Remove an existing library to the current config.
 477
 478    **Args**:
 479    > - **library_path** (str): *File path to the library file (.lib)*
 480    > - **os_platform** (str): *[optional] Operating system (Default: current OS). Options: ['lin', 'mac', 'win']*
 481
 482    **Returns**:
 483    > - bool: *Result of removing the library to the config*
 484
 485    **Example code to remove library for the current operating system**:
 486    ```
 487    from daselement_api import api as de
 488
 489    library_path = '/some/path/das-element.lib'
 490
 491    result = de.remove_library(library_path)
 492    ```
 493
 494    **Example result**:
 495    `true`
 496    '''
 497    command = ['--config', config] if config else []
 498    command += ['remove-library']
 499    if os_platform is not None:
 500        command += ['--os', as_quoted_string(os_platform)]
 501    command += [as_quoted_string(library_path)]
 502    return execute_command(command)
 503
 504
 505def get_categories(library_path):
 506    '''
 507    Get all categories from the database for the library.
 508
 509    **Args**:
 510    > - **library_path** (str): *File path to the library file (.lib)*
 511
 512    **Returns**:
 513    > - List[Dict]
 514
 515    **Example code**:
 516    ```
 517    from daselement_api import api as de
 518
 519    library_path = '/some/path/das-element.lib'
 520
 521    categories = de.get_categories(library_path)
 522    for category in categories:
 523        print(category)
 524    ```
 525
 526    **Example result**:
 527    `[{'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'}]}]`
 528    '''
 529    command = ['--config', config] if config else []
 530    command += ['get-categories', as_quoted_string(library_path)]
 531    return execute_command(command)
 532
 533
 534def get_category(library_path, category_value):
 535    '''
 536    Get category entity from the database for the library.
 537
 538    **Args**:
 539    > - **library_path** (str): *File path to the library file (.lib)*
 540    > - **category_value** (str): *the ID ('Q3196') or name ('fire') of the category in the database*
 541
 542    **Returns**:
 543    > - Dict[str, Union[str, int]]: *child_count: actual number of children - child_counter: increasing counter, even if children get deleted*
 544
 545
 546
 547    **Example code**:
 548    ```
 549    from daselement_api import api as de
 550
 551    library_path = '/some/path/das-element.lib'
 552
 553    category_entity = de.get_category(library_path, 'Q3196')
 554    category_entity = de.get_category(library_path, 'fire')
 555    ```
 556
 557    **Example result**:
 558    `{"id": "Q3196", "type": "default", "name": "fire", "child_count": 130, "child_counter": 135}`
 559    '''
 560    command = ['--config', config] if config else []
 561    command += [
 562        'get-category',
 563        as_quoted_string(library_path),
 564        as_quoted_string(category_value)
 565    ]
 566    return execute_command(command)
 567
 568
 569def get_tags(library_path):
 570    '''
 571    Get all tags from the database for the library.
 572
 573    **Args**:
 574    > - **library_path** (str): *File path to the library file (.lib)*
 575
 576    **Returns**:
 577    > - List[Dict]
 578
 579    **Example code**:
 580    ```
 581    from daselement_api import api as de
 582
 583    library_path = '/some/path/das-element.lib'
 584
 585    tags = de.get_tags(library_path)
 586    for tag in tags:
 587        print(tag)
 588    ```
 589
 590    **Example result**:
 591    `[{'id': 'Q235544', 'name': 'flame', 'type': 'default', 'elements_count': 3, 'synonyms': [{'language': 'en', 'value': 'flame'}]}]`
 592    '''
 593    command = ['--config', config] if config else []
 594    command += ['get-tags', as_quoted_string(library_path)]
 595    return execute_command(command)
 596
 597
 598def get_tag(library_path, tag_value):
 599    '''
 600    Get tag entity from the database for the library.
 601
 602    **Args**:
 603    > - **library_path** (str): *File path to the library file (.lib)*
 604    > - **tag_value** (str): *the ID ('Q3196') or name ('fire') of the tag in the database*
 605
 606    **Returns**:
 607    > - Dict[str, Union[str, int]]
 608
 609    **Example code**:
 610    ```
 611    from daselement_api import api as de
 612
 613    library_path = '/some/path/das-element.lib'
 614
 615    tag_entity = de.get_tag(library_path, 'Q3196')
 616    tag_entity = de.get_tag(library_path, 'fire')
 617    ```
 618
 619    **Example result**:
 620    `{"id": "Q3196", "name": "fire", "type": "default", "elements_count": 130}`
 621    '''
 622    command = ['--config', config] if config else []
 623    command += [
 624        'get-tag',
 625        as_quoted_string(library_path),
 626        as_quoted_string(tag_value)
 627    ]
 628    return execute_command(command)
 629
 630
 631def get_elements(library_path):
 632    '''
 633    Get all elements from the database for the library.
 634
 635    **Args**:
 636    > - **library_path** (str): *File path to the library file (.lib)*
 637
 638    **Returns**:
 639    > - List[Dict]
 640
 641    **Example code**:
 642    ```
 643    from daselement_api import api as de
 644
 645    library_path = '/some/path/das-element.lib'
 646
 647    elements = de.get_elements(library_path)
 648    for element in elements:
 649        print(element)
 650        print(element.get('path'))
 651    ```
 652
 653    **Example result**:
 654    `[{"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","rating": "3","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}]`
 655    '''
 656    command = ['--config', config] if config else []
 657    command += ['get-elements', as_quoted_string(library_path)]
 658    return execute_command(command)
 659
 660
 661def get_element_by_id(library_path, element_id):
 662    '''
 663    Get element entity based on the **element ID** from the database for the library.
 664
 665    **Args**:
 666    > - **library_path** (str): *File path to the library file (.lib)*
 667    > - **element_id** (int): *Element ID in the database*
 668
 669    **Returns**:
 670    > - Dict
 671
 672    **Example code**:
 673    ```
 674    from daselement_api import api as de
 675
 676    library_path = '/some/path/das-element.lib'
 677    element_id = 1
 678
 679    element = de.get_element_by_id(library_path, element_id)
 680    print(element)
 681    print(element.get('path'))
 682    ```
 683
 684    **Example result**:
 685    `{"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","rating": "3","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}`
 686    '''
 687    command = ['--config', config] if config else []
 688    command += [
 689        'get-element-by-id',
 690        as_quoted_string(library_path), element_id
 691    ]
 692    return execute_command(command)
 693
 694
 695def get_element_by_uuid(element_uuid, library_path=None):
 696    '''
 697    Get element entity based on the **element UUID** from the database for the library.
 698    If no library path is provided, all libraries of the current config will be searched.
 699
 700    **Args**:
 701    > - **library_path** (str): *[optional] File path to the library file (.lib)*
 702    > - **element_uuid** (str): *Element UUID (unique ID) in the database*
 703
 704    **Returns**:
 705    > - Dict
 706
 707    **Example code**:
 708    ```
 709    from daselement_api import api as de
 710
 711    element_uuid = '9947c549c6014a3ca831983275884051'
 712    library_path = '/some/path/das-element.lib'  # optional
 713
 714    element = de.get_element_by_uuid(element_uuid, library_path=library_path)
 715
 716    # without the library path each linked library in the config file will searched
 717    element = de.get_element_by_uuid(element_uuid)
 718
 719    print(element)
 720    print(element.get('path'))
 721    ```
 722
 723    **Example result**:
 724    `{"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","rating": "3","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}`
 725    '''
 726    command = ['--config', config] if config else []
 727    command += ['get-element-by-uuid', element_uuid]
 728    if library_path:
 729        command += ['--library', as_quoted_string(library_path)]
 730    return execute_command(command)
 731
 732
 733def get_element_by_name(library_path, element_name):
 734    '''
 735    Get element entity based on the **element name** from the database for the library.
 736
 737    **Args**:
 738    > - **library_path** (str): *File path to the library file (.lib)*
 739    > - **element_name** (str): *Element name in the database*
 740
 741    **Returns**:
 742    > - Dict
 743
 744    **Example code**:
 745    ```
 746    from daselement_api import api as de
 747
 748    library_path = '/some/path/das-element.lib'
 749    element_name = 'fire_00001'
 750
 751    element = de.get_element_by_name(library_path, element_name)
 752    print(element)
 753    print(element.get('path'))
 754    ```
 755
 756    **Example result**:
 757    `{"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","rating": "3","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}`
 758    '''
 759    command = ['--config', config] if config else []
 760    command += [
 761        'get-element-by-name',
 762        as_quoted_string(library_path), element_name
 763    ]
 764    return execute_command(command)
 765
 766
 767def update(library_path, entity_type, entity_id, data):
 768    '''
 769    Updates database entity with new data
 770
 771
 772    **Args**:
 773    > - **library_path** (str): *File path to the library file (.lib)*
 774    > - **entity_type** (str): *Type of entity to update. Options: [Category, Element, Tag]*
 775    > - **entity_id** (Union[str, int]): *the ID of the entity to update in the database*
 776    > - **data** (Dict): *data to update. Dictionary with key/value pairs formated as JSON.*  
 777        *Example:* `"{\\\"rating\\\": 3}"`
 778
 779    **Returns**:
 780    > - Dict: *Entity of the updated entity*
 781
 782    **Example code**:
 783    ```
 784    from daselement_api import api as de
 785
 786    library_path = '/some/path/das-element.lib'
 787    entity_type = 'Element'
 788    entity_id = 23
 789    new_data = {'category_id': 'Q327954',  # or: 'category': 'torch',
 790                'tags': ['flame', 'fire', 'torch', 'something custom tag'],
 791                'metadata': {'foo': 'bar'}}
 792
 793    entity = de.update(library_path, entity_type, entity_id, new_data)
 794    print(entity)
 795    print(entity.get('rating'))
 796    ```
 797
 798    **Example result**:
 799    `{"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","rating": "3","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}`
 800
 801    **Example command line command**:  
 802    ##### Windows  
 803    `das-element-cli.exe update C:\\mnt\\library\\das-element.lib element 1 "{\\\"rating\\\": 3}"`  
 804    ##### Linux/MacOS  
 805    `das-element-cli update /mnt/library/das-element.lib element 1 '{\"rating\": 3}'`
 806    '''
 807    command = ['--config', config] if config else []
 808    command += [
 809        'update',
 810        as_quoted_string(library_path),
 811        as_quoted_string(entity_type),
 812        as_quoted_string(entity_id),
 813        as_quoted_dict(data)
 814    ]
 815    return execute_command(command)
 816
 817
 818def delete_element(element_uuid,
 819                   delete_from_database=False,
 820                   delete_from_disk=False,
 821                   delete_proxy=False,
 822                   library_path=None):
 823    '''
 824    Deletes an element entity based on the **element UUID**.
 825    The options define what gets deleted. Either the database record, main and/or proxy files on disk, or both.
 826
 827    **Args**:
 828    > - **element_uuid** (str): *Element UUID (unique ID) in the database*
 829    > - **delete_from_database** (bool): *[optional] delete data from the database*
 830    > - **delete_from_disk** (bool): *[optional] delete all element files from disk*
 831    > - **delete_proxy** (bool): *[optional] delete only element proxy files from disk*
 832    > - **library_path** (str): *[optional] File path to the library file (.lib)*
 833
 834    **Returns**:
 835    > - bool
 836
 837    **Example code**:
 838    ```
 839    from daselement_api import api as de
 840
 841    element_uuid = '9947c549c6014a3ca831983275884051'
 842    delete_from_database = True
 843    delete_from_disk = True
 844    delete_proxy = True
 845    library_path = '/some/path/das-element.lib'  # optional
 846
 847    de.delete_element(element_uuid, delete_from_database, delete_from_disk, delete_proxy, library_path=library_path)
 848
 849    ```
 850
 851    **Example result**:
 852    `true`
 853    '''
 854    command = ['--config', config] if config else []
 855    command += [
 856        'delete-element',
 857        element_uuid,
 858    ]
 859    if delete_from_database:
 860        command += ['--database']
 861    if delete_from_disk:
 862        command += ['--disk']
 863    if delete_proxy:
 864        command += ['--proxy']
 865    if library_path:
 866        command += ['--library', as_quoted_string(library_path)]
 867    return execute_command(command, cli_full=True)
 868
 869
 870def delete_elements(element_uuids,
 871                    delete_from_database=False,
 872                    delete_from_disk=False,
 873                    delete_proxy=False,
 874                    library_path=None):
 875    '''
 876    Deletes multiple element entities based on a list of **element UUIDs**.
 877    The options define what gets deleted. Either the database record, main and/or proxy files on disk, or both.
 878
 879    **Args**:
 880    > - **element_uuids** (List[str]): *List of Element UUIDs (unique IDs) in the database*
 881    > - **delete_from_database** (bool): *[optional] delete data from the database*
 882    > - **delete_from_disk** (bool): *[optional] delete all element files from disk*
 883    > - **delete_proxy** (bool): *[optional] delete only element proxy files from disk*
 884    > - **library_path** (str): *[optional] File path to the library file (.lib)*
 885
 886    **Returns**:
 887    > - bool
 888
 889    **Example code**:
 890    ```
 891    from daselement_api import api as de
 892
 893    element_uuids = ['8747c549ab344a3798405135ca831288', '9947c549c6014a3ca831983275884051']
 894    delete_from_database = True
 895    delete_from_disk = True
 896    delete_proxy = True
 897    library_path = '/some/path/das-element.lib'  # optional
 898
 899    de.delete_elements(element_uuids, delete_from_database, delete_from_disk, delete_proxy, library_path=library_path)
 900
 901    ```
 902
 903    **Example result**:
 904    `true`
 905    '''
 906    command = ['--config', config] if config else []
 907    command += ['delete-elements']
 908    if delete_from_database:
 909        command += ['--database']
 910    if delete_from_disk:
 911        command += ['--disk']
 912    if delete_proxy:
 913        command += ['--proxy']
 914    if library_path:
 915        command += ['--library', as_quoted_string(library_path)]
 916    command += [as_quoted_string(','.join(element_uuids))]
 917    return execute_command(command, cli_full=True)
 918
 919
 920def ingest(library_path,
 921           mapping,
 922           path,
 923           category,
 924           colorspace='',
 925           path_thumbnail='',
 926           path_proxy='',
 927           tags=[],
 928           media_type='',
 929           permission='111',
 930           metadata={},
 931           additionals=[]):
 932    '''
 933    Ingest a new element to the library
 934
 935    Ingesting a file sequence requires the path to be in a [fileseq.FileSequence notation](https://github.com/justinfx/fileseq#filesequence)  
 936    Thank you to the developers of [fileseq](https://github.com/justinfx/fileseq)!
 937
 938    Example: `/some/folder/files.1001-1099#.exr`
 939
 940
 941    **Args**:
 942    > - **library_path** (str): *File path to the library file (.lib)*
 943    > - **mapping** (str): *Name of the transcoding mapping used to ingest*
 944    > - **path** (str): *File path to the new element*
 945    > - **path_thumbnail** (str): *[optional] File path to custom thumbnail*
 946    > - **path_proxy** (str): *[optional] File path to custom proxy. Movie file, OBJ or FBX*
 947    > - **category** (str): *Category name of new element (can be WikiData-ID or human-readable text)*
 948    > - **colorspace** (str): *[optional] Colorspace name*
 949    > - **tags** (List[str]): *[optional] List of tags*
 950    > - **media_type** (str): *[optional] Media type of element. Valid options: image, sequence, movie, sphere, pdf, project-file, 3d-model, 3d-scene, generic*
 951    > - **permission** (str): *[optional] Permission flag*
 952    > - **metadata** (Dict[str, str]): *[optional] List of metadata as: {key:value}*
 953    > - **additionals** (List[Dict[str, str]]): *[optional] List of additionals. Provide additional as: /path type name*
 954
 955    **Returns**:
 956    > - Dict: *Element entity for the newly created element*
 957
 958    **Example code**:
 959    ```
 960    from daselement_api import api as de
 961
 962    library_path = '/some/path/das-element.lib'
 963    mapping = 'copy & rename'
 964    path = '/some/folder/files.1001-1099#.exr'
 965    path_thumbnail = '/some/folder/custom_thumbnail.jpg'
 966    path_proxy = '/some/folder/custom_proxy.mov'
 967    category = 'Q235544'  #  or: 'flame'
 968    colorspace = 'ACES2065-1'
 969    tags = ['Q3196', 'foo', 'bar']
 970    media_type = 'sequence'
 971    permission = '110'
 972    metadata = {'foo': 'bar', 'bar': 'buz huz'}
 973    additionals = [{'path': '/file/additional.exr', 'type': 'texture', 'name': 'alpha'}]
 974
 975    entity = de.ingest(library_path, mapping, path, category, colorspace=colorspace, path_thumbnail=path_thumbnail, path_proxy=path_proxy, tags=tags, media_type=media_type, permission=permission, metadata=metadata, additionals=additionals)
 976    print(entity)
 977    print(entity.get('path'))
 978    ```
 979
 980    **Example result**:
 981    `{"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","rating": "3","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", "permission": "110", "width": 3342}`
 982
 983    **Example command line command**:
 984    `das-element-cli ingest --library /mnt/library/das-element.lib --mapping "copy & rename" --path /some/file/path.%04d.exr --category Q3196 --tags foo,bar,baz --colorspace ACES2065-1 --media_type sequence --metadata foo bar -m lens "70 mm" --path_thumbnail /file/path/thumbnail.jpg --path_proxy /file/path/proxy.mov --additional /path/additional.exr texture alpha`
 985    '''
 986    command = ['--config', config] if config else []
 987    command += [
 988        'ingest', '--library',
 989        as_quoted_string(library_path), '--mapping',
 990        as_quoted_string(mapping), '--path',
 991        as_quoted_string(path), '--path_thumbnail',
 992        as_quoted_string(path_thumbnail), '--path_proxy',
 993        as_quoted_string(path_proxy), '--category',
 994        as_quoted_string(category), '--colorspace',
 995        as_quoted_string(colorspace), '--tags',
 996        as_quoted_string(','.join(tags)), '--media_type',
 997        as_quoted_string(media_type), '--permission',
 998        as_quoted_string(permission)
 999    ] + [
1000        item for key_value in metadata.items() for item in
1001        ['-m',
1002         as_quoted_string(key_value[0]),
1003         as_quoted_string(key_value[1])]
1004    ] + [
1005        item for additional in additionals for item in [
1006            '-a',
1007            as_quoted_string(additional.get('path', '')),
1008            as_quoted_string(additional.get('type', '')),
1009            as_quoted_string(additional.get('name', ''))
1010        ]
1011    ]
1012
1013    return execute_command(command, cli_full=True)
1014
1015
1016def predict(path, model, top=2, filmstrip_frames=36):
1017    '''
1018    Predict the category for a give file path.
1019
1020    The give path can be a file or a directory.  
1021    If a directory is provided, all sub-directories will be searched for files and sequences.
1022
1023
1024    **Args**:
1025
1026    > - **model** (str): *Define a custom model file path (.wit)*
1027    > - **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*
1028    > - **top** (int): [optional] *Return the top X predictions*
1029
1030
1031    **Returns**:
1032    > - Dict[str, List[Dict]]: *Key is the file path. The value a list of predicted categories*
1033
1034
1035    **Example result**:
1036    `{"/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"}}]}]}`
1037
1038
1039    **Example command line command**:
1040    `das-element-cli predict --top=2 /some/file/path`
1041
1042    '''
1043    command = ['predict', '--top', top, '--filmstrip_frames', filmstrip_frames]
1044    command += ['--model', as_quoted_string(model)]
1045    command += ['--filmstrip_frames', filmstrip_frames]
1046    command += ['--top', top]
1047    command += [as_quoted_string(path)]
1048    return execute_command(command, cli_full=True)
1049
1050
1051def get_paths_from_disk(path, as_sequence=True):
1052    '''
1053    Recursivly searches for files and sequences in a given directory. Since version 1.2.5
1054
1055    The give path can be a file or a directory.  
1056    If a directory is provided, all sub-directories will be searched for files and sequences.
1057
1058
1059    **Args**:
1060
1061    > - **as_sequence / as_single_files** (bool): [optional] defines if files with a sequential naming should be detected as a file sequence or individual files
1062
1063
1064    **Returns**:
1065    > - List[str]: *List of file paths found in the give directory*
1066
1067
1068    **Example result**:
1069    `["/some/file/path.1001-1099#.exr", "/other/path.mov"]`
1070
1071
1072    **Example command line command**:
1073    `das-element-cli get-paths-from-disk --as_sequence /some/file/path`
1074
1075    '''
1076    command = ['get-paths-from-disk']
1077
1078    if as_sequence:
1079        command += ['--as_sequence']
1080    else:
1081        command += ['--as_single_files']
1082
1083    command += [path]
1084    return execute_command(command, cli_full=True)
1085
1086
1087def get_meaningful_frame(path):
1088    '''
1089    Validate meaningful thumbnail frame number for movie file or image sequence
1090
1091
1092    **Args**:
1093
1094    > - **path** (str): *file path to movie file or image sequence - single frame of a file sequence can be provided*
1095
1096
1097    **Returns**:
1098    > - int: *Returns frame number of meaningful thumbnail frame*
1099
1100
1101    **Example result**:
1102    `1042`
1103
1104
1105    **Example command line command**:
1106    `das-element-cli get-meaningful-frame /folder/some_file.mov`
1107    `das-element-cli get-meaningful-frame /folder/frame_sequence.1001.exr`
1108    `das-element-cli get-meaningful-frame /folder/frame_sequence.####.exr`
1109    `das-element-cli get-meaningful-frame /folder/frame_sequence.%04d.exr`
1110
1111    '''
1112    command = ['get-meaningful-frame', path]
1113
1114    return execute_command(command, cli_full=True)
1115
1116
1117def render_element_proxies(element_uuid, mapping, library_path=None):
1118    '''
1119    Render the proxy files for an element based on a template mapping
1120
1121    If the library is provided it will directly try to get to element for that library.
1122    Otherwise it tries to get the entity each library that's defined in the config.
1123
1124    **Args**:
1125    > - **element_uuid** (str): *Element UUID (unique ID) in the database*
1126    > - **mapping** (str): *name of the template mapping that gets rendered*
1127    > - **library_path** (str): *[optional] File path to the library file (.lib)*
1128
1129    **Returns**:
1130    > - bool: *Result of render jobs*
1131
1132
1133    **Example result**:
1134    `true`
1135
1136
1137    **Example command line command**:
1138    `das-element-cli render-element-proxies 9947c549c6014a3ca831983275884051 "render proxies" --library /some/path/das-element.lib`
1139
1140    '''
1141    command = ['render-element-proxies', element_uuid, mapping]
1142
1143    if library_path:
1144        command += ['--library', library_path]
1145
1146    return execute_command(command, cli_full=True)
config = None

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


def create_config(config_path, preset_key='blank', preset_path=None):
 64def create_config(config_path, preset_key='blank', preset_path=None):
 65    '''
 66    Create a new config file. Provide the preset key or file path to a config preset.
 67
 68    **Args**:
 69    > - **config_path** (str): *File path to the config .conf file*
 70    > - **preset_key** (str): *[optional] Default preset key. Options: blank | preserve_structure | restructure_comprehensive | restructure_selective*
 71    > - **preset_path** (str): *[optional] File path to config preset file*
 72
 73    **Returns**:
 74    > - bool: *Result of config creation*
 75
 76    **Example code**:
 77    ```
 78    from daselement_api import api as de
 79
 80    config_path = '/some/path/my-config.conf'
 81    preset_key = 'blank'  # or 'preserve_structure', 'restructure_comprehensive', 'restructure_selective'
 82    preset_path = '/some/path/preset.conf'  # optional
 83
 84    result = de.create_config(config_path, preset_key=preset_key)
 85
 86    # with custom preset file
 87    result = de.create_config(config_path, preset_path=preset_path)
 88    ```
 89
 90    **Example result**:
 91    `true`
 92
 93    **Example command line command**:
 94    `das-element-cli create-config /some/path/my-config.conf --preset_key blank`
 95    `das-element-cli create-config /some/path/my-config.conf --preset_path /some/path/preset.conf`
 96    '''
 97    command = ['create-config']
 98    command += ['--preset_key', as_quoted_string(preset_key)]
 99
100    if preset_path:
101        command += ['--preset_path', as_quoted_string(preset_path)]
102
103    command += [as_quoted_string(config_path)]
104
105    return execute_command(command, cli_full=True)

Create a new config file. Provide the preset key or file path to a config preset.

Args:

  • config_path (str): File path to the config .conf file
  • preset_key (str): [optional] Default preset key. Options: blank | preserve_structure | restructure_comprehensive | restructure_selective
  • preset_path (str): [optional] File path to config preset file

Returns:

  • bool: Result of config creation

Example code:

from daselement_api import api as de

config_path = '/some/path/my-config.conf'
preset_key = 'blank'  # or 'preserve_structure', 'restructure_comprehensive', 'restructure_selective'
preset_path = '/some/path/preset.conf'  # optional

result = de.create_config(config_path, preset_key=preset_key)

# with custom preset file
result = de.create_config(config_path, preset_path=preset_path)

Example result: true

Example command line command: das-element-cli create-config /some/path/my-config.conf --preset_key blank das-element-cli create-config /some/path/my-config.conf --preset_path /some/path/preset.conf

def get_config_presets():
108def get_config_presets():
109    '''
110    Get all available config presets.
111
112    **Returns**:
113    > - List[Dict]: *List of available config presets*
114
115    **Example code**:
116    ```
117    from daselement_api import api as de
118
119    presets = de.get_config_presets()
120    for preset in presets:
121        print(preset)
122    ```
123
124    **Example result**:
125    `[{'key': 'blank', 'name': 'Blank Config', 'description': 'Creates a blank configuration file'}, {'key': 'preserve_structure', 'name': 'Preserve Structure', 'description': 'Preserves existing folder structure'}, {'key': 'restructure_comprehensive', 'name': 'Comprehensive Restructure', 'description': 'Complete restructuring of the library'}, {'key': 'restructure_selective', 'name': 'Selective Restructure', 'description': 'Selective restructuring based on criteria'}]`
126
127    **Example command line command**:
128    `das-element-cli get-config-presets`
129    '''
130    command = ['get-config-presets']
131    return execute_command(command, cli_full=True)

Get all available config presets.

Returns:

  • List[Dict]: List of available config presets

Example code:

from daselement_api import api as de

presets = de.get_config_presets()
for preset in presets:
    print(preset)

Example result: [{'key': 'blank', 'name': 'Blank Config', 'description': 'Creates a blank configuration file'}, {'key': 'preserve_structure', 'name': 'Preserve Structure', 'description': 'Preserves existing folder structure'}, {'key': 'restructure_comprehensive', 'name': 'Comprehensive Restructure', 'description': 'Complete restructuring of the library'}, {'key': 'restructure_selective', 'name': 'Selective Restructure', 'description': 'Selective restructuring based on criteria'}]

Example command line command: das-element-cli get-config-presets

def get_library_presets():
134def get_library_presets():
135    '''
136    Get all available library presets.
137
138    **Returns**:
139    > - List[Dict]: *List of available library presets*
140
141    **Example code**:
142    ```
143    from daselement_api import api as de
144
145    presets = de.get_library_presets()
146    for preset in presets:
147        print(preset)
148    ```
149
150    **Example result**:
151    `[{'key': 'basic', 'name': 'Basic Library', 'description': 'Basic library setup with standard templates'}, {'key': 'advanced', 'name': 'Advanced Library', 'description': 'Advanced library setup with comprehensive templates'}, {'key': 'custom', 'name': 'Custom Library', 'description': 'Custom library setup for specific workflows'}]`
152
153    **Example command line command**:
154    `das-element-cli get-library-presets`
155    '''
156    command = ['get-library-presets']
157    return execute_command(command, cli_full=True)

Get all available library presets.

Returns:

  • List[Dict]: List of available library presets

Example code:

from daselement_api import api as de

presets = de.get_library_presets()
for preset in presets:
    print(preset)

Example result: [{'key': 'basic', 'name': 'Basic Library', 'description': 'Basic library setup with standard templates'}, {'key': 'advanced', 'name': 'Advanced Library', 'description': 'Advanced library setup with comprehensive templates'}, {'key': 'custom', 'name': 'Custom Library', 'description': 'Custom library setup for specific workflows'}]

Example command line command: das-element-cli get-library-presets

def create_library( library_path, name=None, path_lin=None, path_mac=None, path_win=None, root=None, root_lin=None, root_mac=None, root_win=None, preset_key='blank', preset_path=None, create_defaults=True, db_type=None, db_path=None, db_path_lin=None, db_path_mac=None, db_path_win=None, db_user=None, db_password=None, db_uri=None, db_port=None, db_name=None, db_sslmode='disable', db_sslcert=None, db_sslcert_lin=None, db_sslcert_mac=None, db_sslcert_win=None, db_sslkey=None, db_sslkey_lin=None, db_sslkey_mac=None, db_sslkey_win=None, db_sslrootcert=None, db_sslrootcert_lin=None, db_sslrootcert_mac=None, db_sslrootcert_win=None, db_sslca=None, db_sslca_lin=None, db_sslca_mac=None, db_sslca_win=None):
160def create_library(library_path,
161                   name=None,
162                   path_lin=None,
163                   path_mac=None,
164                   path_win=None,
165                   root=None,
166                   root_lin=None,
167                   root_mac=None,
168                   root_win=None,
169                   preset_key='blank',
170                   preset_path=None,
171                   create_defaults=True,
172                   db_type=None,
173                   db_path=None,
174                   db_path_lin=None,
175                   db_path_mac=None,
176                   db_path_win=None,
177                   db_user=None,
178                   db_password=None,
179                   db_uri=None,
180                   db_port=None,
181                   db_name=None,
182                   db_sslmode='disable',
183                   db_sslcert=None,
184                   db_sslcert_lin=None,
185                   db_sslcert_mac=None,
186                   db_sslcert_win=None,
187                   db_sslkey=None,
188                   db_sslkey_lin=None,
189                   db_sslkey_mac=None,
190                   db_sslkey_win=None,
191                   db_sslrootcert=None,
192                   db_sslrootcert_lin=None,
193                   db_sslrootcert_mac=None,
194                   db_sslrootcert_win=None,
195                   db_sslca=None,
196                   db_sslca_lin=None,
197                   db_sslca_mac=None,
198                   db_sslca_win=None):
199    '''
200    Create a new library and database.
201
202    **Args**:
203    > - **library_path** (str): *File path to library (.lib) file for current OS*
204    > - **name** (str): *[optional] Library name*
205    > - **path_lin** (str): *[optional] File path to library (.lib) file for Linux*
206    > - **path_mac** (str): *[optional] File path to library (.lib) file for MacOS*
207    > - **path_win** (str): *[optional] File path to library (.lib) file for Windows*
208    > - **root** (str): *[optional] Library root path for current OS*
209    > - **root_lin** (str): *[optional] Library root path for Linux*
210    > - **root_mac** (str): *[optional] Library root path for MacOS*
211    > - **root_win** (str): *[optional] Library root path for Windows*
212    > - **preset_key** (str): *[optional] Default preset key. Options: blank | preserve_structure | restructure_comprehensive | restructure_selective*
213    > - **preset_path** (str): *[optional] File path to library preset file*
214    > - **create_defaults** (bool): *[optional] Create default tags and categories*
215    > - **db_type** (str): *Type of database. Options: sqlite | postgres | mysql*
216    > - **db_path** (str): *[optional] SQLite only: Database path for current OS*
217    > - **db_path_lin** (str): *[optional] SQLite only: Database path for Linux*
218    > - **db_path_mac** (str): *[optional] SQLite only: Database path for MacOS*
219    > - **db_path_win** (str): *[optional] SQLite only: Database path for Windows*
220    > - **db_user** (str): *[optional] Server-side database: Database user name*
221    > - **db_password** (str): *[optional] Server-side database: Database user password*
222    > - **db_uri** (str): *[optional] Server-side database: Database host URI*
223    > - **db_port** (int): *[optional] Server-side database: Database host port*
224    > - **db_name** (str): *[optional] Server-side database: Database name of library*
225    > - **db_sslmode** (str): *[optional] SSL encryption mode*
226    > - **db_sslcert** (str): *[optional] Client certificate/public key for current OS*
227    > - **db_sslcert_lin** (str): *[optional] Client certificate/public key for Linux*
228    > - **db_sslcert_mac** (str): *[optional] Client certificate/public key for MacOS*
229    > - **db_sslcert_win** (str): *[optional] Client certificate/public key for Windows*
230    > - **db_sslkey** (str): *[optional] Client certificate key/private key for current OS*
231    > - **db_sslkey_lin** (str): *[optional] Client certificate key/private key for Linux*
232    > - **db_sslkey_mac** (str): *[optional] Client certificate key/private key for MacOS*
233    > - **db_sslkey_win** (str): *[optional] Client certificate key/private key for Windows*
234    > - **db_sslrootcert** (str): *[optional] PostgreSQL only: Root certificate file for current OS*
235    > - **db_sslrootcert_lin** (str): *[optional] PostgreSQL only: Root certificate file for Linux*
236    > - **db_sslrootcert_mac** (str): *[optional] PostgreSQL only: Root certificate file for MacOS*
237    > - **db_sslrootcert_win** (str): *[optional] PostgreSQL only: Root certificate file for Windows*
238    > - **db_sslca** (str): *[optional] MySQL/MariaDB only: Certificate Authority file for current OS*
239    > - **db_sslca_lin** (str): *[optional] MySQL/MariaDB only: Certificate Authority file for Linux*
240    > - **db_sslca_mac** (str): *[optional] MySQL/MariaDB only: Certificate Authority file for MacOS*
241    > - **db_sslca_win** (str): *[optional] MySQL/MariaDB only: Certificate Authority file for Windows*
242
243    **Returns**:
244    > - bool: *Result of library creation*
245
246    **Example code**:
247    ```
248    from daselement_api import api as de
249
250    # SQLite example
251    result = de.create_library(
252        library_path='/mnt/library/das-element.lib',
253        name='My Library',
254        root='/mnt/library',
255        db_type='sqlite',
256        db_path='/mnt/library/das-element.db',
257        preset_key='preserve_structure'
258    )
259
260    # PostgreSQL example
261    result = de.create_library(
262        library_path='/mnt/library/das-element.lib',
263        name='My Library',
264        root='/mnt/library',
265        db_type='postgres',
266        db_user='user',
267        db_password='password',
268        db_uri='my-database',
269        db_port=5432,
270        db_name='my_library'
271    )
272    ```
273
274    **Example result**:
275    `true`
276
277    **Example command line command**:
278    `das-element-cli create-library --path /mnt/library/das-element.lib --root /mnt/library --db_type sqlite --db_path /mnt/library/das-element.db --preset_key preserve_structure`
279    '''
280    command = ['create-library']
281
282    if name:
283        command += ['--name', as_quoted_string(name)]
284
285    command += ['--path', as_quoted_string(library_path)]
286
287    if path_lin:
288        command += ['--path_lin', as_quoted_string(path_lin)]
289    if path_mac:
290        command += ['--path_mac', as_quoted_string(path_mac)]
291    if path_win:
292        command += ['--path_win', as_quoted_string(path_win)]
293
294    if root:
295        command += ['--root', as_quoted_string(root)]
296    if root_lin:
297        command += ['--root_lin', as_quoted_string(root_lin)]
298    if root_mac:
299        command += ['--root_mac', as_quoted_string(root_mac)]
300    if root_win:
301        command += ['--root_win', as_quoted_string(root_win)]
302
303    command += ['--preset_key', as_quoted_string(preset_key)]
304
305    if preset_path:
306        command += ['--preset_path', as_quoted_string(preset_path)]
307
308    if create_defaults is not None:
309        command += ['--create_defaults', str(create_defaults).lower()]
310
311    if db_type:
312        command += ['--db_type', as_quoted_string(db_type)]
313
314    # SQLite database options
315    if db_path:
316        command += ['--db_path', as_quoted_string(db_path)]
317    if db_path_lin:
318        command += ['--db_path_lin', as_quoted_string(db_path_lin)]
319    if db_path_mac:
320        command += ['--db_path_mac', as_quoted_string(db_path_mac)]
321    if db_path_win:
322        command += ['--db_path_win', as_quoted_string(db_path_win)]
323
324    # Server-side database options
325    if db_user:
326        command += ['--db_user', as_quoted_string(db_user)]
327    if db_password:
328        command += ['--db_password', as_quoted_string(db_password)]
329    if db_uri:
330        command += ['--db_uri', as_quoted_string(db_uri)]
331    if db_port:
332        command += ['--db_port', str(db_port)]
333    if db_name:
334        command += ['--db_name', as_quoted_string(db_name)]
335
336    # SSL options / ignore for SQLite
337    if db_sslmode and db_type.lower() != 'sqlite':
338        command += ['--db_sslmode', as_quoted_string(db_sslmode)]
339
340    if db_sslcert:
341        command += ['--db_sslcert', as_quoted_string(db_sslcert)]
342    if db_sslcert_lin:
343        command += ['--db_sslcert_lin', as_quoted_string(db_sslcert_lin)]
344    if db_sslcert_mac:
345        command += ['--db_sslcert_mac', as_quoted_string(db_sslcert_mac)]
346    if db_sslcert_win:
347        command += ['--db_sslcert_win', as_quoted_string(db_sslcert_win)]
348
349    if db_sslkey:
350        command += ['--db_sslkey', as_quoted_string(db_sslkey)]
351    if db_sslkey_lin:
352        command += ['--db_sslkey_lin', as_quoted_string(db_sslkey_lin)]
353    if db_sslkey_mac:
354        command += ['--db_sslkey_mac', as_quoted_string(db_sslkey_mac)]
355    if db_sslkey_win:
356        command += ['--db_sslkey_win', as_quoted_string(db_sslkey_win)]
357
358    # PostgreSQL SSL options
359    if db_sslrootcert:
360        command += ['--db_sslrootcert', as_quoted_string(db_sslrootcert)]
361    if db_sslrootcert_lin:
362        command += [
363            '--db_sslrootcert_lin',
364            as_quoted_string(db_sslrootcert_lin)
365        ]
366    if db_sslrootcert_mac:
367        command += [
368            '--db_sslrootcert_mac',
369            as_quoted_string(db_sslrootcert_mac)
370        ]
371    if db_sslrootcert_win:
372        command += [
373            '--db_sslrootcert_win',
374            as_quoted_string(db_sslrootcert_win)
375        ]
376
377    # MySQL/MariaDB SSL options
378    if db_sslca:
379        command += ['--db_sslca', as_quoted_string(db_sslca)]
380    if db_sslca_lin:
381        command += ['--db_sslca_lin', as_quoted_string(db_sslca_lin)]
382    if db_sslca_mac:
383        command += ['--db_sslca_mac', as_quoted_string(db_sslca_mac)]
384    if db_sslca_win:
385        command += ['--db_sslca_win', as_quoted_string(db_sslca_win)]
386
387    return execute_command(command, cli_full=True)

Create a new library and database.

Args:

  • library_path (str): File path to library (.lib) file for current OS
  • name (str): [optional] Library name
  • path_lin (str): [optional] File path to library (.lib) file for Linux
  • path_mac (str): [optional] File path to library (.lib) file for MacOS
  • path_win (str): [optional] File path to library (.lib) file for Windows
  • root (str): [optional] Library root path for current OS
  • root_lin (str): [optional] Library root path for Linux
  • root_mac (str): [optional] Library root path for MacOS
  • root_win (str): [optional] Library root path for Windows
  • preset_key (str): [optional] Default preset key. Options: blank | preserve_structure | restructure_comprehensive | restructure_selective
  • preset_path (str): [optional] File path to library preset file
  • create_defaults (bool): [optional] Create default tags and categories
  • db_type (str): Type of database. Options: sqlite | postgres | mysql
  • db_path (str): [optional] SQLite only: Database path for current OS
  • db_path_lin (str): [optional] SQLite only: Database path for Linux
  • db_path_mac (str): [optional] SQLite only: Database path for MacOS
  • db_path_win (str): [optional] SQLite only: Database path for Windows
  • db_user (str): [optional] Server-side database: Database user name
  • db_password (str): [optional] Server-side database: Database user password
  • db_uri (str): [optional] Server-side database: Database host URI
  • db_port (int): [optional] Server-side database: Database host port
  • db_name (str): [optional] Server-side database: Database name of library
  • db_sslmode (str): [optional] SSL encryption mode
  • db_sslcert (str): [optional] Client certificate/public key for current OS
  • db_sslcert_lin (str): [optional] Client certificate/public key for Linux
  • db_sslcert_mac (str): [optional] Client certificate/public key for MacOS
  • db_sslcert_win (str): [optional] Client certificate/public key for Windows
  • db_sslkey (str): [optional] Client certificate key/private key for current OS
  • db_sslkey_lin (str): [optional] Client certificate key/private key for Linux
  • db_sslkey_mac (str): [optional] Client certificate key/private key for MacOS
  • db_sslkey_win (str): [optional] Client certificate key/private key for Windows
  • db_sslrootcert (str): [optional] PostgreSQL only: Root certificate file for current OS
  • db_sslrootcert_lin (str): [optional] PostgreSQL only: Root certificate file for Linux
  • db_sslrootcert_mac (str): [optional] PostgreSQL only: Root certificate file for MacOS
  • db_sslrootcert_win (str): [optional] PostgreSQL only: Root certificate file for Windows
  • db_sslca (str): [optional] MySQL/MariaDB only: Certificate Authority file for current OS
  • db_sslca_lin (str): [optional] MySQL/MariaDB only: Certificate Authority file for Linux
  • db_sslca_mac (str): [optional] MySQL/MariaDB only: Certificate Authority file for MacOS
  • db_sslca_win (str): [optional] MySQL/MariaDB only: Certificate Authority file for Windows

Returns:

  • bool: Result of library creation

Example code:

from daselement_api import api as de

# SQLite example
result = de.create_library(
    library_path='/mnt/library/das-element.lib',
    name='My Library',
    root='/mnt/library',
    db_type='sqlite',
    db_path='/mnt/library/das-element.db',
    preset_key='preserve_structure'
)

# PostgreSQL example
result = de.create_library(
    library_path='/mnt/library/das-element.lib',
    name='My Library',
    root='/mnt/library',
    db_type='postgres',
    db_user='user',
    db_password='password',
    db_uri='my-database',
    db_port=5432,
    db_name='my_library'
)

Example result: true

Example command line command: das-element-cli create-library --path /mnt/library/das-element.lib --root /mnt/library --db_type sqlite --db_path /mnt/library/das-element.db --preset_key preserve_structure

def get_libraries():
390def get_libraries():
391    '''
392    Get all libraries data for current config.
393
394    **Returns**:
395    > - Dict[str, Dict]: *Key is the library file path (.lib) - Value is the library data*
396
397    **Example code**:
398    ```
399    from daselement_api import api as de
400
401    libraries = de.get_libraries()
402    for library, library_config_data in libraries.items():
403        print(library)
404        print(library_config_data)
405    ```
406    '''
407    command = ['--config', config] if config else []
408    command += ['get-libraries']
409    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):
412def get_library_template_mappings(library_path):
413    '''
414    Get all template mappings data for library.
415
416    **Args**:
417    > - **library_path** (str): *File path to the library file (.lib)*
418
419    **Returns**:
420    > - List[Dict]
421
422    **Example code**:
423    ```
424    from daselement_api import api as de
425
426    library_path = '/some/path/das-element.lib'
427
428    template_mappings = de.get_library_template_mappings(library_path)
429    for template_mapping in template_mappings:
430        print(template_mapping)
431    ```
432
433    **Example result**:
434    `[{'key': 'copy & rename', 'value': {'extra': ['extra-job'], 'filmstrip': 'filmstrip', 'main': 'main', 'proxy': 'proxy mov', 'thumbnail': 'thumbnail'}}]`
435    '''
436    command = ['--config', config] if config else []
437    command += [
438        'get-library-template-mappings',
439        as_quoted_string(library_path)
440    ]
441    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 add_library(library_path, os_platform=None):
444def add_library(library_path, os_platform=None):
445    '''
446    Add an existing library to the current config.
447
448    **Args**:
449    > - **library_path** (str): *File path to the library file (.lib)*
450    > - **os_platform** (str): *[optional] Operating system (Default: current OS). Options: ['lin', 'mac', 'win']*
451
452    **Returns**:
453    > - bool: *Result of adding the library to the config*
454
455    **Example code to add library for the current operating system**:
456    ```
457    from daselement_api import api as de
458
459    library_path = '/some/path/das-element.lib'
460
461    result = de.add_library(library_path)
462    ```
463
464    **Example result**:
465    `true`
466    '''
467    command = ['--config', config] if config else []
468    command += ['add-library']
469    if os_platform is not None:
470        command += ['--os', as_quoted_string(os_platform)]
471    command += [as_quoted_string(library_path)]
472    return execute_command(command)

Add an existing library to the current config.

Args:

  • library_path (str): File path to the library file (.lib)
  • os_platform (str): [optional] Operating system (Default: current OS). Options: ['lin', 'mac', 'win']

Returns:

  • bool: Result of adding the library to the config

Example code to add library for the current operating system:

from daselement_api import api as de

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

result = de.add_library(library_path)

Example result: true

def remove_library(library_path, os_platform=None):
475def remove_library(library_path, os_platform=None):
476    '''
477    Remove an existing library to the current config.
478
479    **Args**:
480    > - **library_path** (str): *File path to the library file (.lib)*
481    > - **os_platform** (str): *[optional] Operating system (Default: current OS). Options: ['lin', 'mac', 'win']*
482
483    **Returns**:
484    > - bool: *Result of removing the library to the config*
485
486    **Example code to remove library for the current operating system**:
487    ```
488    from daselement_api import api as de
489
490    library_path = '/some/path/das-element.lib'
491
492    result = de.remove_library(library_path)
493    ```
494
495    **Example result**:
496    `true`
497    '''
498    command = ['--config', config] if config else []
499    command += ['remove-library']
500    if os_platform is not None:
501        command += ['--os', as_quoted_string(os_platform)]
502    command += [as_quoted_string(library_path)]
503    return execute_command(command)

Remove an existing library to the current config.

Args:

  • library_path (str): File path to the library file (.lib)
  • os_platform (str): [optional] Operating system (Default: current OS). Options: ['lin', 'mac', 'win']

Returns:

  • bool: Result of removing the library to the config

Example code to remove library for the current operating system:

from daselement_api import api as de

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

result = de.remove_library(library_path)

Example result: true

def get_categories(library_path):
506def get_categories(library_path):
507    '''
508    Get all categories from the database for the library.
509
510    **Args**:
511    > - **library_path** (str): *File path to the library file (.lib)*
512
513    **Returns**:
514    > - List[Dict]
515
516    **Example code**:
517    ```
518    from daselement_api import api as de
519
520    library_path = '/some/path/das-element.lib'
521
522    categories = de.get_categories(library_path)
523    for category in categories:
524        print(category)
525    ```
526
527    **Example result**:
528    `[{'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'}]}]`
529    '''
530    command = ['--config', config] if config else []
531    command += ['get-categories', as_quoted_string(library_path)]
532    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):
535def get_category(library_path, category_value):
536    '''
537    Get category entity from the database for the library.
538
539    **Args**:
540    > - **library_path** (str): *File path to the library file (.lib)*
541    > - **category_value** (str): *the ID ('Q3196') or name ('fire') of the category in the database*
542
543    **Returns**:
544    > - Dict[str, Union[str, int]]: *child_count: actual number of children - child_counter: increasing counter, even if children get deleted*
545
546
547
548    **Example code**:
549    ```
550    from daselement_api import api as de
551
552    library_path = '/some/path/das-element.lib'
553
554    category_entity = de.get_category(library_path, 'Q3196')
555    category_entity = de.get_category(library_path, 'fire')
556    ```
557
558    **Example result**:
559    `{"id": "Q3196", "type": "default", "name": "fire", "child_count": 130, "child_counter": 135}`
560    '''
561    command = ['--config', config] if config else []
562    command += [
563        'get-category',
564        as_quoted_string(library_path),
565        as_quoted_string(category_value)
566    ]
567    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):
570def get_tags(library_path):
571    '''
572    Get all tags from the database for the library.
573
574    **Args**:
575    > - **library_path** (str): *File path to the library file (.lib)*
576
577    **Returns**:
578    > - List[Dict]
579
580    **Example code**:
581    ```
582    from daselement_api import api as de
583
584    library_path = '/some/path/das-element.lib'
585
586    tags = de.get_tags(library_path)
587    for tag in tags:
588        print(tag)
589    ```
590
591    **Example result**:
592    `[{'id': 'Q235544', 'name': 'flame', 'type': 'default', 'elements_count': 3, 'synonyms': [{'language': 'en', 'value': 'flame'}]}]`
593    '''
594    command = ['--config', config] if config else []
595    command += ['get-tags', as_quoted_string(library_path)]
596    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):
599def get_tag(library_path, tag_value):
600    '''
601    Get tag entity from the database for the library.
602
603    **Args**:
604    > - **library_path** (str): *File path to the library file (.lib)*
605    > - **tag_value** (str): *the ID ('Q3196') or name ('fire') of the tag in the database*
606
607    **Returns**:
608    > - Dict[str, Union[str, int]]
609
610    **Example code**:
611    ```
612    from daselement_api import api as de
613
614    library_path = '/some/path/das-element.lib'
615
616    tag_entity = de.get_tag(library_path, 'Q3196')
617    tag_entity = de.get_tag(library_path, 'fire')
618    ```
619
620    **Example result**:
621    `{"id": "Q3196", "name": "fire", "type": "default", "elements_count": 130}`
622    '''
623    command = ['--config', config] if config else []
624    command += [
625        'get-tag',
626        as_quoted_string(library_path),
627        as_quoted_string(tag_value)
628    ]
629    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):
632def get_elements(library_path):
633    '''
634    Get all elements from the database for the library.
635
636    **Args**:
637    > - **library_path** (str): *File path to the library file (.lib)*
638
639    **Returns**:
640    > - List[Dict]
641
642    **Example code**:
643    ```
644    from daselement_api import api as de
645
646    library_path = '/some/path/das-element.lib'
647
648    elements = de.get_elements(library_path)
649    for element in elements:
650        print(element)
651        print(element.get('path'))
652    ```
653
654    **Example result**:
655    `[{"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","rating": "3","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}]`
656    '''
657    command = ['--config', config] if config else []
658    command += ['get-elements', as_quoted_string(library_path)]
659    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","rating": "3","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):
662def get_element_by_id(library_path, element_id):
663    '''
664    Get element entity based on the **element ID** from the database for the library.
665
666    **Args**:
667    > - **library_path** (str): *File path to the library file (.lib)*
668    > - **element_id** (int): *Element ID in the database*
669
670    **Returns**:
671    > - Dict
672
673    **Example code**:
674    ```
675    from daselement_api import api as de
676
677    library_path = '/some/path/das-element.lib'
678    element_id = 1
679
680    element = de.get_element_by_id(library_path, element_id)
681    print(element)
682    print(element.get('path'))
683    ```
684
685    **Example result**:
686    `{"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","rating": "3","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}`
687    '''
688    command = ['--config', config] if config else []
689    command += [
690        'get-element-by-id',
691        as_quoted_string(library_path), element_id
692    ]
693    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","rating": "3","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):
696def get_element_by_uuid(element_uuid, library_path=None):
697    '''
698    Get element entity based on the **element UUID** from the database for the library.
699    If no library path is provided, all libraries of the current config will be searched.
700
701    **Args**:
702    > - **library_path** (str): *[optional] File path to the library file (.lib)*
703    > - **element_uuid** (str): *Element UUID (unique ID) in the database*
704
705    **Returns**:
706    > - Dict
707
708    **Example code**:
709    ```
710    from daselement_api import api as de
711
712    element_uuid = '9947c549c6014a3ca831983275884051'
713    library_path = '/some/path/das-element.lib'  # optional
714
715    element = de.get_element_by_uuid(element_uuid, library_path=library_path)
716
717    # without the library path each linked library in the config file will searched
718    element = de.get_element_by_uuid(element_uuid)
719
720    print(element)
721    print(element.get('path'))
722    ```
723
724    **Example result**:
725    `{"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","rating": "3","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}`
726    '''
727    command = ['--config', config] if config else []
728    command += ['get-element-by-uuid', element_uuid]
729    if library_path:
730        command += ['--library', as_quoted_string(library_path)]
731    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","rating": "3","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):
734def get_element_by_name(library_path, element_name):
735    '''
736    Get element entity based on the **element name** from the database for the library.
737
738    **Args**:
739    > - **library_path** (str): *File path to the library file (.lib)*
740    > - **element_name** (str): *Element name in the database*
741
742    **Returns**:
743    > - Dict
744
745    **Example code**:
746    ```
747    from daselement_api import api as de
748
749    library_path = '/some/path/das-element.lib'
750    element_name = 'fire_00001'
751
752    element = de.get_element_by_name(library_path, element_name)
753    print(element)
754    print(element.get('path'))
755    ```
756
757    **Example result**:
758    `{"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","rating": "3","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}`
759    '''
760    command = ['--config', config] if config else []
761    command += [
762        'get-element-by-name',
763        as_quoted_string(library_path), element_name
764    ]
765    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","rating": "3","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):
768def update(library_path, entity_type, entity_id, data):
769    '''
770    Updates database entity with new data
771
772
773    **Args**:
774    > - **library_path** (str): *File path to the library file (.lib)*
775    > - **entity_type** (str): *Type of entity to update. Options: [Category, Element, Tag]*
776    > - **entity_id** (Union[str, int]): *the ID of the entity to update in the database*
777    > - **data** (Dict): *data to update. Dictionary with key/value pairs formated as JSON.*  
778        *Example:* `"{\\\"rating\\\": 3}"`
779
780    **Returns**:
781    > - Dict: *Entity of the updated entity*
782
783    **Example code**:
784    ```
785    from daselement_api import api as de
786
787    library_path = '/some/path/das-element.lib'
788    entity_type = 'Element'
789    entity_id = 23
790    new_data = {'category_id': 'Q327954',  # or: 'category': 'torch',
791                'tags': ['flame', 'fire', 'torch', 'something custom tag'],
792                'metadata': {'foo': 'bar'}}
793
794    entity = de.update(library_path, entity_type, entity_id, new_data)
795    print(entity)
796    print(entity.get('rating'))
797    ```
798
799    **Example result**:
800    `{"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","rating": "3","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}`
801
802    **Example command line command**:  
803    ##### Windows  
804    `das-element-cli.exe update C:\\mnt\\library\\das-element.lib element 1 "{\\\"rating\\\": 3}"`  
805    ##### Linux/MacOS  
806    `das-element-cli update /mnt/library/das-element.lib element 1 '{\"rating\": 3}'`
807    '''
808    command = ['--config', config] if config else []
809    command += [
810        'update',
811        as_quoted_string(library_path),
812        as_quoted_string(entity_type),
813        as_quoted_string(entity_id),
814        as_quoted_dict(data)
815    ]
816    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","rating": "3","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, delete_proxy=False, library_path=None):
819def delete_element(element_uuid,
820                   delete_from_database=False,
821                   delete_from_disk=False,
822                   delete_proxy=False,
823                   library_path=None):
824    '''
825    Deletes an element entity based on the **element UUID**.
826    The options define what gets deleted. Either the database record, main and/or proxy files on disk, or both.
827
828    **Args**:
829    > - **element_uuid** (str): *Element UUID (unique ID) in the database*
830    > - **delete_from_database** (bool): *[optional] delete data from the database*
831    > - **delete_from_disk** (bool): *[optional] delete all element files from disk*
832    > - **delete_proxy** (bool): *[optional] delete only element proxy files from disk*
833    > - **library_path** (str): *[optional] File path to the library file (.lib)*
834
835    **Returns**:
836    > - bool
837
838    **Example code**:
839    ```
840    from daselement_api import api as de
841
842    element_uuid = '9947c549c6014a3ca831983275884051'
843    delete_from_database = True
844    delete_from_disk = True
845    delete_proxy = True
846    library_path = '/some/path/das-element.lib'  # optional
847
848    de.delete_element(element_uuid, delete_from_database, delete_from_disk, delete_proxy, library_path=library_path)
849
850    ```
851
852    **Example result**:
853    `true`
854    '''
855    command = ['--config', config] if config else []
856    command += [
857        'delete-element',
858        element_uuid,
859    ]
860    if delete_from_database:
861        command += ['--database']
862    if delete_from_disk:
863        command += ['--disk']
864    if delete_proxy:
865        command += ['--proxy']
866    if library_path:
867        command += ['--library', as_quoted_string(library_path)]
868    return execute_command(command, cli_full=True)

Deletes an element entity based on the element UUID. The options define what gets deleted. Either the database record, main and/or proxy files on disk, or both.

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
  • delete_proxy (bool): [optional] delete only element proxy 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
delete_proxy = True
library_path = '/some/path/das-element.lib'  # optional

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

Example result: true

def delete_elements( element_uuids, delete_from_database=False, delete_from_disk=False, delete_proxy=False, library_path=None):
871def delete_elements(element_uuids,
872                    delete_from_database=False,
873                    delete_from_disk=False,
874                    delete_proxy=False,
875                    library_path=None):
876    '''
877    Deletes multiple element entities based on a list of **element UUIDs**.
878    The options define what gets deleted. Either the database record, main and/or proxy files on disk, or both.
879
880    **Args**:
881    > - **element_uuids** (List[str]): *List of Element UUIDs (unique IDs) in the database*
882    > - **delete_from_database** (bool): *[optional] delete data from the database*
883    > - **delete_from_disk** (bool): *[optional] delete all element files from disk*
884    > - **delete_proxy** (bool): *[optional] delete only element proxy files from disk*
885    > - **library_path** (str): *[optional] File path to the library file (.lib)*
886
887    **Returns**:
888    > - bool
889
890    **Example code**:
891    ```
892    from daselement_api import api as de
893
894    element_uuids = ['8747c549ab344a3798405135ca831288', '9947c549c6014a3ca831983275884051']
895    delete_from_database = True
896    delete_from_disk = True
897    delete_proxy = True
898    library_path = '/some/path/das-element.lib'  # optional
899
900    de.delete_elements(element_uuids, delete_from_database, delete_from_disk, delete_proxy, library_path=library_path)
901
902    ```
903
904    **Example result**:
905    `true`
906    '''
907    command = ['--config', config] if config else []
908    command += ['delete-elements']
909    if delete_from_database:
910        command += ['--database']
911    if delete_from_disk:
912        command += ['--disk']
913    if delete_proxy:
914        command += ['--proxy']
915    if library_path:
916        command += ['--library', as_quoted_string(library_path)]
917    command += [as_quoted_string(','.join(element_uuids))]
918    return execute_command(command, cli_full=True)

Deletes multiple element entities based on a list of element UUIDs. The options define what gets deleted. Either the database record, main and/or proxy files on disk, or both.

Args:

  • element_uuids (List[str]): List of Element UUIDs (unique IDs) in the database
  • delete_from_database (bool): [optional] delete data from the database
  • delete_from_disk (bool): [optional] delete all element files from disk
  • delete_proxy (bool): [optional] delete only element proxy 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_uuids = ['8747c549ab344a3798405135ca831288', '9947c549c6014a3ca831983275884051']
delete_from_database = True
delete_from_disk = True
delete_proxy = True
library_path = '/some/path/das-element.lib'  # optional

de.delete_elements(element_uuids, delete_from_database, delete_from_disk, delete_proxy, library_path=library_path)

Example result: true

def ingest( library_path, mapping, path, category, colorspace='', path_thumbnail='', path_proxy='', tags=[], media_type='', permission='111', metadata={}, additionals=[]):
 921def ingest(library_path,
 922           mapping,
 923           path,
 924           category,
 925           colorspace='',
 926           path_thumbnail='',
 927           path_proxy='',
 928           tags=[],
 929           media_type='',
 930           permission='111',
 931           metadata={},
 932           additionals=[]):
 933    '''
 934    Ingest a new element to the library
 935
 936    Ingesting a file sequence requires the path to be in a [fileseq.FileSequence notation](https://github.com/justinfx/fileseq#filesequence)  
 937    Thank you to the developers of [fileseq](https://github.com/justinfx/fileseq)!
 938
 939    Example: `/some/folder/files.1001-1099#.exr`
 940
 941
 942    **Args**:
 943    > - **library_path** (str): *File path to the library file (.lib)*
 944    > - **mapping** (str): *Name of the transcoding mapping used to ingest*
 945    > - **path** (str): *File path to the new element*
 946    > - **path_thumbnail** (str): *[optional] File path to custom thumbnail*
 947    > - **path_proxy** (str): *[optional] File path to custom proxy. Movie file, OBJ or FBX*
 948    > - **category** (str): *Category name of new element (can be WikiData-ID or human-readable text)*
 949    > - **colorspace** (str): *[optional] Colorspace name*
 950    > - **tags** (List[str]): *[optional] List of tags*
 951    > - **media_type** (str): *[optional] Media type of element. Valid options: image, sequence, movie, sphere, pdf, project-file, 3d-model, 3d-scene, generic*
 952    > - **permission** (str): *[optional] Permission flag*
 953    > - **metadata** (Dict[str, str]): *[optional] List of metadata as: {key:value}*
 954    > - **additionals** (List[Dict[str, str]]): *[optional] List of additionals. Provide additional as: /path type name*
 955
 956    **Returns**:
 957    > - Dict: *Element entity for the newly created element*
 958
 959    **Example code**:
 960    ```
 961    from daselement_api import api as de
 962
 963    library_path = '/some/path/das-element.lib'
 964    mapping = 'copy & rename'
 965    path = '/some/folder/files.1001-1099#.exr'
 966    path_thumbnail = '/some/folder/custom_thumbnail.jpg'
 967    path_proxy = '/some/folder/custom_proxy.mov'
 968    category = 'Q235544'  #  or: 'flame'
 969    colorspace = 'ACES2065-1'
 970    tags = ['Q3196', 'foo', 'bar']
 971    media_type = 'sequence'
 972    permission = '110'
 973    metadata = {'foo': 'bar', 'bar': 'buz huz'}
 974    additionals = [{'path': '/file/additional.exr', 'type': 'texture', 'name': 'alpha'}]
 975
 976    entity = de.ingest(library_path, mapping, path, category, colorspace=colorspace, path_thumbnail=path_thumbnail, path_proxy=path_proxy, tags=tags, media_type=media_type, permission=permission, metadata=metadata, additionals=additionals)
 977    print(entity)
 978    print(entity.get('path'))
 979    ```
 980
 981    **Example result**:
 982    `{"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","rating": "3","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", "permission": "110", "width": 3342}`
 983
 984    **Example command line command**:
 985    `das-element-cli ingest --library /mnt/library/das-element.lib --mapping "copy & rename" --path /some/file/path.%04d.exr --category Q3196 --tags foo,bar,baz --colorspace ACES2065-1 --media_type sequence --metadata foo bar -m lens "70 mm" --path_thumbnail /file/path/thumbnail.jpg --path_proxy /file/path/proxy.mov --additional /path/additional.exr texture alpha`
 986    '''
 987    command = ['--config', config] if config else []
 988    command += [
 989        'ingest', '--library',
 990        as_quoted_string(library_path), '--mapping',
 991        as_quoted_string(mapping), '--path',
 992        as_quoted_string(path), '--path_thumbnail',
 993        as_quoted_string(path_thumbnail), '--path_proxy',
 994        as_quoted_string(path_proxy), '--category',
 995        as_quoted_string(category), '--colorspace',
 996        as_quoted_string(colorspace), '--tags',
 997        as_quoted_string(','.join(tags)), '--media_type',
 998        as_quoted_string(media_type), '--permission',
 999        as_quoted_string(permission)
1000    ] + [
1001        item for key_value in metadata.items() for item in
1002        ['-m',
1003         as_quoted_string(key_value[0]),
1004         as_quoted_string(key_value[1])]
1005    ] + [
1006        item for additional in additionals for item in [
1007            '-a',
1008            as_quoted_string(additional.get('path', '')),
1009            as_quoted_string(additional.get('type', '')),
1010            as_quoted_string(additional.get('name', ''))
1011        ]
1012    ]
1013
1014    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)
  • colorspace (str): [optional] Colorspace name
  • tags (List[str]): [optional] List of tags
  • media_type (str): [optional] Media type of element. Valid options: image, sequence, movie, sphere, pdf, project-file, 3d-model, 3d-scene, generic
  • permission (str): [optional] Permission flag
  • metadata (Dict[str, str]): [optional] List of metadata as: {key:value}
  • additionals (List[Dict[str, str]]): [optional] List of additionals. Provide additional as: /path type name

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'
colorspace = 'ACES2065-1'
tags = ['Q3196', 'foo', 'bar']
media_type = 'sequence'
permission = '110'
metadata = {'foo': 'bar', 'bar': 'buz huz'}
additionals = [{'path': '/file/additional.exr', 'type': 'texture', 'name': 'alpha'}]

entity = de.ingest(library_path, mapping, path, category, colorspace=colorspace, path_thumbnail=path_thumbnail, path_proxy=path_proxy, tags=tags, media_type=media_type, permission=permission, metadata=metadata, additionals=additionals)
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","rating": "3","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", "permission": "110", "width": 3342}

Example command line command: das-element-cli ingest --library /mnt/library/das-element.lib --mapping "copy & rename" --path /some/file/path.%04d.exr --category Q3196 --tags foo,bar,baz --colorspace ACES2065-1 --media_type sequence --metadata foo bar -m lens "70 mm" --path_thumbnail /file/path/thumbnail.jpg --path_proxy /file/path/proxy.mov --additional /path/additional.exr texture alpha

def predict(path, model, top=2, filmstrip_frames=36):
1017def predict(path, model, top=2, filmstrip_frames=36):
1018    '''
1019    Predict the category for a give file path.
1020
1021    The give path can be a file or a directory.  
1022    If a directory is provided, all sub-directories will be searched for files and sequences.
1023
1024
1025    **Args**:
1026
1027    > - **model** (str): *Define a custom model file path (.wit)*
1028    > - **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*
1029    > - **top** (int): [optional] *Return the top X predictions*
1030
1031
1032    **Returns**:
1033    > - Dict[str, List[Dict]]: *Key is the file path. The value a list of predicted categories*
1034
1035
1036    **Example result**:
1037    `{"/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"}}]}]}`
1038
1039
1040    **Example command line command**:
1041    `das-element-cli predict --top=2 /some/file/path`
1042
1043    '''
1044    command = ['predict', '--top', top, '--filmstrip_frames', filmstrip_frames]
1045    command += ['--model', as_quoted_string(model)]
1046    command += ['--filmstrip_frames', filmstrip_frames]
1047    command += ['--top', top]
1048    command += [as_quoted_string(path)]
1049    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):
1052def get_paths_from_disk(path, as_sequence=True):
1053    '''
1054    Recursivly searches for files and sequences in a given directory. Since version 1.2.5
1055
1056    The give path can be a file or a directory.  
1057    If a directory is provided, all sub-directories will be searched for files and sequences.
1058
1059
1060    **Args**:
1061
1062    > - **as_sequence / as_single_files** (bool): [optional] defines if files with a sequential naming should be detected as a file sequence or individual files
1063
1064
1065    **Returns**:
1066    > - List[str]: *List of file paths found in the give directory*
1067
1068
1069    **Example result**:
1070    `["/some/file/path.1001-1099#.exr", "/other/path.mov"]`
1071
1072
1073    **Example command line command**:
1074    `das-element-cli get-paths-from-disk --as_sequence /some/file/path`
1075
1076    '''
1077    command = ['get-paths-from-disk']
1078
1079    if as_sequence:
1080        command += ['--as_sequence']
1081    else:
1082        command += ['--as_single_files']
1083
1084    command += [path]
1085    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):
1088def get_meaningful_frame(path):
1089    '''
1090    Validate meaningful thumbnail frame number for movie file or image sequence
1091
1092
1093    **Args**:
1094
1095    > - **path** (str): *file path to movie file or image sequence - single frame of a file sequence can be provided*
1096
1097
1098    **Returns**:
1099    > - int: *Returns frame number of meaningful thumbnail frame*
1100
1101
1102    **Example result**:
1103    `1042`
1104
1105
1106    **Example command line command**:
1107    `das-element-cli get-meaningful-frame /folder/some_file.mov`
1108    `das-element-cli get-meaningful-frame /folder/frame_sequence.1001.exr`
1109    `das-element-cli get-meaningful-frame /folder/frame_sequence.####.exr`
1110    `das-element-cli get-meaningful-frame /folder/frame_sequence.%04d.exr`
1111
1112    '''
1113    command = ['get-meaningful-frame', path]
1114
1115    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):
1118def render_element_proxies(element_uuid, mapping, library_path=None):
1119    '''
1120    Render the proxy files for an element based on a template mapping
1121
1122    If the library is provided it will directly try to get to element for that library.
1123    Otherwise it tries to get the entity each library that's defined in the config.
1124
1125    **Args**:
1126    > - **element_uuid** (str): *Element UUID (unique ID) in the database*
1127    > - **mapping** (str): *name of the template mapping that gets rendered*
1128    > - **library_path** (str): *[optional] File path to the library file (.lib)*
1129
1130    **Returns**:
1131    > - bool: *Result of render jobs*
1132
1133
1134    **Example result**:
1135    `true`
1136
1137
1138    **Example command line command**:
1139    `das-element-cli render-element-proxies 9947c549c6014a3ca831983275884051 "render proxies" --library /some/path/das-element.lib`
1140
1141    '''
1142    command = ['render-element-proxies', element_uuid, mapping]
1143
1144    if library_path:
1145        command += ['--library', library_path]
1146
1147    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