Items

Interface for Items

Interface helpers for the user of items in Vidispine.

class portal.vidispine.iitem.IngestHelper(user=None, runas=None, *args, **kwargs)

Helper class for performing ingest

copyEssenceVersion(source_item_id, source_version=None, destination_item_id=None, tags=None, recreateExistingTags=True, skip_essence_version_update=False)

Copy an existing version either to a new item or to an existing one.

Args: * source_item_id - The source item * source_version - The version to copy, if None then the latest version is copied * destination_item_id - The item to copy to, if None then the same as source is used * tags - the list of tags to transcode to * recreateExistingTags - If set, the existing tags will be recreated on the new version * skip_essence_version_update - If True, the job will not update “portal_essence_version” on the item.

Returns * A vidispine object for the job created

generateImportPassKey(transferId, metadata_document=None, externalIds=None, tags=None, ingestprofile_groups=None, settingsprofile_id=None, createPosters=None, notification_id=None, originalFilename=None, addToCollections=None, storage_id=None, *args)

Creates a job and generates a passkey that can later be used to import an item without being authenticated.

Args:
  • transferId: An id to assign the transfer to be able to refer to it. Required.

  • metadata_document: A pyxb metadata document object. Optional.

  • externalIds: An optional list of external ids that are applied to the item.

  • tags: Shape tags to be transcoded to. Optional.

  • ingestprofile_groups: A list of groups which the ingest profiles will be used for this ingest

  • settingsprofile_id: Optional settings profile

  • createPosters: If set, poster images will be created

  • notification_id = If set, the notification template will be used to send notifications for this job

  • originalFilename = The filename to be set on the file. If not set, a name will be generated automatically.

  • addToCollections = A comma-separated list of collection ids this item should be added to while ingesting

  • storage_id = Storage ID that specifies where the essence file will be stored.

Returns:
  • A VSJob

Signals raised:
  • Pre ingest: sender=self.__class__, instance=transferId, method=”generateImportPassKey”, metadata_document=metadata_document, query=_query

  • Post ingest: sender=self.__class__, instance=transferId, method=”generateImportPassKey”

importFileFromStorage(storage_id, file_id, metadata_document=None, ingestprofile_groups=None, tags=None, settingsprofile_id=None, createPosters=None, notification_id=None, *args)

Import a file from the storage given a file ID

Args:
  • storage_id: The storage ID.

  • file_id: The ID to the file in the storage.

  • metadata_document: A pyxb metadata document object. Optional.

  • ingestprofile_groups: A list of groups which the ingest profiles will be used for this ingest

  • tags: Shape tags to be transcoded to. Optional.

  • settingsprofile_id: Optional settings profile

  • createPosters: If set, poster images will be created

  • notification_id = If set, the notification template will be used to send notifications for this job

Returns:
  • A Vidispine object for the job created

Signals raised:
  • Pre ingest: sender=self.__class__, instance=file_id, method=”importFileFromStorage”, storage_id=storage_id, metadata_document=metadata_document, query=_query

  • Post ingest: sender=self.__class__, instance=file_id, method=”importFileFromStorage”

importFileToPlaceholder(item_id, file_id=None, uri=None, tags=None, ingestprofile_groups=None, createPosters=None, notification_id=None, fastStartLength=None, jobmetadata=None, noTranscode=None, ignore_sidecars=False)

Import a file given a file ID or a URI, to an existing placeholder

Args:
  • item_id: The placeholder ID.

  • file_id: An optional file ID.

  • uri: An optional URI to the file.

  • tags: Shape tags to be transcoded to. Optional.

  • ingestprofile_groups: A list of groups for which the ingest profiles will be used for this ingest

  • createPosters: If set, poster images will be created

  • notification_id = If set, the notification template will be used to send notifications for this job

  • jobmetadata: Additional jobmetadata sent to vidispine

  • noTranscode: If set to true, then no transcoding takes place when ingesting. Valid options are “true” or

    “false” as a string.

  • ignore_sidecars: If True, the job will not try to find sidecar files to the imported file. Default is

    False.

Returns:
  • A Vidispine object for the job created

Signals raised:
  • Pre ingest: sender=self.__class__, instance=item_id, method=”importFileToPlaceholder”, query=_query

  • Post ingest: sender=self.__class__, instance=item_id, method=”importFileToPlaceholder”

importFiles(url, metadata_document=None, tags=None, ingestprofile_groups=None, settingsprofile_id=None, createPosters=None, notification_id=None, *args)

Import a file given a URL

Args:
  • url: The URL to the file to be ingested.

  • metadata_document: A PyXB metadata document object. Optional.

  • ingestprofile_groups: A list of groups which the ingest profiles will be used for this ingest

  • tags: Shape tags to be transcoded to. Optional.

  • settingsprofile_id: Optional settings profile

  • createPosters: If set, poster images will be created

  • notification_id = If set, the notification template will be used to send notifications for this job

Returns:
  • A Vidispine object for the job created

Signals raised:
  • Pre ingest: sender=self.__class__, instance=url, method=”importFiles”, metadata_document=metadata_document, query=_query

  • Post ingest: sender=self.__class__, instance=url, method=”importFiles”

importNewEssence(item_id, uri=None, file_id=None, tags=None, ingestprofile_groups=None, createPosters=None, recreateExistingTags=True, notification_id=None, jobmetadata=None)

Import a new essence

Args:
  • item_id: The placeholder ID.

  • file_id: An optional file ID.

  • uri: An optional URI to the file.

  • tags: Shape tags to be transcoded to. Optional.

  • ingestprofile_groups: A list of groups which the ingest profiles will be used for this ingest

  • createPosters: If set, poster images will be created

  • recreateExistingTags: If set, the existing tags already created will be recreated for the new essence

  • notification_id: If set, the notification template will be used to send notifications for this job

  • jobmetadata: override the jobmetadata sent to vidispine (overrides ingestprofile_groups)

Returns:
  • A Vidispine object for the job created

Signals raised:
  • Pre ingest: sender=self.__class__, instance=item_id, method=”importNewEssence”, query=_query

  • Post ingest: sender=self.__class__, instance=item_id, method=”importNewEssence”

importNewEssenceRaw(item_id, body, filename=None, storageId=None)

Import a new essence. This is really only suitable for small files. Consider using raw-passkey import and send the data directly to vidispine if body is larger than a few megabytes.

Args:
  • item_id: The item id

  • body: The body of the new essence

  • filename: The filename to upload the new essence as.

Returns:
  • A Vidispine object for the job created

importNewShape(item_id, uri=None, file_id=None, tag=None, notification_id=None, jobmetadata=None)

Import a new shape

Args:

item_id: The placeholder ID. file_id: An optional file ID. uri: An optional URI to the file. tag: Shape tag to be ingested to. Optional. notification_id: If set, the notification template will be used to send notifications for this job jobmetadata: Additional jobmetadata to send to the Vidispine job

Returns:

A Vidispine object for the job created

Signals raised:

Pre ingest: sender=self.__class__, instance=item_id, method=”importNewEssence”, query=_query Post ingest: sender=self.__class__, instance=item_id, method=”importNewEssence”

importSidecar(item_id, body)

Import a sidecar file

Args:
  • item_id: The item id

  • body: The body of the sidecar file

Returns:
  • A Vidispine object for the job created

class portal.vidispine.iitem.ItemHelper(user=None, runas=None, *args, **kwargs)

This is just an interface to the helper classes provided by VidiREST

addEntryToItemACL(item_id, entry_document)

Add an item ACL entry to an item

Args:
  • item_id: An item ID.

  • entry_document: A pyxb ACL entry document.

Returns:
  • Newly created entry ID

Signals raised:
  • Pre modify: sender=self.__class__, instance=item_id, method=”addEntryToItemACL”, entry_document=entry_document

  • Post modify: sender=self.__class__, instance=item_id, method=”addEntryToItemACL”

addEntryToItemACLBulk(item_id, entry_document)

Adds ACL entries to a item

Args:
  • item_id: Id of the item.

Returns:
  • Newly created entry id

Signals raised:
  • Pre modify: sender=self.__class__, instance=item_id, method=”addEntryToItemACL”, entry_document=entry_document # noqa

  • Post modify: sender=self.__class__, instance=item_id, method=”addEntryToItemACL”

addEntryToMetadataFieldACL(field_name, metadatafieldacl_document)

Add an item ACL entry to a metadata field

Args:
  • field_name: A metadata field name.

  • metadatafieldacl_document: A pyxb metadata field ACL entry document.

Returns:
  • Newly created entry ID

Signals raised:
  • Pre modify:

    sender=self.__class__, instance=field_name, method=”addEntryToMetadataFieldACL”, metadatafieldacl_document=metadatafieldacl_document

  • Post modify:

    sender=self.__class__, instance=field_name, instance_type=’field’, method=”addEntryToMetadataFieldACL”

addEntryToMetadataFieldGroupACL(group_name, metadatafieldacl_document)

Add an item ACL entry to a metadata field group

Args:
  • group_name: A metadata field group name.

  • metadatafieldacl_document: A pyxb metadata field ACL entry document.

Returns:
  • Newly created entry ID

Signals raised:
  • Pre modify:

    sender=self.__class__, instance=group_name, method=”addEntryToMetadataFieldGroupACL”, metadatafieldacl_document=metadatafieldacl_document

  • Post modify:

    sender=self.__class__, instance=group_name, method=”addEntryToMetadataFieldGroupACL”

addFieldToMetadataFieldGroup(group_name, field_name)

Add a field to a metadata field group

Args:
  • group_name: Name of the metadata field group

  • field_name = Name of the metadata field

Returns:
  • Result of adding field to metadata field group

Signals raised:
  • Pre modify:

    sender=self.__class__, instance=group_name, method=”addFieldToMetadataFieldGroup”, field_name=field_name)

  • Post modify:

    sender=self.__class__, instance=group_name, method=”addFieldToMetadataFieldGroup”

addGroupToMetadataFieldGroup(parent_group_name, child_group_name)

Add a group to a metadata field group

Args:
  • parent_group_name: Name of the metadata parent group.

  • child_group_name: Name of the metadata child group.

Returns:
  • Result of adding group to metadata field group

Signals raised:
  • Pre modify:

    sender=self.__class__, instance=parent_group_name, method=”addGroupToMetadataFieldGroup”, child_group_name=child_group_name

  • Post modify:

    sender=self.__class__, instance=parent_group_name, method=”addGroupToMetadataFieldGroup”

canDeleteItem(item_id)

Checks if the user has delete permissions for a item

Parameters

item_id – {string} ‘VX-1’

Returns

{Bool} Weather the user can delete the item or not.

clear_system_metadata(item_id)

This will clear the system-metadata attached to item This is used when returning an item to a placeholder to clear the system metadata of the previous item

The different system metadata fields are: http://apidoc.vidispine.com/latest/item/metadata/metadata.html#metadata-defined-by-the-systems

createEmptyLibrary(**kwargs)

Creates an empty library in Vidispine.

Raises the same signals as createLibraryFromItemList, but with item_id_list=[].

Args:
  • None

Returns:
  • The Vidispine library structure

createItemRelation(item_source, item_target, undirectional=False, keywords=None)

Creates a relationship between two items

Args:
  • item_source: The source item ID

  • item_target - The target item ID

  • undirectional - If set to False the relationship will be directional from source to target. Else undirectional. Default is False.

  • keywords - A dict containing the keywords to apply to the relation

Returns:
  • A VSItemRelationship object representing the created item relationship

Signals raised:
  • Pre modify: sender=self.__class__, instance=item_source, method=”createItemRelation”, item_target=item_target, undirectional=undirectional

  • Post modify: sender=self.__class__, instance=item_source, method=”createItemRelation”, item_target=item_target, undirectional=undirectional

createItemShape(item_id, shape_document)

Creates a new shape on an item using a shape document. This function calls http://apidoc.vidispine.com/latest/ref/item/shape.html#create-a-shape-using-shape-technical-information and the same limtations apply to this function.

Signals raised:
  • Pre create:

    sender=self.__class__, instance=group_name, method=”createOrModifyMetadataFieldGroup”, group_name=group_name, mfg_document

  • Post create:

    sender=self.__class__, instance=group_name, method=”createOrModifyMetadataFieldGroup”

Parameters
  • item_id – The item id

  • shape_document – A shape document

Returns

None

createLibraryFromItemList(item_id_list, prevent_automatic_deletion=False, *args)

Creates a library in Vidispine

Args:
  • item_id_list: A list of item ids to be includedd in the library

  • prevent_automatic_deletion: If True, this library will be set to not be deleted. By default

    Vidispine automatically deletes all libraries after 24h of no access.

Returns:
  • The Vidispine library structure

Signals raised:
  • Pre create: sender=self.__class__, instance=None, method=”createLibraryFromItemList”, item_id_list=item_id_list

  • Post create: sender=self.__class__, instance=created_lib, method=”createLibraryFromItemList”

createOrModifyGlobalMetadataInstance(metadata_document, matrix=None)

Set or update a global metadata instance. For creating a new, make sure the mode parameter is set to ‘add’ in the metadata_document object. For modifying, add the uuid.

Args:
  • metadata_document: A VidiRest.schema.MetadataDocument object

  • matrix: A matrix to define the contents of the GET request

Returns:
  • Result of setting item metadata

Signals raised:
  • Pre modify:

    sender=self.__class__, instance=metadata_document, method=”createOrModifyGlobalMetadataInstance”, matrix=matrix

  • Post modify:

    sender=self.__class__, instance=metadata_document, method=”createOrModifyGlobalMetadataInstance”

Example

from portal.vidispine.iitem import ItemHelper
import VidiRest.schemas.xmlSchema as VSXMLSchema

# This is equivalent to the following XML:
"""
<?xml version="1.0"?>
<MetadataDocument xmlns="http://xml.vidispine.com/schema/vidispine">
  <group>Actor</group>
  <timespan end="+INF" start="-INF">
    <group mode="add">
      <name>Actor</name>
      <field>
        <name>portal_mf913516</name>
        <value>1931-02-08T09:00:00-05:00</value>
      </field>
      <field>
        <name>portal_mf731740</name>
        <value>Dean</value>
      </field>
      <field>
        <name>portal_mf793831</name>
        <value>James</value>
      </field>
    </group>
  </timespan>
</MetadataDocument>
"""

group = VSXMLSchema.MetadataGroupValueType()
group.name = "Actor"

field1 = VSXMLSchema.MetadataFieldValueType(name="portal_mf913516")
field1.value_ = [VSXMLSchema.MetadataValueType("1931-02-08T09:00:00-05:00")]

group.field = [field1]
group.mode = "add"

timespan = VSXMLSchema.MetadataTypeTimespan(
             start='-INF',
             end='+INF',
             field=[],
             group=[group])
md = VSXMLSchema.MetadataDocument(timespan=[timespan])

ith = ItemHelper(runas=request.user)
res = ith.createOrModifyGlobalMetadataInstance(md)
createOrModifyMetadataField(field_name, metadatafield_document, skip_signals=False)

Creates or modifies a metadata field

Args:
  • field_name: Name of the metadata field

  • metadatafield_document: A pyxb metadata field document

  • skip_signals: Avoid sending signals

Returns:
  • Result of creating a metadata field

Signals raised:
  • Pre modify:

    sender=self.__class__, instance=field_name, method=”createOrModifyMetadataField”, field_name=field_name, metadatafield_document=metadatafield_document

  • Post modify:

    sender=self.__class__, instance=field_name, method=”createOrModifyMetadataField”

createOrModifyMetadataFieldData(field_name, key, value)

Creates or modifies a metadata field data

Args:
  • field_name: Name of the metadata field

  • key = The key in the key/value pair

  • value = The value in the key/value pair

Returns:
  • Result of creating or modifying a metadata field data

Signals raised:
  • Pre modify:

    sender=self.__class__, instance=field_name, method=”createOrModifyMetadataFieldData”, key=key, value=value

  • Post modify:

    sender=self.__class__, instance=field_name, method=”createOrModifyMetadataFieldData”

createOrModifyMetadataFieldGroup(group_name, mfg_document=None)

Creates a metadata field group

Args:
  • group_name: Name of the metadata field group

  • mfg_document: An optional MetadataFieldGroupDocument. Default is None.

Returns:
  • Result of creating a metadata field group

Signals raised:
  • Pre create:

    sender=self.__class__, instance=group_name, method=”createOrModifyMetadataFieldGroup”, group_name=group_name, mfg_document

  • Post create:

    sender=self.__class__, instance=group_name, method=”createOrModifyMetadataFieldGroup”

createOrModifyMetadataFieldGroupData(group_name, key, value)

Creates or modifies a metadata field group data

Args:
  • group_name: Name of the metadata field group

  • key = The key in the key/value pair

  • value = The value in the key/value pair

Returns:
  • Result of creating or modifying a metadata field group data

Signals raised:
  • Pre modify:

    sender=self.__class__, instance=group_name, method=”createOrModifyMetadataFieldGroupData”, key=key, value=value

  • Post modify:

    sender=self.__class__, instance=group_name, method=”createOrModifyMetadataFieldGroupData”

createOrModifyMetadataFieldValues(field_name, simplemetadata_document, skip_signals=False)

Creates or modifies a metadata field

Args:
  • field_name: Name of the metadata field

  • simplemetadata_document: A pyxb metadata field document

  • skip_signals: Avoid sending signals

Returns:
  • Result of creating a metadata field

Signals raised:
  • Pre modify:

    sender=self.__class__, instance=field_name, method=”createOrModifyMetadataField”, field_name=field_name, metadatafield_document=simplemetadata_document

  • Post modify:

    sender=self.__class__, instance=field_name, method=”createOrModifyMetadataField”

createOrModifyShapeTag(tag_name, transcodepreset_document)

Creates or modifies a shape tag

Args:
  • tag_name: Name of the shape tag

  • transcodepreset_document = A pyxb transcode preset document

Returns:
  • Result of creating or modifying a shape tag

Signals raised:
  • Pre modify:

    sender=self.__class__, instance=tag_name, method=”createOrModifyShapeTag”, transcodepreset_document=transcodepreset_document

  • Post modify:

    sender=self.__class__, instance=tag_name, method=”createOrModifyShapeTag”

createOrModifyShapeTagStorageRule(tag_name, storagerule_document)

Creates or modifies a storage rule for a shape tag

Args:
  • tag_name: Name of the shape tag

  • storagerule_document = A pyxb storage rule preset document

Returns:
  • A VSStorageRule object

Signals raised:
  • Pre modify:

    sender=self.__class__, instance=tag_name, method=”createOrModifyShapeTagStorageRule”, storagerule_document=storagerule_document

  • Post modify: sender=self.__class__,

    instance=tag_name, method=”createOrModifyShapeTagStorageRule”

createPlaceholder(metadata_document, settingsprofile_id=None, *args)

Creates a placeholder in Vidispine

Args:
  • metadata_document: A pyxb metadata document.

  • settingsprofile_id: Optional settingsprofile id, in order to define the rights of the item

Returns:
  • A VSItem object representing the item

Signals raised:
  • Pre create:

    sender=self.__class__, instance=None, method=”createPlaceholder”

  • Post create:

    sender=self.__class__, instance=new_item.getId(), method=”createPlaceholder”

createPostersUsingTimecodes(item_id, smptetimecode, notification_id=None)

Create poster images using a list of time codes

Args:
  • item_id: The ID to the item.

  • smptetimecode: A SMPTE timecode for the point that the poster should be created.

  • notification_id = If set, the notification template will be used to send notifications for this job

Returns:
  • A VSJob object representing the job for creating the posters

Signals raised:
  • Pre create: sender=self.__class__, instance=item_id, method=”createPostersUsingTimecodes”,item_id=item_id, timecode_list=timecode_list, notification_id=notification_id, query=query

  • Post create: sender=self.__class__, instance=item_id, method=”createPostersUsingTimecodes”

createSettingsProfile(group_permissions)

Creates a settings profile in Vidispine

Args:
  • group_permissions: A list of group permissions objects.

Returns:
  • A VSSettingsProfile object representing the settings profile

Signals raised:
  • Pre create: sender=self.__class__, instance=group_permissions, method=”createSettingsProfile”

  • Post create: sender=self.__class__, instance=settings_profile.getId(), method=”createSettingsProfile”

createThumbnail(item_id, vidispinetimecode)

Create thumbnail images using a vidispine timecode format

Args:
  • item_id: The ID to the item.

  • vidispinetimecode: A Vidispine timecode for the point that the thumbnail should be created.

Returns:
  • A VSJob object representing the job for creating the thumbnail

createThumbnailUsingTimecodes(item_id, smptetimecode, notification_id=None)

Create thumbnail images using a list of time codes

Args:
  • item_id: The ID to the item.

  • smptetimecode: A SMPTE timecode for the point that the thumbnail should be created.

  • notification_id = If set, the notification template will be used to send notifications for this job

Returns:
  • A VSJob object representing the job for creating the thumbnail

Signals raised:
  • Pre create: sender=self.__class__, instance=item_id, method=”createThumnailsUsingTimecodes”,item_id=item_id, timecode_list=timecode_list, notification_id=notification_id, query=query

  • Post create: sender=self.__class__, instance=item_id, method=”createThumbnailssUsingTimecodes”

deletePoster(resource_id, item_id, time_code, version, return_format='json')

Delete item poster

Args:
  • resource_id = The thumbnail resource ID

  • item_id = The item ID

  • time_code = The thumbnail time code

  • version = The thumbnail version

export(item_id, tag_name, uri, useOriginalFilename=False, jobpriority=None, metadataprojection=None, jobmetadata=None, *args)

Export a shape tag to a given URI.

Args:
  • item_id: The item ID

  • tag_name: The shape tag name to be transcoded

  • uri: The URI to be exported to

  • metadataprojection: If set, the metadata of the item will be exported as well using this projection

  • jobpriority: Set the priority of the job - Added in version 3.2.0

  • jobmetadata: Optional metadata to be sent to the job - as “locationName”

Returns:
  • Vidispine return structure of a job

Signals raised:
  • Pre create: sender=self.__class__, instance=item_id, method=”export”,tag_name=tag_name, uri=uri, metadataprojection=metadataprojection

  • Post create: sender=self.__class__, instance=item_id, method=”export”

getAllGlobalMetadataInstances(matrix=None)

Get all global metadata field group instances

Args:
  • matrix: Optinal matrix to be sent with the API call.

Returns:
  • A list of VSMetadataFieldGroup object

getAllGlobalMetadataInstancesByGroup(group_name, matrix=None)

Get all global metadata field group instances for a specific group

Args:
  • group_name: Return instances belonging to this specific group

  • matrix: Optinal matrix to be sent with the API call.

Returns:
  • A list of VSMetadataFieldGroup object

getAllItemIds(max_hits=None)

Returns all the items in the system as a list using a generator function :param max_hits: The max amount of hits until being returned, if None it will return all IDs

getAllItemIdsGenerator(max_hits=None)

A generator function that returns all item ids in vidispine. :param max_hits: The max amount of hits until being returned, if None it will return all IDs

getAllItemRelations(item_id, direction=None, keywords=None)

Get all item relations

Args:
  • item_id = The item ID

  • direction - only return certain directions

    direction=U Only return undirectional relations direction=S Only return directional relations where id is the source item direction=T Only return directional relations where id is the target item direction=D Only return directional relations where id is the source or target item direction=A (default) Return all relations where id is a part of

  • keywords - A dict on the form {}

Returns:
  • A list of VSItemRelationship objects representing the item relationship

getAllLibraries(first=None, number=None, update_mode=None, *args)

Get a list of all the libraries in the system

Args:
  • first: the first library to fetch

  • number: the number of libaries to fetch

  • update_mode: vidispine updateMode param (valid options: ‘TRANSIENT’, ‘MERGE’, ‘REPLACE’)

Returns:
  • A list of VSLibrary objects

getAllMetadataFields(onlySortables=False, includeSystemFields=True, onlyReusables=False, onlyXMP=False, ignore_cache=False)

Get all metadata fields in the system

Args:
  • onlySortables: Optional argument for returning only sortable metadata fields. Default: False.

  • includeSystemFields: Optional argument for including system fields. Default: True

  • onlyReusables: Optional argument for returning only fields that can be reused in other groups. Default: False

  • onlyXMP: Optional argument for returning only xmp fields, which are similar to reusable fields, but gets some special treatment. Default: False

Returns:
  • A list of VSMetadataField objects

getAllNotifications()

Returns a list of item notifications

getAllPossibleShapeTags(item_id, limitToType=None, includeFullList=False)

Get all possible shape tags for an item. This returns all shape tags that are not already available for the give item.

Args:
  • item_id: An item ID.

  • limitToType: Only return tags of this type, default is None

  • includeFullList: if set to true, a list of all shape tags is returned as well, default is set to False

Returns:
  • A list of shape tag names

getAllProjections()

Get all available metadata projections

Args:
  • None

Returns:
  • Vidispine metadata projection structure

getAllShapeTags()

Get all available shape tags

Args:
  • None

Returns:
  • Vidispine shape tags structure

getAllShapeTagsInFull(inGrouping=True, limitToType=None, includeOriginal=False, includeDataShapes=False, roleAware=False)

Get all available shape tags in full format

Args:
  • inGrouping: If set to true, the tags will be grouped in to types, default is True

  • limitToType: Only return tags of this type, will be ignored if inGroupis is False, default is None

  • includeOriginal: Include the orignal tag. This is needed for the export view, but not the admin or transcode views.

  • includeDataShapes: Boolean that represents if data and document tags should be returned

  • roleAware: If the call should filter the tags based on roles as well.

Returns:
  • Vidispine shape tags structure depending on the parameters set for this function

getAllUserRepresentativeMetadataFields()

Get list of all representative metadata fields in the system.

Args:
  • None

Returns:
  • list(VSMetadataField)

getEssenceVersionMetadataChanges(item_id)

Get the metadata changes for portal_essence_version on an item

Returns

[{‘user’: ‘admin’, ‘item’: ‘VX-10’, ‘timestamp’: “2013-08-22T13:51:42.622+02:00”, ‘change’: ‘VX-9759’}]

  • timestamp - the time when the change was made

  • user - the user who made the change

  • change - the metadata change ID

  • item - the Item ID that had the change

getFilesFromItemShape(item_id, shape)

Returns fileID and Storage ID tuple for a shape in a list

getGlobalMetadataInstance(uuid, matrix=None)

Get a global metadata field group instances given a UUID

Args:
  • uuid: The UUID of the metadata instance

Returns:
  • A VSMetadataFieldGroup object

getItem(item_id, content=None, includeSubtitles=False, includeComments=False, version=None, *args)

Gets an item from Vidispine.

Args:
  • item_id: Id of the item.

  • content: Optional content dictionary to define what element of the item to include.

  • includeSubtitles: Normally subtitle metadata isn’t included. This flags allows the caller to request subtitle metadata to be included.

  • includeComments: Normally comment metadata isn’t included. This flags allows the caller to request comment metadata to be included.

  • version: The version number to get. Defaults to the latest version. See getRevisionForEssenceVersion

    for details on how metadata works with versions.

Returns:
  • A VSItem object representing the item

getItemACL(item_id, *args)

Gets the item ACL from Vidispine.

Args:
  • item_id: Id of the item.

Returns:
  • A VSACL object representing the item ACL

getItemACLEntry(item_id, access_id, *args)

Gets a particular item ACL from Vidispine

Args:
  • item_id: ID of the item

  • access_id: Access ID (or ACL ID)

Returns:
  • A VSACL Object representing the particular access control.

getItemACLMerged(item_id, username=None, type='GENERIC', permission='NONE', *args)

Gets the merged item ACL from Vidispine.

Args:
  • item_id: Id of the item.

  • username: Merged ACL for this user

  • type: Filter on this type and above. Default: ‘GENERIC’

  • permission: Filter on this permission and above. Default: ‘NONE’

Returns:
  • A VSACLMerged object representing the item ACL

getItemACLMergedGroups(item_id, *args)

Retrieving a list of applied access control entries that affects groups

Args:
  • item_id: Id of the item.

Returns:
  • A VSACLMerged object representing the item ACL

getItemCollections(item_id, content=None, only_ids=False)

Get a vidispine item collections

Args:
  • item_id: The id of the collection

  • content: Optional content dictionary to define what element of the collection to include.

  • only_ids: If True only returns the Ids of the collection else returns the entire Collection

Returns:
  • list of collections

getItemCollectionsAndAncestorCollectionsIds(item_id)

Given an item_id, retrieves a set with ids of all the collections and ancestor collections the item is in, based on the

__ancestor_collection and __collection metadata fields

getItemFCPXML(item_id, *args)

Gets an FCP XML for the item from Vidispine.

Args:
  • item_id: Id of the item.

Returns:
  • An FCP XML string

getItemLibraries(item_id)

Retrieves the ids of all libraries that includes the item :param item_id: item ID :return:

getItemListCallback(uri, format='csv', field='itemId', query=None)

Triggers an item list job in Vidispine with an optional callback. This is the equivalent of http://apidoc.vidispine.com/latest/ref/item/item.html#creating-an-item-list-job

Parameters
  • uri – A uri where the resulting item list will be posted

  • format – The output format, either xml or csv

  • field – A comma-separated list of metadata fields to include in the result.

  • query – Additional query parameters allowed by Vidispine

Returns

A VSJob object representing the ITEM_LIST job

getItemMetadata(item_id, matrix=None, includeSubtitles=False, includeComments=False)

Get the item metadata field

Args:
  • item_id: An item id

  • matrix: Set the matrix of the call, e.g. limit to a set of fields

  • includeSubtitles: Normally subtitle metadata isn’t included. This flags allows the caller to request subtitle metadata to be included.

  • includeComments: Normally comment metadata isn’t included. This flags allows the caller to request comment metadata to be included.

Returns:
  • Vidispine metadata field groups structure

getItemMetadataChanges(item_id, change_id=None, query=None, matrix=None)

Get the item metadata changes for an item

Args:
  • item_id: An item id

  • change_id: Optional parameter for getting a specific change ID

  • query: Set the queries of the call. Optional.

  • matrix: Set the matrix of the call. Optional.

Returns:
  • A VSMetadataChangeSetDocument object

getItemMetadataFieldGroups(item_id)

Get the item metadata field groups belonging to an item

Args:
  • item_id: An item id

Returns:
  • Vidispine metadata field groups structure

getItemOriginalTag(item_id)

Get the item original shape tag

Args:
  • item_id = The item ID

Returns:
  • VSShape object.

getItemRelation(relation_id)

Get the details of a item to item relationship

Args:
  • relation_id: The relation ID

Returns:
  • A VSItemRelationship object representing the item relationship

getItemShape(item_id, shape_id, transient=False)

Get a the item shape, given an item id and a shape id

Args:
  • item_id = The item ID

  • shape_id = The shape ID

Returns:
  • A VSShape object

getItemShapes(item_id)

Get all item shapes

Args:
  • item_id = The item ID

Returns:
  • A list of shape ids

getItemShapesFromNames(item_id, shape_names)

Get a list of item shapes, give a list of shape names

Args:
  • item_id = The item ID

  • shape_names = A comma separated list of shape names

Returns:
  • A list of VSShape objects representing the shapes

getItemVersions(item_id)

Returns a list of item versions, each of which are on the form:

{

‘version’: 17, ‘timestamp’: “2013-08-22T13:51:42.622+02:00”, ‘user’: ‘admin’, ‘change’: ‘VX-9759’, ‘item’: ‘VX-123’, ‘title’: ‘The Item Title’

}

This function combines information from Vidispine APIs item/<id>/, item/<id>/shape/version/ and item/<id>/metadata/changes/

  • version - the version number

  • timestamp - the time when the version was created

  • user - the user who created the version

  • change - the metadata change associated with this essence version

  • item - the Item ID for this version - i.e. item_id

  • title - last value of metadatafield “title” on the version

getItems(item_ids, content=None, includeSubtitles=False, includeComments=False, fallbackToGet=True, *args)

Gets a list of items from Vidispine

Note: Entries in the item_ids list which do not exist in Vidispine will be ignored.

Args:
  • item_ids: List of item ids

  • content: Optional content dictionary to define what element of the item to include.

  • includeSubtitles: Normally subtitle metadata isn’t included. This flags allows the caller to request subtitle metadata to be included.

  • includeComments: Normally comment metadata isn’t included. This flags allows the caller to request comment metadata to be included.

  • fallbackToGet: Normally, the items are fetched from Vidispine via a search. This flag signals that the function should try to directly fetch any items not found via the search

Returns:
  • A list of VSItem objects representing the items

getItemsGenerator(item_ids, content=None, includeSubtitles=False, includeComments=False, fallbackToGet=True, *args)

Gets a list of items from Vidispine as a generator

Note: Entries in the item_ids list which do not exist in Vidispine will be ignored.

Args:
  • item_ids: List of item ids

  • content: Optional content dictionary to define what element of the item to include.

  • includeSubtitles: Normally subtitle metadata isn’t included. This flags allows the caller to request subtitle metadata to be included.

  • includeComments: Normally comment metadata isn’t included. This flags allows the caller to request comment metadata to be included.

  • fallbackToGet: Normally, the items are fetched from Vidispine via a search. This flag signals that the function should try to directly fetch any items not found via the search.

Returns:
  • A generator returning VSItem objects representing the items

getLibrary(library_id, content=None, *args)

Get a library

Args:
  • library_id = The library ID

  • content = Vidispine query for defining the result

Returns:
  • A VSLibrary object represting the library

getLibrarySettings(library_id, *args)

Get the library settings for a give library

Args:
  • library_id = The library ID

Returns:
  • A VSLibrarySettings object represting the library settings

getMetadataField(field_name)

Get a specific metadata field

Args:
  • field_name: Requested metadata field

Returns:
  • A VSMetadataField object

getMetadataFieldACL(field_name)

Retrieves the access control list that is applied to a field.

Args:
  • field_name: Name of the field

Returns:
  • A VSACL object representing the metadata field ACL

getMetadataFieldByLabel(label_name, onlySortables=True, includeSystemFields=True)

Get a specific metadata field by giving the label name

Args:
  • label_name: Requested metadata field label name

  • onlySortables: If set to true, only sortable fields will be searched. Default=True.

  • includeSystemFields: Include system fields? Default=True.

Returns:
  • A VSMetadataField object

getMetadataFieldData(field_name, key)

Get a specific metadata field data, given a key

Args:

field_name: Requested metadata field key: key of the data to be fetched

Returns:

A VSMetadataField object

getMetadataFieldGroup(group_name, query=None)

Get a specific metadata field group

Args:
  • group_name: Requested metadata group name

  • query: Query to be sent with the API call

Returns:
  • A VSMetadataFieldGroup object

getMetadataFieldGroupACL(group_name)

Retrieves the access control list that is applied to a field group.

Args:
  • group_name: Name of the field group

Returns:
  • A VSACL object representing the metadata field group ACL

getMetadataFieldGroupACLMerged(group_name, username)

Retrieves the effective access control list that is applied to a field group.

Args:
  • group_name: Name of the field group

  • username: The user to get the acl for

Returns:
  • A VSACLMerged object representing the metadata field group ACL for the user

getMetadataFieldGroups(content=False, ignore_cache=False)

Get all metadata field groups. If set can utilize cache.

Parameters
  • content (bool, optional) – Optional for getting the group content, defaults to False

  • ignore_cache (bool, optional) – Optional to ignore the cache, defaults to False

Returns

A VSMetadataGroups object with all metadata groups

Return type

VSMetadataGroups

getMetadataFieldTags(field_name, match_string=None, number=10)

Get all tags for a given field.

This function is deprecated and we recomend the use of portal.vidispine.isearch.SearchAutoCompleteHelper.getAutocomplete for the specific field instead.

Args:

field_name: Requested metadata field match_string: String to be matched. Default is None number: The max number of tags to return

Returns:

A list of possible tags.

getMetadataFieldValues(field_name, match_mode=None, match_string=None, hits=None)

Get metadata field possible values

Args:

field_name: Requested metadata field match_mode: String match mode. Possible mode values: value-regex, value-start, value-exact. Default is None match_string: String to be matched. Default is None hits: How many hits to return. Default “None” means all matches.

Returns:

A VSSimpleMetadataDocument object

getPaginatedMetadataInstancesByGroup(group_name, filters_by_field=None, sort=None, page=1, page_size=10)

Get paginated metadata elements for a group

Parameters
  • group_name – group name to get the elements from

  • filters_by_field – a list containing tuples with a field name and the search terms for that field. For instance: [(“field_name”, [“ales”, “sandro”]), …]

  • sort – sorting direction. like field_name or -field_name

  • page – page to get

  • page_size – size of the page.

getRelatedSourcesFromConformDoc(conform_doc)

Returns a list of the item ids used in a conform document :param conform_doc: A vidispine ConformDocument :return: list of item ids

getRevisionForEssenceVersion(itemid, version)

Given an itemid and a version, look through the changes for that version and return the metadata revision which matches the version.

This needs to be done since Vidispine does not automatically match essence versions with metadata versions (revisions).

A description of how metadata versions work, with an example item that has multiple versions:

This is based on the Vidispine API for metadata change sets - :8080/API/item/<item_id>/metadata/changes The change set identifiers are only for illustration, they could be any IDs, in an increasing order.

  • changeSet VX-1: initial metadata

  • more changeSets: modifications to metadata on version 0

  • VX-9: final modification before uploading new version

  • changeSet VX-10: portal_essence_version = 1 - this metadata is set in a ESSENCE_VERSION jobstep once a new essence has been uploaded

  • more changeSets: modifications to metadata on version 1

  • VX-20: final modification before uploading new version

  • changeSet VX-21: portal_essence_version = 2 - set in ESSENCE_VERSION job

  • more changeSets: modifications to metadata on version 2

  • changeSets VX-42: latest change set

From this, the metadata for:
  • original version is up to changeSet VX-9

  • version 1 is up to changeSet VX-20 - the last before portal_essence_version is updated to 2

  • version 2 is the latest metadata, without a specific changeSet or with changeSet VX-42

Vidispine GET item (and metadata) API supports getting metadata at a specific changeSet using the “revision” parameter.

So to get item with shape and metadata at version 1, the call to Vidispine would be:

GET :8080/item/<item_id>/?content=shape,metadata&version=1&revision=VX-20

The revision logic is handled automatically in the getItem() function in this class, so the same call using ItemHelper is simply:

item_helper.getItem(<item_id>, version=1)

getSequence(item_id, type='vidispine')

Get a vidispine sequence

Args:
  • item_id: The id of the sequence

  • type: the kind of sequence to fetch

Returns:
  • Sequence document

getSequenceExport(item_id, type, storage_mapping, tag=None)

Exports a sequence to an NLE format

Args:
  • item_id: The id of the sequence

  • type: The type of nle you want to export to (finalcut, finalcut-x)

  • storage_mapping: The mapping dict from storage-ids to paths on the client

  • tag: The shape name to use from the source item

Returns:
  • Sequence document

getSequenceRenderDocument(item_id, sequence)

Convert an RCE sequence json into a list of Vidispine SequenceTrack XML documents.

This is used when saving an RCE sequence or when rendering it to a new item.

The function creates one video track and as many audio tracks as the max number of audio channels on any of the items in the sequence.

Note: This function only uses the Original shape and does not take the Shape Priorities into account.

getShapeTag(name, getScript=False)

Get a specific shape tag

Args:
  • name: Name of the shape tag

  • getScript: If set to True, it will get possible script for the tag

Returns:
  • Vidispine shape tag structure

getShapeTagStorageRule(tag_name)

Get the storage rule for a specific shape tag

Args:
  • tag_name: Name of the shape tag

Returns:
  • A VSStorageRule object

getShapeURI(item_id, shape_id, method_list=None, file_id=None)

Get the URI for a give shape provided an item id, shape id, and a list of methods, return the URI to the shape with the given method (the method list is prioritized, and the first method found will be returned)

If a file id is provided the shape URI connect to the given file id is returned

Args:
  • item_id = The item ID

  • shape_id = The shape ID

  • file_id = The file ID

  • method_list = A comma separated and prioritized list of preferred methods for the URI

Returns:
  • The URI if one is found. If not, None is returned.

getUniqueMetadataFieldName()

Generates a unique metadata field name

Args:
  • None

Returns:
  • A string

importSequence(xml, type, storage_mapping=None)

Import a sequence xml into vidispine

Args:
  • xml: The sequence xml as a string

  • type: The type of xml. Currently supported are finalcut and finalcut-x

  • storage_mapping: A storage mapping dict from storage-id to client mountpoint {‘VX-1’: ‘/Volumes/media1’}

Returns:
  • An item id for the new sequence

moveMetadataGroupTimeSpan(itemid, uuid, start, end, matrix=None)

Moves the time span of a metadata instance if given an item API and querystring.

Args:
  • itemid: Vidispine item ID.

  • uuid: The unique identifier for the global metadata instance.

  • start: in poiunt fot the metadata.

  • end: out point fot the metadata.

  • matrix: A matrix to define the contents of the GET request

Returns:
  • Complete list of annotations of the item.

recreateThumbnails(item_id)

Recreate thumbnails for an item

Args:
  • item_id: The item ID

Returns:
  • Vidispine return structure of the transcode job

Signals raised:
  • Pre create: sender=self.__class__, instance=item_id, method=”recreateThumbnails”,shape_id=shape_id, tag_name=shape_id, notification_id=notification_id

  • Post create: sender=self.__class__, instance=item_id, method=”recreateThumbnails”

removeFieldFromMetadataFieldGroup(group_name, field_name)

Remove a given metadataa field from parent group

Args:
  • field_name: Name of the metadata field.

  • group_name: Name of the metadata group.

Returns:
  • None

Signals raised:
  • Pre delete:

    sender=self.__class__, instance=parent_group_name, method=”removeFieldFromMetadataFieldGroup”, field_name=field_name

  • Post delete:

    sender=self.__class__, instance=parent_group_name, method=”removeFieldFromMetadataFieldGroup”

removeGlobalMetadataInstance(uuid, matrix=None)

Deletes a global metadata instance

Args:
  • uuid: The UUID of the metadata instance

Returns:
  • Nothing

Signals raised:
  • Pre delete:

    sender=self.__class__, instance=uuid, method=”removeGlobalMetadataInstance”, matrix=matrix

  • Post delete:

    sender=self.__class__, instance=uuid, method=”removeGlobalMetadataInstance”, matrix=matrix

removeGroupFromMetadataFieldGroup(parent_group_name, child_group_name)

Remove a given metadataa child group from parent group

Args:
  • parent_group_name: Name of the metadata parent group.

  • child_group_name: Name of the metadata child group.

Returns:
  • None

Signals raised:
  • Pre delete:

    sender=self.__class__, instance=parent_group_name, method=”removeGroupFromMetadataFieldGroup”, child_group_name=child_group_name

  • Post delete:

    sender=self.__class__, instance=parent_group_name, method=”removeGroupFromMetadataFieldGroup”

removeItem(item_id, skip_archived_copy=False)

Removes an item from Vidispine. Vidispine will remove all associated content. Files sent to archive will be deleted from archive.

Args:
  • item_id: An item id to be removed

  • skip_archived_copy: True if deletion should skip deleting the archived copy otherwise False

Returns:
  • None

Signals raised:
  • Pre delete:

    sender=self.__class__, instance=group_name, method=”removeMetadataFieldGroup”

  • Post delete:

    sender=self.__class__, instance=group_name, method=”removeMetadataFieldGroup”

removeItemACLEntry(item_id, access_id)

Removes an ACL entry from an item

Args:
  • item_id: An item ID.

  • access_id: An ACL entry ID.

Returns:
  • None

Signals raised:
  • Pre delete: sender=self.__class__, instance=item_id, method=”removeItemACLEntry”, access_id=access_id

  • Post delete: sender=self.__class__, instance=item_id, method=”removeItemACLEntry”

removeItemMetadataFieldGroup(item_id, metadatagroup_name)

Remove a metadata group association with an item and clears out any metadata fields

Args:
  • item_id: An item ID.

  • metadatagroup_name: Name of the metadata group

Returns:
  • Nothing

Signals raised:
  • Pre modify:

    sender=self.__class__, instance=item_id, method=”removeItemMetadataFieldGroup”, metadatagroup_name=metadatagroup_name

  • Post modify:

    sender=self.__class__, instance=item_id, method=”removeItemMetadataFieldGroup”

removeItemRelation(relation_id)

Removes a given relationship between two items

Args:
  • relation_id: The relation ID

Returns:
  • None

Signals raised:
  • Pre delete: sender=self.__class__, instance=relation_id, method=”removeItemRelation”

  • Post delete: sender=self.__class__, instance=relation_id, method=”removeItemRelation”

removeItemShape(item_id, shape_id)

Remove an item shape

Args:
  • item_id: An item ID.

  • shape_id: A shape ID.

Returns:
  • None

Signals raised:
  • Pre delete: sender=self.__class__, instance=shape_id, method=”removeItemShape”, item_id=item_id

  • Post delete: sender=self.__class__, instance=shape_id, method=”removeItemShape”

removeLibrary(library_id)

Removes a library from Vidispine.

Args:
  • library_id: A library id to be removed

Returns:
  • None

Signals raised:
  • Pre delete: sender=self.__class__, instance=group_name, method=”removeLibrary”

  • Post delete: sender=self.__class__, instance=group_name, method=”removeLibrary”

removeMetadataField(field_name)

Remove a given metadata field

Args:
  • field_name: Name of the metadata field.

Returns:
  • None

Signals raised:
  • Pre delete:

    sender=self.__class__, instance=field_name, method=”removeMetadataField”, field_name=field_name

  • Post delete:

    sender=self.__class__, instance=field_name, method=”removeMetadataField”

removeMetadataFieldACLEntry(field_name, access_id)

Removes an ACL entry from a metadata field

Args:
  • field_name: A metadata field name.

  • access_id: An ACL entry ID.

Returns:
  • None

Signals raised:
  • Pre delete:

    sender=self.__class__, instance=field_name, method=”removeMetadataFieldACLEntry”, access_id=access_id

  • Post delete:

    sender=self.__class__, instance=field_name, method=”removeMetadataFieldACLEntry”, access_id=access_id

removeMetadataFieldGroup(group_name, remove_fields=True)

Remove a given metadata field group

Args:
  • group_name: Name of the metadata field group.

  • remove_fields: If set to true, all fields within the group will be removed as well. Default=True

Returns:
  • None

Signals raised:
  • Pre delete:

    sender=self.__class__, instance=group_name, method=”removeMetadataFieldGroup”, group_name=group_name

  • Post delete:

    sender=self.__class__, instance=group_name, method=”removeMetadataFieldGroup”

removeMetadataFieldGroupACLEntry(group_name, access_id)

Removes an ACL entry from a metadata field group

Args:
  • group_name: A metadata field group name.

  • access_id: An ACL entry ID.

Returns:
  • None

Signals raised:
  • Pre delete:

    sender=self.__class__, instance=group_name, method=”removeMetadataFieldGroupACLEntry”, access_id=access_id

  • Post delete:

    sender=self.__class__, instance=group_name, method=”removeMetadataFieldGroupACLEntry”, access_id=access_id

removeShapeTag(tag_name)

Removes a shape tag from the system

Args:
  • tag_name: Name of the shape tag

Returns:
  • None

Signals raised:
  • Pre delete:

    sender=self.__class__, instance=tag_name, method=”removeShapeTag”

  • Post delete:

    sender=self.__class__, instance=tag_name, method=”removeShapeTag”

removeShapeTagStorageRule(tag_name)

Removes the storage rule for a specific shape tag

Args:
  • tag_name: Name of the shape tag

Returns:
  • None

Signals raised:
  • Pre delete: sender=self.__class__, instance=tag_name, method=”removeShapeTagStorageRule”

  • Post delete: sender=self.__class__, instance=tag_name, method=”removeShapeTagStorageRule”

renderAnnotationToItem(parent, subclip, new_item_title='', tag='original', md_doc=None)

Render a Portal annotation to new item

Args:
  • parent: The ID of the parent item the annotation belongs to

  • subclip: The annation that will become a new item

  • new_item_title: The title of the rendered item

  • tag: Shapetag that specify the desired output

  • md_doc: VSMetadata document you want the rendered asset to have

Returns:
  • Job Document

renderSequenceToItem(sequence_id, tag, md_doc, ingestprofile_groups=None)

Render a vidispine sequence to new item

Args:
  • sequence_id: The ID of the sequence that you are rendering from

  • tag: The shape tag you want to render to

  • md_doc: VSMetadata document you want the rendered asset to have

  • ingestprofile_groups: A list of user groups whose ingest profiles will be used for transcoding the new item. Note that access control with “Import Settings” is not available in this API.

Returns:
  • Job Document

retranscode(item_id, shape_id, tag_name, create_thumbnails=False, notification_id=None, job_metadata=None, job_priority=None)

Retranscode a shape in an item to a give shape tag

Args:
  • item_id: The item ID

  • shape_id = The ID of the shape to be transcoded

  • tag_name = The shape tag name to be transcoded to

  • create_thumbnails = If true, item thumbnails will be (re)created as part of the transcode job,

    according to default transcoder rules

  • notification_id = If set, the notification template will be used to send notifications for this job

  • job_metadata = Additional metadata passed to the Vidispine Job. Either an encoded string or a dict

    with string keys and values.

  • job_priority = Priority assigned to the job, e.g. ‘MEDIUM’ or ‘HIGH’. If not given the job will use

    system default for this job type, normally ‘MEDIUM’.

Returns:
  • Vidispine return structure of the transcode job

Signals raised:
  • Pre create: sender=self.__class__, instance=item_id, method=”retranscode”,shape_id=shape_id, tag_name=shape_id, notification_id=notification_id

  • Post create: sender=self.__class__, instance=item_id, method=”retranscode”

sequenceItems(sequence)

Get all the items in a sequence with their in and out points

setItemMetadata(item_id, metadata_document, skipForbidden=True, content_type='xml', return_format='xml', enable_cascading=True, only_return_changes=True)

Set or update the item metadata

Args:
  • item_id: An item ID.

  • metadata_document: A pyxb metadata document.

  • skipForbidden: Variable that tells the backend to ignore forbidden fields - no error is thrown if they are included in the update

  • enable_cascading: When set to False, changes will not cascade down to child items. Used for special cases where cascading is not wanted. Note: If content_type is not ‘xml’, cascading is always disabled.

  • only_return_changes: If True, only return the changed entries

    else return the whole global metadata after the update

Returns:
  • Result of setting item metadata

Signals raised:
  • Pre modify:

    sender=self.__class__, instance=item_id, method=”setItemMetadata”, metadata_document=metadata_document, enable_cascading=enable_cascading,

  • Post modify:

    sender=self.__class__, instance=item_id, method=”setItemMetadata”, metadata_document=metadata_document, enable_cascading=enable_cascading,

setItemMetadataFieldGroup(item_id, metadatagroup_name)

Associates a metadata group to an item

Args:
  • item_id: An item ID.

  • metadatagroup_name: Name of the metadata group

Returns:
  • Result of setting item metadata field group

Signals raised:
  • Pre modify:

    sender=self.__class__, instance=item_id, method=”setItemMetadataFieldGroup”, metadatagroup_name=metadatagroup_name

  • Post modify:

    sender=self.__class__, instance=item_id, method=”setItemMetadataFieldGroup”

setItemMetadataFieldValue(item_id, field_name, field_val)

Quick and easy function to a set a value to a specific field in an item

Args:
  • item_id: An item ID.

  • field_name: The field name.

  • field_val: The value of the field to be set. Can either be a string or a list of strings

Returns:
  • None

Signals raised:
  • Pre modify: sender=self.__class__, instance=item_id, method=”setItemMetadata”, metadata_document=metadata_document

  • Post modify: sender=self.__class__, instance=item_id, method=”setItemMetadata”

setItemMetadataFromVersion(item_id, version)

Set item metadata from a supplied version of the same item.

This does not copy system metadata, nor “portal_essence_version” which is used for shape version matching.

Parameters
  • item_id – An Item ID

  • version – Version number to get metadata from

Returns

The result of settings metadata if successful otherwise None

setMetadataFieldGroupToItemsInLibrary(library_id, mfg_name)

Set a metdata field group to all the items within a library

Args:
  • library_id: The target library id.

  • mfg_name: The name of the metadata field group

Returns:
  • None

Signals raised:
  • Pre modify: sender=self.__class__, instance=library_id, method=”setMetadataFieldGroupToItemsInLibrary”, mfg_name=mfg_name

  • Post modify: sender=self.__class__, instance=library_id.getId(), method=”setMetadataFieldGroupToItemsInLibrary”

setMetadataToItemsInLibrary(library_id, metadata_document)

Set a metdata field group to all the items within a library

Args:
  • library_id: The target library id.

  • metadata_document: A pyxb metadata document object

Returns:
  • None

Signals raised:
  • Pre modify: sender=self.__class__, instance=library_id, method=”setMetadataToItemsInLibrary”, metadata_document=metadata_document

  • Post modify: sender=self.__class__, instance=library_id, method=”setMetadataToItemsInLibrary”

setShapeTagScript(tag_name, predefinedScriptName)

Sets a script to a shape tag

Args:
  • tag_name: Name of the shape tag

  • predefinedScriptName = Name of a predefined script

Returns:
  • Result of setting a script to a shape tag

Signals raised:
  • Pre modify: sender=self.__class__, instance=tag_name, method=”setShapeTagScript”, predefinedScriptName=predefinedScriptName

  • Post modify: sender=self.__class__, instance=tag_name, method=”setShapeTagScript”

turn_to_placeholder(item_id, shape_list, delete_thumbnails=True)

Turns an item back to a placeholder

Args:
  • item_id: An item ID.

  • list of item shapes: List of Shapes for an item

Returns:
  • None

Signals raised:
  • Pre delete: sender=self.__class__, instance=item_id, method=”turnToPlaceHolder”, item_id=item_id

  • Post delete: sender=self.__class__, instance=item_id, method=”turnToPlaceHolder”

updateSequence(item_id, sequence)

Updates the sequence document for a particular item. This will delete any previous sequence and overwrite it with the new document.

updateSettingsProfile(settings_id, group_permissions)

Updates a settings profile in Vidispine given an ID

Args:
  • settings_id: The ID to the settings profile to be updated

  • group_permissions: A list of group permission objects.

Returns:
  • A VSSettingsProfile object representing the settings profile

Signals raised:
  • Pre modify: sender=self.__class__, instance=settings_id, method=”updateSettingsProfile”, group_permissions=group_permissions

  • Post modify: sender=self.__class__, instance=settings_profile.getId(), method=”updateSettingsProfile”

portal.vidispine.iitem.ensure_metadata_field_exists(field_name, field_type, default_value=None, index=None)

Adds a metadata field to Vidispine if it does not exist already.

portal.vidispine.iitem.getPreviewsByShapes(_item, _mediaType, shape=None)

Get Item previews based upon media type if given a VidiRest Item. This was moved out of vitem because it should be more generic.

portal.vidispine.iitem.insert_groups_parameter(matrix, includeSubtitles, includeComments)

Insert metadata “groups” parameter to matrix, based on the boolean arguments.

If matrix already includes “groups”, that is not overwritten.

Parameters
  • matrix – Current matrix parameters, modified in place to include “groups” if needed

  • includeSubtitles – Parameter from caller

  • includeComments – Parameter from caller

Returns

None