VidiRest.objects package

Submodules

VidiRest.objects.auditlog module

class VidiRest.objects.auditlog.VSAuditLog(json_object, replace_urls_dict=None, json_value_constant='value')

Bases: VSObject

Class representing a Vidispine audit log.

getCount()

Gets the number of entries in the audit log.

Returns

The number of entries.

Return type

string

getEntries()

Gets the entries for an audit log.

Returns

A list of VSLogEntry objects.

Return type

list

class VidiRest.objects.auditlog.VSLogEntry(json_object, replace_urls_dict=None, json_value_constant='value')

Bases: VSObject

Class representing a Vidispine log entry.

getMatrixParameters()

Gets the matrix parameters for the log entry.

Returns

The parameteres or an empty string if none can can be found.

Return type

string

getMethod()

Gets the method for the log entry.

Returns

The method name or an empty string if none can be found.

Return type

string

getPath()

Gets the path for the log entry.

Returns

The path or an empty string if none can can be found.

Return type

string

getQueryParameters()

Gets the query parameters for the log entry.

Returns

The parameteres or an empty string if none can can be found.

Return type

string

getRunas()

Gets the runas from the log entry.

Returns

The runas or an empty string if none can be found.

Return type

string

getTimestamp()

Gets the timestamp from the log entry.

Returns

The timestamp or an empty string if none can be found.

Return type

string

getUser()

Gets the user name for which the log entry belongs to.

Returns

The user name or an empty string if none can be found.

Return type

string

VidiRest.objects.base module

class VidiRest.objects.base.VSObject(json_object, replace_urls_dict=None, json_value_constant='value')

Bases: object

Base object class that all Vidispine objects inherit from

Args:
  • json_object: the acutal JSON object received from Vidispine from a REST call

  • replace_urls_dict: A dictionary with URLs that is used to replace the nativ URLs from Vidispine. This can be used to proxy internal URLs for the end user. Default value is an empty dictioanry.

  • json_value_constant: Defines the JSON value constans. Can be ‘$’ or ‘value’ depending on which JSON library is used by Vidispine. Default value is ‘value’

Returns:
  • None

replace_url(vs_url)

Replaced the given URL with the object’s proxy url (replace_urls_dict)

Args:
  • vs_url: The native URL from Vidispine

Returns:
  • The reformatted URL

VidiRest.objects.collection module

class VidiRest.objects.collection.VSCollection(json_object, replace_urls_dict=None, json_value_constant='value')

Bases: VSMetadataEntity

Class representing a collection.

Inheritance:
  • VSMetadataEntity

Args:
  • json_object: the actual JSON object received from Vidispine from a REST call

  • replace_urls_dict: A dictionary with URLs that is used to replace the native URLs from Vidispine.

    This can be used to proxy internal URLs for the end user. Default value is an empty dictionary.

  • json_value_constant: Defines the JSON value constants. Can be ‘$’ or ‘value’ depending on which

    JSON library is used by Vidispine. Default value is ‘value’

Returns:
  • None

getCollections()

Gets all the collections within this collection.

Args:
  • None

Returns:
  • A list of VSCollectionContent objects.

getContent()

Gets the content of the collection.

Args:
  • None

Returns:
  • A list of VSCollectionContent objects.

getId()

Returns the id of the object

Args:
  • None

Returns:
  • The object id or an empty string if there is no id.

getItems()

Gets all the items within this collection.

Args:
  • None

Returns:
  • A list of VSCollectionContent objects.

getLibraries()

Gets all the libraries within this collection.

Args:
  • None

Returns:
  • A list of VSCollectionContent objects.

getLoc()

Gets the location for the collection.

Args:
  • None

Returns:
  • The location or an empty string if none can can be found.

getMetadata()

Gets the collection metadata, if it was included in the call to create VSCollection object.

Note: CollectionHelper.getCollection(collection_id) does not by default include collection metadata. CollecionHelper.getCollections([collection_id]) does include metadata by default.

Args:
  • None

Returns:
  • A tuple of:
    • All item metadata (VSMetadataFieldGroup)

    • System metadata (dict)

    • System specific metadata (list)

getMetadataFieldGroupName()

Returns the first Metadata Field Group Name for the collection

getName()

Gets the name for the collection.

Args:
  • None

Returns:
  • The name or an empty string if none can can be found.

getNumOfHits()

Gets the number of elements in the collection

Args:
  • None

Returns:
  • The number of elements in the collection.

getRepresentativeMetadataFields(limit_to=None, all_metadata_groups_with_content=None)

Returns the representative fields for this collection, as a list of VSMetadataField objects.

Parameters
  • limit_to (int) – an integer specifying the number of representative fields to return

  • all_metadata_groups_with_content (VidiRest.objects.metadata.VSMetadataGroups) – All metadata groups with content, i.e. result of portal.vidispine.iitem.ItemHelper.getMetadataFieldGroups(content=true), passed in for performance reasons. If not given, the results are not sorted by the field position within metadata group.

getThumbnails()

Gets all the thumbnails of the collection.

Args:
  • None

Returns:
  • A list of thumbnails URL’s.

getType()
setName(name)

Sets the name for the collection.

Args:
  • name: The new name of the collection

Returns:
  • None

Note: This change is not stored in Vidispine. For renaming collections use CollectionHelper.renameCollection()

class VidiRest.objects.collection.VSCollectionContent(json_object, replace_urls_dict=None, json_value_constant='value')

Bases: VSObject

Class representing a collection’s content. This can be either an item or a sub-collection

Inheritance:
  • VSObject

Args:
  • None

Returns:
  • None

getId()

Returns the id of the object

Args:
  • None

Returns:
  • The object id or an empty string if there is no id.

getType()

Returns the type of the object. Either ‘item’ or ‘collection’

Args:
  • None

Returns:
  • The object type or an empty string if there is no type.

getURI()

Returns the URI of the object

Args:
  • None

Returns:
  • The object URI or an empty string if there is no URI.

VidiRest.objects.group module

class VidiRest.objects.group.VSGroup(json_object, replace_urls_dict=None, json_value_constant='value')

Bases: VSObject

Class representing a Vidispine group.

Inheritance:
  • VSObject

Args:
  • None

Returns:
  • None

getChildGroups()

Gets the list of children belonging to the group

Args:
  • None

Returns:
  • A list of VSGroups

getChildRoles()

Gets the list of parent roles belonging to the group

Args:
  • None

Returns:
  • A list of VSGroups

getDescription()

Gets the group description.

Args:
  • None

Returns:
  • The description of the group.

getMetadataByKey(key)

Returns the metadata for a particular key.

Parameters

key – The name of the metadata field

Returns

The value

getName()

Gets the group name.

Args:
  • None

Returns:
  • The name of the group.

getParentGroups()

Gets the list of parent belonging to the group

Args:
  • None

Returns:
  • A list of VSGroups

getParentRoles()

Gets the list of parent roles belonging to the group

Args:
  • None

Returns:
  • A list of VSGroups

getUsers(include_deleted=False)

Gets the list of users belonging to the group

Args:
  • None

Returns:
  • A list of user names

getVSRoles()

Gets the list of vidispine roles belonging to the group

Args:
  • None

Returns:
  • A list of VSGroups

hasParentRoles()

Returns bool that represents if the group has parent roles or not.

Args:
  • None

Returns:
  • Boolean

isCustomPortalRole()

Returns True is the group is actually a custom portal role.

Args:
  • None

Returns:
  • True is the group is a custom portal role. False otherwise.

isPortalRole()

Returns True is the group is actually a portal role.

Args:
  • None

Returns:
  • True is the group is a portal role. False otherwise.

isRole()

Returns True is the group is actually a role.

Args:
  • None

Returns:
  • True is the group is a role. False otherwise.

VidiRest.objects.index module

class VidiRest.objects.index.VSIndex(json_object, replace_urls_dict=None, json_value_constant='value')

Bases: VSObject

This class represents a Vidispine index

Inheritance:
  • VSObject

Args:
  • None

Returns:
  • None

getFinish()

The finish time of this index job

Args:
  • None

Returns:
  • The finish time

getId()

Returns the id of the object (the name of the index)

Args:
  • None

Returns:
  • The object id or an empty string if there is no id.

getIndexesDone()

The number of objects that have been indexed for this job

Args:
  • None

Returns:
  • The object count

getIndexesTotal()

The total number of objects to index

Args:
  • None

Returns:
  • The total number of objects

getPriority()

The priority of this index job

Args:
  • None

Returns:
  • The priority

getStart()

The start time of this index job

Args:
  • None

Returns:
  • The start time

getStatus()

The status of this index job

Args:
  • None

Returns:
  • The Status

VidiRest.objects.item module

class VidiRest.objects.item.SubClip(json_object, replace_urls_dict=None, json_value_constant='value')

Bases: VSItem

This class acts as a container for annotations or subclips

getAnnotationsFromMetadataDocument(*args, **kwargs)

Gets the annotations from a Vidispine metadata document. Metadata entries that doesn’t span the entire item is considered to be annotations

Parameters
  • metadata_doc_json (json) – The metadata document as json object

  • mergeSystemAndCustomFields (bool, optional) – Merge system metadata and custom metadata. Default to True.

  • byuuid ([uuid, str], optional) – Get annotation by uuid, defaults to None

Returns

A list of Annotation objects

Return type

list[portal.externals.VidiRest.objects.item.SubClip]

getDurationSeconds()

Retrieves duration of the Item in seconds.

getDurationTimecode()

Retrieves a timecode object representing the duration

getEndTimecode()
getItemType()

Gets ItemType without looking into -INF and +INF fields

getMetadataFieldGroupName()

Returns the metadata group of the subclip This value is set to self.metadata_group in VSMetadataEntity.getAnnotationsFromMetadataDocument

getParentItemId()

Returns the parent item ID as a string

getRelativeEndTimecode()

Returns a timecode object relative to the parent item for the End Timecode.

Args:
  • None

Returns:
  • Timecode object.

getRelativeStartTimecode()

Returns a timecode object for the start time relative to the parent clip

Args:
  • None

Returns:
  • Timecode object.

getStartTimecode()

Returns a timecode object representing the start timecode

get_creation_date()

Returns the subclip creation date time in an ISO formatted string.

get_non_timed_metadata()
isOriginalShapeOnline()

Returns True if the original shape of the parent item is online: Item has not been archived, or has been also restored.

class VidiRest.objects.item.VSACL(json_object, trans_func=None)

Bases: VSObject

Class representing a Vidispine access control list.

This is one “access” in on a Vidispine item/collection, i.e. from Vidispine …/access -end-point.

Inheritance:
  • VSObject

Args:
  • json_object: the acutal JSON object received from Vidispine from a REST call

  • trans_func: Optional translation function. E.g. django.utils.translation.gettext. Default is None.

    This is not needed for getPermissionTranslated() to work, left in for backwards compatibility.

Returns:
  • None

PERMISSIONS = (('NONE', 'None'), ('OWNER', 'Owner'), ('READ', 'Read'), ('WRITE', 'Write'), ('DELETE', 'Delete'), ('ALL', 'All'))
PERMISSIONS_TO_TRANSLATIONS = {'ALL': 'All', 'DELETE': 'Delete', 'NONE': 'None', 'OWNER': 'Owner', 'READ': 'Read', 'WRITE': 'Write'}
PRIORITIES_MAP = {-2: 'LOWEST', -1: 'LOW', 0: 'DEFAULT', 1: 'HIGH', 2: 'HIGHEST'}
PRIORITIES_TO_TRANSLATIONS = {-2: 'Lowest', -1: 'Low', 0: 'Default', 1: 'High', 2: 'Highest'}
PRIORITY_DEFAULT = 0
SOURCES = (('GROUP', 'Group'), ('USER', 'User'))
SOURCE_GROUP = 'GROUP'
SOURCE_USER = 'USER'
static getEffectivePermission()

Effective permission of this ACL entry, always returns None (not set). This is implemented for compatibility with VSAccessElement, merged access entries can have this value set. Worth noting that this is not the same as “NONE” effectivePermission. :return: None

getGrantor()

Return the grantor of the permission

Args:
  • None

Returns:
  • username of grantor, or “system” if a user cannot be determined

getGroup()

Gets the group that the ACL is for

Args:
  • None

Returns:
  • The group name

getId()

Returns the id of the object

Args:
  • None

Returns:
  • The object id or an empty string if there is no id.

getLoc()

Returns the URI of the ACL

Args:
  • None

Returns:
  • The URI of the ACL

getLocation()

Returns the location of the ACL

Args:
  • None

Returns:
  • The location of the ACL

getOperation()

Returns the operation of the ACL

Args:
  • None

Returns:
  • The operation of the ACL

getOperationTranslated()

Returns the translated operation of the ACL. Needs the tranlation function set.

Args:
  • None

Returns:
  • The translated operation of the ACL

getOperationURIType()

Returns the operation URI type of the ACL

Args:
  • None

Returns:
  • The operation URI type of the ACL

getOperationURITypeTranslated()

Returns the translated operation URI type of the ACL. Needs the tranlation function set.

Args:
  • None

Returns:
  • The translated operation URI type of the ACL

getPermission()

Returns the permission of the ACL. Note: Returns .capitalize():d string.

Args:
  • None

Returns:
  • The permission of the ACL

getPermissionTranslated()

Returns the translated permission of the ACL.

Args:
  • None

Returns:
  • The translated permission of the ACL

getPriority()

Return the priority of the acl entry

Args:
  • None

Returns:
  • priority of acl entry, 0 if not set

getPriorityTranslated() str

Return human readable priority of the ACL entry - e.g. “Low”

For priority values that don’t map to the defined priorities returns the number as a string - e.g. “42”.

getRecipient()

Gets the recipient that the ACL is for. Either a group or user.

Args:
  • None

Returns:
  • The recipients name

getRecipientType()

Returns ‘user’ or ‘group’ indicating the type of the ACL recipient

Args:
  • None

Returns:
  • ‘user’ or ‘group’

getUser()

Gets the user that the ACL is for

Args:
  • None

Returns:
  • The user name

hasOperation()

Returns True if acl entry has any operation otherwise false

isForUser()

Returns True if the ACL is for a user or not. False if the ACL is for a group.

Args:
  • None

Returns:
  • True or False

isRecursive()

Return whether the acl is recursive or not

Args:
  • None

Returns:
  • True or False

class VidiRest.objects.item.VSACLMerged(json_object, replace_urls_dict=None, json_value_constant='value')

Bases: VSObject

Class representing a Vidispine merged access control list.

Inheritance:
  • VSObject

Args:
  • None

Returns:
  • None

getAccessWithCollection(collection_id)

Given a collection id, get the access element

Args:
  • collection_id: The collection id of the requested element

Returns:
  • A VSAccessElement object

getAccessWithRank(rank)

Given a rank, get the access element

Args:
  • rank: The rank of the requested element

Returns:
  • A VSAccessElement object

getAccesses()

Gets the access elements in the merged ACL

Args:
  • None

Returns:
  • A list of VSAccessElements

getAccessesSortedByUserAndPriority()

Returns a dict with username as key and their highest priority ACL entry as the value. This highest entry has precedence in VS.

The entries from VS are listed according to priority for every user, so all this does is get first entry for each user and return that back.

This only returns GENERIC type access, i.e. full item access, not for example METADATA/SHAPE level access.

getAcessesWithEffectivePermission(effective_permission)

Gets all the ACL entries with a specified effective permission value

getAcessesWithType(acl_type)

Given a ACL type, get the access element

Args:
  • acl_type: The ACL type of the requested element

Returns:
  • A VSAccessElement object

getAllElements(key, value)

Gets all access elements matching the key and value

Args:
  • key: The key to the access element

  • value: The value to the access element

Returns:
  • A list of VSAccessElement objects

getFirstElement(key, value)

Gets the first access element matching the key and value

Args:
  • key: The key to the access element

  • value: The value to the access element

Returns:
  • A VSAccessElement object

getGenericAccess()

Gets the generic access element

Args:
  • None

Returns:
  • A VSAccessElement object

getMergedAccess()

Gets the merged access for this ACL

Args:
  • None

Returns:
  • A VSAccessElement object

getMetadataAccess()

Gets the metadata access element

Args:
  • None

Returns:
  • A VSAccessElement object

getMetadataMergedAccess()

Gets the merged metadata access

Args:
  • None

Returns:
  • A VSACLMetadataMergedAccess object

getURIAccess(shape_name='ALL')

Gets the access element for a specific shape

Args:
  • shape_name: The access of the requested shape name. If set to ‘ALL’ all access elements will be returned

Returns:
  • A list of VSAccessElements

hasGenericReadPermission()

Gets if there is a generic read permission for a specific shape

Args:
  • None

Returns:
  • True or False

hasGenericWritePermission()

Gets if there is a generic write permission for a specific shape

Args:
  • None

Returns:
  • True or False

hasMetadataReadPermission()

Gets if there is a metadata read permission for a specific shape

Args:
  • None

Returns:
  • True or False

hasMetadataWritePermission()

Gets if there is a metadata write permission for a specific shape

Args:
  • None

Returns:
  • True or False

hasURIReadPermission(shape_name='ALL')

Gets if there is a URI read permission for a specific shape

Args:
  • shape_name: The URI read permission for the requested shape name. If set to ‘ALL’ read permission will be for all shapes.

Returns:
  • True or False

hasURIWritePermission(shape_name='ALL')

Gets if there is a URI write permission for a specific shape

Args:
  • shape_name: The URI write permission for the requested shape name. If set to ‘ALL’ write permission will be for all shapes.

Returns:
  • True or False

class VidiRest.objects.item.VSACLMetadataMergedAccess(json_object, replace_urls_dict=None, json_value_constant='value')

Bases: VSObject

Class representing a Vidispine merged access list to a set of metadata.

For an example see:

:8080/API/metadata-field/field-group/Film/merged-access?username=admin

Inheritance:
  • VSObject

Args:
  • None

Returns:
  • None

getFieldByName(field_name)

Given a field name, return the given field

Args:
  • field_name: The request field name

Returns:
  • A metadata field dictionary

getFieldGroupByName(group_name)

Given a field group name, return the given field group

Args:
  • field_group_name: The request field group name

Returns:
  • A metadata field dictionary

getFieldGroups()

Gets the list of fields groups which this merged access list reflects

Args:
  • None

Returns:
  • A list of metdata field groups

getFieldPermission(field_name)

Given a field name, return the field permission

Args:
  • field_name: The request field name

Returns:
  • The metadata field permission

getFields()

Gets the list of fields which this merged access list reflects

Args:
  • None

Returns:
  • A list of metdata field names

getGroupPermission()

Gets the metadata group permission

Args:
  • None

Returns:
  • The metadata group permission

getMetadataGroupName()

Gets the metadata group name which this merged access list reflects

Args:
  • None

Returns:
  • The metadata group name

getUserName()

Gets the user name for the merged access list

Args:
  • None

Returns:
  • The user name

class VidiRest.objects.item.VSAccessElement(json_object, replace_urls_dict=None, json_value_constant='value')

Bases: VSObject

Class representing a Vidispine access element. This is one “access” in a VSACLMerged -object, i.e. from Vidispine …/merged-access -end-point.

Inheritance:
  • VSObject

Args:
  • None

Returns:
  • None

getCollection()

Gets collection name that the element derives from

Args:
  • None

Returns:
  • The name of the collection

getEffectivePermission()

Gets the access element effective permission if it has one

getExtraData()

Gets the data of the element

Args:
  • None

Returns:
  • The data of the element

getFromCollection()

Returns true if the element derive from a collection

Args:
  • None

Returns:
  • True or False

getGrantor()

Return the grantor of the permission

Args:
  • None

Returns:
  • username of grantor, or “system” if a user cannot be determined

getGroup()

Gets the group name that the element derives from

Args:
  • None

Returns:
  • The name of the group

getId()

Returns the id of the object

Args:
  • None

Returns:
  • The object id or an empty string if there is no id.

getLibrary()

Gets the library name that the element derives from

Args:
  • None

Returns:
  • The name of the library

getMatches()
getPermission()

Gets the permission of the element

Args:
  • None

Returns:
  • The permission of the element

getPermissionTranslated()

Returns the translated permission of the ACL element.

getRank()

Gets the rank of the element

Args:
  • None

Returns:
  • The rank of the element

getRecipientType()

Returns ‘user’ or ‘group’ indicating where the user is getting this access from.

The actual “recipient” of a merged access is always a single user, i.e. each entry is for one user. A user group can still be the reason why the user has the access.

Naming is for compatibility with VSACL class, the concept is not really “recipient” in the merged access entry case.

Args:
  • None

Returns:
  • ‘user’ or ‘group’

getType()

Gets the type of the element

Args:
  • None

Returns:
  • The type of the element

getUsername()

Gets the user name the element belongs to

Args:
  • None

Returns:
  • The user name

hasDirectAccess()

Returns true if the user has direct access to an item

Args:
  • None

Returns:
  • True or False

isOwner()

Returns true if the user is also the owner of the item

Args:
  • None

Returns:
  • True or False

isSuperUser()

Returns true if the user is a super user

Args:
  • None

Returns:
  • True or False

class VidiRest.objects.item.VSItem(json_object, replace_urls_dict=None, json_value_constant='value')

Bases: VSMetadataEntity

Class representing a Vidispine item.

Inheritance:
  • VSMetadataEntity

Args:
  • None

Returns:
  • None

getACLMerged()

Returns the merged acl list

getAnnotationByUuid(uuid)

Gets annotations by uuid this should be called using a uuid object but can also be called with str.

Parameters

uuid (uuid, str) – uuid for annotation instance.

Returns

A annotation if match is found. Else None.

Return type

VidiRest.objects.item.SubClip

getArchiveActionStatus()

Get the archive action status of this item, i.e. value of “portal_archive_action_status” metadata field.

Returns:
  • A string, such as “Archiving”, empty string when not in progress. These constants are defined in portal.archive_framework.constants as STATUS_ARCHIVING, STATUS_ARCHIVING_SCHEDULED, and the whole set of valid values is in portal.archive_framework.constants.VALID_STATUSES

getArchiveStatus()

Get the archive status of this item, i.e. value of “portal_archive_status” metadata field.

Returns:
  • A string, such as “Archived”, empty string when not archived. These constants are defined in portal.archive_framework.constants as STATUS_ARCHIVED_OFFLINE, STATUS_ARCHIVED_ONLINE, and the whole set of valid values is in portal.archive_framework.constants.VALID_STATUSES

getDurationSeconds()

Retrieves duration of the Item in seconds.

getDurationTimecode()

Retrieves a timecode object representing the duration

getEssenceVersion()

Returns the latest essence version of this item unless the item object reflect a particular version of an item in which that version number will be returned.

getFieldByName(field_name)

Gets the field given a field_name.

Args:
  • field_name: The name of the field

Returns:
  • The structure of a field

getFramesPerSecond()
getItemType()

Returns the item type of this item. This uses a combination of the mediaType field and additional portal specific logic.

getMediaType()

Returns the value of the mediaType metadata field in Vidispine

getMetadata()

Returns all the metadata for this item, including data for subgroups.

Example of getting metadata values from a subgroup:

>>> ith = ItemHelper()
>>> item = ith.getItem("VX-27")
>>> subgroups = item.getMetadata()[0].getGroups()
>>> subgroups
[<VSMetadataFieldGroup "Actor">]
>>> subgroup = subgroups[0]
>>> field = subgroup.getFieldByName("portal_mf793831")
>>> field.getValue()
[{'change': 'VX-146', 'timestamp': '2016-09-29T12:10:34.402+0000',
'uuid': 'bf0629c7-5b66-42bb-af23-e31358503645', 'value': 'Ture', 'user': 'admin'}]
>>> field.getFirstFieldValue()
'Ture'
Returns:
  • A tuple of:
    • All item metadata (VSMetadataFieldGroup)

    • System metadata (dict)

    • System specific metadata (list)

getMetadataFieldGroupName()

Returns the first Metadata Field Group Name for the item

getMetadataSummary(only_shared_data=False)
Retrieves a list of tuples with the format:

(meta_name, meta_value)

Designed to be used on the item page to show a summary of the metadata, and also to be shown on the share item page.

if only_shared_data = True, we hide some data that we should not show on share pages.

getMetadataWithFilteredMissingFields(item_helper)

This method retrieves the item metadata, where fields that are present in the metadata but does not exist in Portal (so fields which are not defined) anymore are filtered.

This is useful, for instance, when cloning an Item, where the original Item has data which has been defined long time ago, and when cloning the item, we need to filter out the fields that are not present so the creation of the new Item does not trigger a Vidispine Exception.

getOriginalFilename()

Gets the original filename of the item

Args:
  • None

Returns:
  • Original file name

getOriginalTag()

Returns the original shape. This is the same as

obj.getShapeTagByName(‘original’)

getPosterObjects()

Returns list of poster objects

getPosters()

Returns the list of poster frames.

getPreview(method, extension, includeShapes=True)

extract the “extension” file that we need for the previews. takes a “method” to match the 4 first characters of the URI and takes an “extension” to match the last 3 characters of the URI

getPreviewByShape(method, shape_name)

Returns the first shape that matches the given shape_name and method

getPreviewsByShape(method, shape_name)

Returns all the shapes that matched a given shape_name and method

getRepresentativeMetadata(limit_to=None, all_metadata_groups_with_content=None)

Get representative metadata as field names and formatted values for them.

Parameters
  • limit_to – Optional limit to number of items returned

  • all_metadata_groups_with_content (VidiRest.objects.metadata.VSMetadataGroups) – All metadata groups with content, i.e. result of portal.vidispine.iitem.ItemHelper.getMetadataFieldGroups(content=True), passed in for performance reasons. If not given, the results are not sorted by the field position within metadata group.

Returns

a list of (field_name, display_value)

getRepresentativeMetadataFields(limit_to=None, all_metadata_groups_with_content=None)

Returns the representative fields for this item as a list of VSMetadataField objects.

Parameters

limit_to – an integer specifying the number of representative

fields to return, defaults to None :type limit_to: int, optional :param all_metadata_groups_with_content: All metadata groups with content, i.e. result of

portal.vidispine.iitem.ItemHelper.getMetadataFieldGroups(content=true), passed in for performance reasons. If not given, the results are not sorted by the field position within metadata group.

Returns

a list of VSMetadataField objects

Return type

list

getRepresentativeThumbnail()

Returns the a url for the representativeThumnail for this item

getRotation()

Gets the number of degrees this item is supposed to be rotated

getRotationScale()

Returns the scale down factor which has to be applied if rotating the item

getSearchMatchedAnnotations(all_subclips=False)
getShapeById(shape_id)

Get a shape from this item by shape ID :param shape_id: A shape ID, e.g. “VX-1234” :return: A VSShape object, or None if not found

getShapeTagByName(tag_name)

Returns shape tag with Given name

Return type

VSShape

getShapes()
Returns

Returns a list of all the shapes in VSShape objects

Return type

list[VidiRest.objects.shape.VSShape]

getStartTimecode()

Returns a timecode object representing the start timecode

getThumbnailObjects()

Returns list of thumbnail objects

Returns

a list of thumbnail objects

Return type

list(VidiRest.objects.item.VSThumbnail)

getThumbnails()

Returns the list of thumbnails

getTitle()

Gets the item title

Args:
  • None

Returns:
  • The item title

getType()
get_ixml()
isClosed()

Returns True if all files in all shapes are closed, and False otherwise.

isDropframe()

Is this material dropframe?

isEmpty()

An item is empty if __shape_size is 0, and __storage_size and __sequence_size are both 0

isLocked()

Returns True if the item is locked.

isOriginalShapeFileAvailable()

Returns True if file is ‘CLOSED’

isOriginalShapeOnline()

Returns True if the original shape of this item is online: Item has not been archived, or has been also restored.

isPlaceholder()

An item is a placeholder if __shape_size is 1, and __storage_size and __sequence_size are both 0

isProject()

Returns true if this item is a project

isSequence()

Returns true if this item is a sequence

isTitleNone()

Checking if title is really None, even if getTitle returns something.

isToBeDeleted()

Returns date if an item is to be deleted

lockOwner()

Returns the owner of the lock. Returns false if there is no lock.

class VidiRest.objects.item.VSItemRelationship(json_object, replace_urls_dict=None, json_value_constant='value')

Bases: VSObject

Class representing a Vidispine item relationship.

Inheritance:
  • VSObject

Args:
  • None

Returns:
  • None

getId()

Returns the id of the object

Args:
  • None

Returns:
  • The object id or an empty string if there is no id.

getSource()
getTarget()
getType()
getValue(key)
class VidiRest.objects.item.VSLibrary(json_object, replace_urls_dict=None, json_value_constant='value')

Bases: VSObject

Class representing a Vidispine library.

Inheritance:
  • VSObject

Args:
  • None

Returns:
  • None

getHits()

Returns the number of hits

Args:
  • None

Returns:
  • Number of hits

getItems()

Returns the item ids in the library

Args:
  • None

Returns:
  • A list of item ids

getLibraryIds()

Returns the library ids in the library

Args:
  • None

Returns:
  • A list of library ids

class VidiRest.objects.item.VSLibraryQuery(json_object, replace_urls_dict=None, json_value_constant='value')

Bases: VSObject

Class representing the query that defines the Vidispine library.

Inheritance:
  • VSObject

Args:
  • None

Returns:
  • None

getIntervals()

Returns the intervals setting from the query

Args:
  • None

Returns:
  • The free text

getMetadata(mergeSystemAndCustomFields=True)

Gets the library metadata.

Args:
  • mergeSystemAndCustomFields: Merge system metadata and custom metadata. Default is True.

Returns:
  • A tuple of the custom metadata (list), system metadata (dict)

getText()

Returns the free text for the query

Args:
  • None

Returns:
  • The free text

class VidiRest.objects.item.VSLibrarySettings(json_object, replace_urls_dict=None, json_value_constant='value')

Bases: VSObject

Class representing the settings of a Vidispine library.

Inheritance:
  • VSObject

Args:
  • None

Returns:
  • None

getAutoRefresh()

Gets if the library is auto reshed or not

Args:
  • None

Returns:
  • True or False

getFirst()

Gets the number of the first element in the search query that defined the library

Args:
  • None

Returns:
  • The number of the first element

getId()

Returns the id of the object

Args:
  • None

Returns:
  • The object id or an empty string if there is no id.

getLastRefresh()

Gets the last time the library was refreshed

Args:
  • None

Returns:
  • The time and date the library was last refreshed

getNumber()

Gets the number of elements in the search query that defined the library

Args:
  • None

Returns:
  • The number of the elements

getQuery()

Gets query that defines the library

Args:
  • None

Returns:
  • A VSLibraryQuery object

getUpdateMode()

Gets the library update mode

Args:
  • None

Returns:
  • Update mode

getUsername()

Returns the user name

Args:
  • None

Returns:
  • The user name

class VidiRest.objects.item.VSPoster(json_object, dropframe)

Bases: VSThumbnail

Class representing an individual Vidispine PosterObject.

Inheritance:
  • VSThumbnail

Args:
  • json_object of the URL to the poster.

Returns:
  • self.url as string or Object.

getId()
getTimecode()
class VidiRest.objects.item.VSSearchHistory(json_object, replace_urls_dict=None, json_value_constant='value')

Bases: VSObject

Class representing a search history for a specific user.

Inheritance:
  • VSObject

Args:
  • None

Returns:
  • None

getQuery()

Gets the query of a search history element

Args:
  • None

Returns:
  • The number of the first element

getTimestamp()

Gets the search history element timestamp

Args:
  • None

Returns:
  • Search history timestamp

getUser()

Gets the user for the search history element

Args:
  • None

Returns:
  • User name

class VidiRest.objects.item.VSSearchQuery(json_object, replace_urls_dict=None, json_value_constant='value')

Bases: VSObject

Class representing a Vidispine search query.

Inheritance:
  • VSObject

Args:
  • None

Returns:
  • None

getFrom()

Returns the from date of the search query

Args:
  • None

Returns:
  • The from date

getQdr()
getText()

Gets the free text string for the search query

Args:
  • None

Returns:
  • The free text string

getTextQuoted()

Gets the quoted free text string for the search query

Args:
  • None

Returns:
  • The free text string

getTo()

Returns the to date of the search query

Args:
  • None

Returns:
  • The to date

isAdvanced()

Indicates weather this is an query which used the advanced form

Args:
  • None

Returns:
  • Boolean

class VidiRest.objects.item.VSSettingsProfile(json_object, replace_urls_dict=None, json_value_constant='value')

Bases: VSObject

Class representing a Vidispine settings profile.

Inheritance:
  • VSObject

Args:
  • None

Returns:
  • None

getAccessList()

Returns the access list for this settings profile

getId()

Returns the id of the object

Args:
  • None

Returns:
  • The object id or an empty string if there is no id.

class VidiRest.objects.item.VSThumbnail(json_object, dropframe)

Bases: VSObject

Class representing an individual Vidispine Thumbnail Object.

Inheritance:
  • VSObject

Args:
  • json_object of the URL to the thumbnail.

Returns:
  • self.url as string or Object.

parse_urlstring(url)

parses the url into urlparseobject

thumbail_url_pattern = re.compile('.*version=([^;?]*)')
VidiRest.objects.item.get_item_type(media_type, portal_item_type, is_sequence=False)
VidiRest.objects.item.item_is_sequence(media_type, portal_item_type, sequence_size=0)
VidiRest.objects.item.representative_field_value(field, vs_metadata_entity, format_date_values)

Get a properly formatted value for a representative field.

Parameters
  • field – A Vidispine field

  • vs_metadata_entity (VSItem or VSCollection or None) – An VSItem or VSCollection object, can be None, used for getting system field values.

  • format_date_values – Whether date and timestamp values should be returned as formatted to DATE_FORMAT and DATETIME_FORMAT.

Returns

A string that can be shown in the UI pods or rows

VidiRest.objects.job module

class VidiRest.objects.job.VSJob(json_object, replace_urls_dict=None, json_value_constant='value')

Bases: VSObject

Class representing a Vidispine job.

Inheritance:
  • VSObject

Args:
  • None

Returns:
  • None

DEFAULT_JOB_PRIORITY = 'MEDIUM'
JOB_PRIORITIES = (('LOWEST', 'Lowest'), ('LOW', 'Low'), ('MEDIUM', 'Medium'), ('HIGH', 'High'), ('HIGHEST', 'Highest'), ('IMMEDIATE', 'Immediate'))
JOB_TYPES = (('ANALYZE', 'Analyze'), ('AUTO_IMPORT', 'Import'), ('CONFORM', 'Conform'), ('COPY_FILE', 'Copy file'), ('DELETE_FILE', 'Delete file'), ('ESSENCE_VERSION', 'Essence version'), ('EXPORT', 'Export'), ('LIST_ITEMS', 'List items'), ('MOVE_FILE', 'Move file'), ('PLACEHOLDER_IMPORT', 'Placeholder import'), ('RAW_IMPORT', 'Raw import'), ('RAW_TRANSCODE', 'Raw transcode'), ('SHAPE_IMPORT', 'Shape import'), ('SIDECAR_IMPORT', 'Sidecar import'), ('SHAPE_UPDATE', 'Shape update'), ('THUMBNAIL', 'Thumbnail'), ('TIMELINE', 'Timeline'), ('TRANSCODE', 'Transcode'), ('TRANSCODE_RANGE', 'Transcode range'))
STATUSES = (('FINISHED', 'Finished'), ('FINISHED_WARNING', 'Finished with warning'), ('FAILED_TOTAL', 'Failed'), ('STARTED', 'Started'), ('STARTED_ASYNCHRONOUS', 'Asynchronously started'), ('ABORTED', 'Aborted'), ('READY', 'Ready'), ('WAITING', 'Waiting'))
displayRerunJob()

Should the “Re-run” job button be displayed

Args:
  • None

Returns:

True if button should display, otherwise false

getBestEffortFilename()

Gets original filename belonging to the job

Args:
  • None

Returns:
  • The original file name

getCurrentStep()

Gets the current step of the job

Args:
  • None

Returns:
  • Current step

getCurrentStepDescription()

Gets the description of the current step

Args:
  • None

Returns:
  • Description of the step

getData()

Gets the job data

Args:
  • None

Returns:
  • The data object of the job

getDataByKey(key)
getDataObject(object_name)

Given a data object name of the job, return its value

Args:
  • None

Returns:
  • Value of the data object name

getErrorMessage()

Gets any possible error messages of the job

Args:
  • None

Returns:
  • Error message or empty string if none

getFilename()

Gets filename belonging to the job. If there is a bestEffortFilename then it is returned, otherwise the originalFilename is returned

Args:
  • None

Returns:
  • The original file name

getId()

Returns the id of the object

Args:
  • None

Returns:
  • The object id or an empty string if there is no id.

getJobStatusDocument()

Get the get JobStatusDocument.

Args:
  • None

Returns:
  • The job status document.

getOriginalFilename()

Gets original filename belonging to the job

Args:
  • None

Returns:
  • The original file name

getPerformedTasks()

Gets the list of performed tasks

Args:
  • None

Returns:
  • List of performed tasks

getPriority()

Gets the job priority

Args:
  • None

Returns:
  • The priority

getProgress()

Get the total progress of a job as percentage. Loops through the tasks and sub-tasks of a job to get a granular progress.

This needs a VSJob object with “steps” included, otherwise the return value is always 0.0 or 100.0.

Args:
  • None

Returns:
  • The progress of the job, between 0.0 and 100.0, as a float

getSourceFilePath()

Gets source filepath belonging to the job

Args:
  • None

Returns:
  • The original file path

getStarted()

Gets when the job was started

Args:
  • None

Returns:
  • The timestamp of when the job was started

getStatus()

Gets the current status of the job

Args:
  • None

Returns:
  • The status of the job

Return type

string

getSubJob()

Gets any possible sub job

Args:
  • None

Returns:
  • The id of a possible sub job

getTargetItem()

Gets the first targetted item for the job

Args:
  • None

Returns:
  • Item id

getTargetItems()

Gets the list of targetted items for the job

Args:
  • None

Returns:
  • A list of item ids

getTargetShapeIds()

Gets the target shape id of the job

Args:
  • None

Returns:
  • Shape id

getTotalSteps()

Gets total number of steps of the job

Args:
  • None

Returns:
  • Total number of steps

getTranscodeDurations()

Gets the durations of a transcode job

Args:
  • None

Returns:
  • A list of durations

getTranscodeEstimatedTimeLeft()

Gets transcode job estimated time left

Args:
  • None

Returns:
  • The estimated time left

getTranscodeMediaTimes()

Gets the transcode media times

Args:
  • None

Returns:
  • The transcode media times

getTranscodeProgress()

Gets the progress of the transcode job.

Note: getProgress() supports also jobs that do not have a transcode step.

Args:
  • None

Returns:
  • The progress of the job, percentage float as a string, e.g. “42.0”

getTranscodeWallTime()

Gets when the transcode wall time

Args:
  • None

Returns:
  • The wall time

getType()

Gets the job type

Args:
  • None

Returns:
  • The type of the job

getUser()

Returns the user of the object

Args:
  • None

Returns:
  • The user name

inProgress()

Checks wether a job is in progress or not

Args:
  • None

Returns:
  • True or False

isWaiting()

Checks if a job is waiting to be run

Args:
  • None

Returns:
  • True or False

class VidiRest.objects.job.VSJobNotification(notification_string)

Bases: VSObject

Class representing a Vidispine asynchronous job notification.

Inheritance:
  • VSObject

Args:
  • None

Returns:
  • None

getAction()

Gets the action of the job

Args:
  • None

Returns:
  • Job action

getCurrentStepNumber()

Gets the current of the step number

Args:
  • None

Returns:
  • Current step number

getCurrentStepStatus()

Gets the status of the current step

Args:
  • None

Returns:
  • Current status

getItem()

Gets the item for the job

Args:
  • None

Returns:
  • Item id

getJobId()

Gets the job id

Args:
  • None

Returns:
  • Job id

getSequenceNumber()

Gets the sequence number of the job

Args:
  • None

Returns:
  • Sequence number

getStarted()

Gets when the job was started

Args:
  • None

Returns:
  • Start timestamp

getStatus()

Gets the overall status of a job

Args:
  • None

Returns:
  • Job status

getTotalStepNumber()

Gets the total number of steps for the job

Args:
  • None

Returns:
  • Number of total steps

getType()

Gets the type of the job

Args:
  • None

Returns:
  • Job type

getUser()

Gets the user for the job

Args:
  • None

Returns:
  • User name

VidiRest.objects.job.fix_tasks_time(json_job)

Fixes vidispine’s “5-minutes-ahead-issue”, by setting tasks/subtasks time to the latest timestamp of its substeps.

Parameters

json_job – json representation of task

Returns

same json object with updated timestamps

VidiRest.objects.metadata module

class VidiRest.objects.metadata.VSMetadataChangeSetDocument(json_object, replace_urls_dict=None, json_value_constant='value')

Bases: VSObject

This class represents the Vidispine metadata change set document

Inheritance:
  • VSObject

Args:
  • None

Returns:
  • None

getChangeSets()

Gets the lst of change sets.

Args:
  • None

Returns:
  • A list of VSMetadataChangeSetType objects

class VidiRest.objects.metadata.VSMetadataChangeSetType(json_object, replace_urls_dict=None, json_value_constant='value')

Bases: VSMetadataEntity

This class represents the Vidispine metadata change set type

Inheritance:
  • VSMetadataEntity

Args:
  • None

Returns:
  • None

getMetadata()

Gets the metadata.

Args:
  • None

Returns:
  • A tuple of the custom metadata (list), system metadata (dict), system specific metadata (list)

class VidiRest.objects.metadata.VSMetadataData(json_object, replace_urls_dict=None, json_value_constant='value')

Bases: VSObject

Class representing the data section of a Vidispine metadata.

Inheritance:
  • VSObject

Args:
  • None

Returns:
  • None

getData()

Gets the data

Args:
  • None

Returns:
  • The list of data

getExtraData()

Gets the extra data

Args:
  • None

Returns:
  • The list of extra data

getExtraDataDict()
getExtraDataValue(val)

Given a extra data name, the value is returned

Args:
  • val: The extra data name

Returns:
  • The extra data value

getGroupSpecificDataValue(group_name, val)

This is used for getting extra data set for a specific group.

Args:
  • group_name: The group name

  • val: The extra data name

Returns:
  • The extra data value for the specific group

class VidiRest.objects.metadata.VSMetadataEntity(json_object, replace_urls_dict=None, json_value_constant='value')

Bases: VSObject

This class works as a base class for all Vidispine entities that contain time based metadata

Inheritance:
  • VSObject

Args:
  • None

Returns:
  • None

getAnnotationsFromMetadataDocument(metadata_doc_json, mergeSystemAndCustomFields=True, byuuid=None)

Gets the annotations from a Vidispine metadata document. Metadata entries that doesn’t span the entire item is considered to be annotations

Parameters
  • metadata_doc_json (json) – The metadata document as json object

  • mergeSystemAndCustomFields (bool, optional) – Merge system metadata and custom metadata. Default to True.

  • byuuid ([uuid, str], optional) – Get annotation by uuid, defaults to None

Returns

A list of Annotation objects

Return type

list[portal.externals.VidiRest.objects.item.SubClip]

getId()

Returns the id of the object

Args:
  • None

Returns:
  • The object id or an empty string if there is no id.

getMetadataFieldByName(field_name)

Retrieves the field from the metadata given a name. First it checks with the field labels. If it doesn’t match, it looks through the vidispine metadata name for the field. This is useful for e.g. system metadata fields like created.

getMetadataFieldValueByName(field_name)

Retrieves the field from the metadata given a name. First it checks with the field labels. If it doesn’t match, it looks through the vidispine metadata name for the field. This is useful for e.g. system metadata fields like created.

getMetadataFromMetadataDocument(metadata_doc_json, mergeSystemAndCustomFields=True)

Gets the metadata from a Vidispine metadata document.

Args:
  • metadata_doc_json: The metadata document as json object

  • mergeSystemAndCustomFields: Merge system metadata and custom metadata. Default is True.

Returns:
  • A tuple of the custom metadata (list), system metadata (dict), system specific metadata (list)

metadataFormat()

Gets a better formated text of metadata. For debug purposes only.

Args:
  • None

Returns:
  • The formatted metadata

class VidiRest.objects.metadata.VSMetadataField(json_object, replace_urls_dict=None, json_value_constant='value')

Bases: VSMetadataData

Class representing a Vidispine metadata field.

Inheritance:
  • VSObject

Args:
  • None

Returns:
  • None

getActualValue()
getChoicesValues()
getDefaultValue()

Gets the default value of the field

Args:
  • None

Returns:
  • The default value

getFieldValues()

Gets all the values of this field - sorted alphabetically

Args:
  • None

Returns:
  • All this field’s values

getFirstFieldValue()

Gets the first value set to the field

Args:
  • None

Returns:
  • The first value

getFloatRestriction()

Gets the possible float restriction if this is a float field

Args:
  • None

Returns:
  • The restriction

getIntegerRestriction()

Gets the possible integer restriction if this is an integer field

Args:
  • None

Returns:
  • The restriction

getKeyValuesMap()
getLabel()

Returns the field’s label if it has one, otherwise return it’s name

getName()

Gets the name of the metadata field

Args:
  • None

Returns:
  • The name of the field

getRanges()

Gets the possible ranges for the field

Args:
  • None

Returns:
  • A list defining the ranges, or empty list if no range is set

getRestriction()

Gets the possible restriction of the field

Args:
  • None

Returns:
  • The restriction

getSchema()

Gets the schema for the field

Args:
  • None

Returns:
  • A VSMetadataSchemaElementType object

getStringRestriction()

Gets the possible string restriction if this is a string field

Args:
  • None

Returns:
  • The restriction

getSystem()

Gets the system value

Args:
  • None

Returns:
  • The system value

getTagAndLookupRestriction()

Gets the possible restirction for tag and lookup fields. (Min and Max number of value that can be entered)

Args:
  • None

Returns:
  • The restriction

getTimestamp()

Gets the timestamp for when the field was created

Args:
  • None

Returns:
  • The timestamp

getType()

Gets the type of the metadata field

Note: This function does not return correct values for field returned from VSItem.getRepresentativeMetadataFields().

Args:
  • None

Returns:
  • The type of the field

getUser()

Gets the user who created the field

Args:
  • None

Returns:
  • The user name

getValue()

Gets the entire value object of the field

Args:
  • None

Returns:
  • The list of values

getValueByKey(key, default=None)
isCascading()

Get whether the field is cascading, i.e. its changes should cascade to children of an item or collection when metadata is modified.

Args:
  • None

Returns:
  • True is the field is cascading, False otherwise

isSingleton()

Get whether the field is a singleton field, i.e if the value from this field should the same for all instances of the field.

This can only be True if the field is also reusable

Args:
  • None

Returns

  • True if the field is singleton and reusable, otherwise False

isSortable()

Gets if the field is sortable or not

Args:
  • None

Returns:
  • True or False

setRanges(ranges)

Set ranges for this field

Args:
  • A list defining the ranges

Returns:
  • None

setValue(new_val, quite=True)

Sets a new value to this field

Args:
  • new_val: The new value to be set

  • quite: If set to True, no exception will be raised if the value cannot be set. Default is True.

Returns:
  • None

class VidiRest.objects.metadata.VSMetadataFieldData(json_string)

Bases: VSObject

Class representing the data section of a Vidispine metadata field.

Inheritance:
  • VSObject

Args:
  • None

Returns:
  • None

getDefault()

Gets the default value

Args:
  • None

Returns:
  • The default value

getDescription()

Gets the field description

Args:
  • None

Returns:
  • The description of the field

getName()

Gets the field name

Args:
  • None

Returns:
  • The name

getOrder()

Gets the order of the field

Args:
  • None

Returns:
  • The order

getRequired()

Gets if the field is required

Args:
  • None

Returns:
  • True or False

getType()

Gets the field type

Args:
  • None

Returns:
  • The field type

getValues()

Gets all the value set to the field

Args:
  • None

Returns:
  • The list of values

class VidiRest.objects.metadata.VSMetadataFieldGroup(json_object=None, vs_metadata_fields=None, vs_metadata_groups=None, json_value_constant='value')

Bases: VSMetadataData

Class representing a Vidispine metadata field group.

Inheritance:
  • VSMetadataData

Args:
  • json_object: the acutal JSON object received from Vidispine from a REST call. Default is None.

  • vs_metadata_fields: Optional list of VSMetadataFields representing the fields in the group. Default is None.

  • vs_metadata_groups: Optional list of VSMetadataFieldGroups representing the groups in the group. Default is None.

  • json_value_constant: Defines the JSON value constans. Can be ‘$’ or ‘value’ depending on which JSON library is used by Vidispine. Default value is ‘value’

Returns:
  • None

canOnlyBeSubGroup()

Returns true if the group is only allowed to be used in nested form

Args:
  • None

Returns:
  • True or False

getDisplayName()

Get the display name of the metadata field group

Args:
  • None

Returns:
  • Group display name

getElements()

Get all metadata elements, a list of all metadata fields and groups

Args:
  • None

Returns:
  • A list of VSMetadataField and VSMetadataFieldGroup objects

getField(field_name)

Given a field name, get the actual field

Args:
  • None

Returns:
  • VSMetadataField

getFieldByLabelName(label)

Get a metadata field by its label name

Args:
  • label: The label of the metadata field

Returns:
  • A VSMetadataField object

getFieldByName(name)

Get a metadata field by its name

Args:
  • name: The name of the metadata field

Returns:
  • A VSMetadataField object

getFields()

Get the list of metadata fields

Args:
  • None

Returns:
  • A list of VSMetadataField

getFieldsInOrder()
getGroup(group_name)

Given a field group name, get the specific metadata field group

Args:
  • group_name: The name of the metadata group

Returns:
  • VSMetadataFieldGroup

getGroupInstancesByName(group_name)

Given a metadata group name, get all instances of metadata groups in this object

Args:
  • group_name: The name of the metadata group

Returns:
  • A list of VSMetadataFieldGroup objects

getGroups()

Given all metadata field groups in this object

Args:
  • None

Returns:
  • A list of VSMetadataFieldGroup objects

getName()

Get the name of the metadata field group

Args:
  • None

Returns:
  • Group name

getReferenceID()

Get the id of this reference

Args:
  • None

Returns:
  • Id of this reference

getReferenceType()

Get the type of reference for this object

Args:
  • None

Returns:
  • Reference type

getReferenceUUID()

Get the UUID of this reference

Args:
  • None

Returns:
  • UUID of this reference

getRepresentativeFields(only_representative_fields=False)

Retrieves the fields marked as representative, or the first 3 fields from the model otherwise.

getSchema()

Get metadata schema

Args:
  • None

Returns:
  • A VSMetadataSchemaElementType object

getUUID()

Get the UUID of this object

Args:
  • None

Returns:
  • The UUID or empty string if none found

setElements(vsmetadataelements)

Set the objects metadata elements

Args:
  • vsmetadataelements: A list of VSMetadataField and VSMetadataFieldGroup objects

Returns:
  • None

setFields(vsmetadatafields)

Set the list of metadata fields

Args:
  • vsmetadatafields: A list of VSMetadataField objects

Returns:
  • None

setGroups(vsmetadatagroups)

Set the list of metadata field groups

Args:
  • vsmetadatagroups: A list of VSMetadataFieldGroup objects

Returns:
  • None

sortMetadataElements()

This function goes through all metadata fields and sorts them according to the value given in their order value defined in extradata[value][‘order’]. If no such value is given, the entry will be added to the end of the resulting metadatafild list.

Args:
  • None

Returns:
  • A list of VSMetadataField objects

class VidiRest.objects.metadata.VSMetadataGroups(json_object, replace_urls_dict=None, json_value_constant='value')

Bases: VSObject

Class representing a Vidispine metadata group.

Inheritance:
  • VSObject

Args:
  • None

Returns:
  • None

getGroupByName(group_name)

Get a single metadata group from the list by its name.

This is the same as:

field_group = [

group for group in metadata_groups.getGroups() if group.getName() == group_name

][0]

Sets up a dictionary based on group names on the first call, so subsequent access is simply a dict lookup.

Parameters

group_name (str) – Name of the group to get

Returns

The metadata field group by name “group_name”

Return type

VSMetadataFieldGroup

Raises

KeyError – If a group by the given name is not found

getGroupNames(sort=True, export_group=False, include_system_generated_groups=True)

Get the names of the groups

Args:
  • sort: If set to True, the names will be sorted. Default is True.

  • include_system_generated_groups: If set to False, do not return metadata groups which

has name matching certain defined patterns. Default is True

Returns:
  • A list of group names

getGroups(onlyTopGroups=False)

Gets all the groups in this object

Args:
  • onlyTopGroups: Only returns metadata groups on the top level. I.e. no subgroups. Default is False.

Returns:
  • A list of VSMetadataFieldGroup objects

getMetadataFieldByName(field_name)

Get a metadata field from any of the top level metadata groups.

Since portal.vidispine.iitem.ItemHelper.getMetadataFieldGroups() traverses to subgroups, this method finds any field on the system from the results.

Sets up a dictionary based on field names on the first call, so subsequent access is simply a dict lookup.

Parameters

field_name (str) – Name of the metadata field to get

Returns

The metadata field by name “field_name”

Return type

VSMetadataField

Raises

KeyError – If a group by the given name is not found

class VidiRest.objects.metadata.VSMetadataSchemaElementType(json_object, replace_urls_dict=None, json_value_constant='value')

Bases: VSObject

This class represents the Vidispine metadata schema element type

Inheritance:
  • VSObject

Args:
  • None

Returns:
  • None

getMax()

Gets maximum number of occurences

Args:
  • None

Returns:
  • The max number

getMin()

Gets minimum number of occurences

Args:
  • None

Returns:
  • The min number

getName()

Gets the name

Args:
  • None

Returns:
  • The name

isReference()

Gets if this is a reference

Args:
  • None

Returns:
  • True or False

class VidiRest.objects.metadata.VSSimpleMetadataDocument(json_object, replace_urls_dict=None, json_value_constant='value')

Bases: VSObject

This class represents the Vidispine simple metadata schema

Inheritance:
  • VSObject

Args:
  • None

Returns:
  • None

getAllKeyValues()

Gets the list of all key/values

Args:
  • None

Returns:
  • A list of all key/values

getValueByKey(key)

Given a key, get the value

Args:
  • key: The key

Returns:
  • The value set to the given key. None if no key matched.

VidiRest.objects.resource module

class VidiRest.objects.resource.VSResource(json_object, replace_urls_dict=None, json_value_constant='value')

Bases: VSObject

This class represents a Vidispine resource object

Inheritance:
  • VSObject

Args:
  • None

Returns:
  • None

getDescription(resource_name)

Given a resource name, get the description of the resournce

Args:
  • resource_name: The name of the resource.

Returns:
  • Resource description

getId()

Returns the id of the object

Args:
  • None

Returns:
  • The object id or an empty string if there is no id.

getResource(resource_name)

Given a resource name, get the resource

Args:
  • resource_name: The name of the resource.

Returns:
  • Resource object

getTag(resource_name)

Given a resource name, get the tag of the resournce

Args:
  • resource_name: The name of the resource.

Returns:
  • Resource tag

getURL(resource_name)

Given a resource name, get the URL of the resournce

Args:
  • resource_name: The name of the resource.

Returns:
  • Resource URL

VidiRest.objects.search module

class VidiRest.objects.search.SearchCriteria(query_dict=None)

Bases: object

List of all library metadata fields that SearchCriteria handles. When populated loaded from Library settings, also ‘query’/’intervals’ -field is used.

getAnnotationMetadataField()
getAudioCodecField()
getDateField()
getDurationSecondsField()
getFieldsAndOperator()
getMediaTypeField()
getOriginalHeightField()
getOriginalWidthField()
getTitleField()
getUserField()
getVideoCodecField()
populateFromLibrarySettings(librarySettings)
try:

fields = librarySettings.getQuery()[‘field’]

except Exception:

fields = []

setDateField(field)
setDurationSecondsField(field)
setNoSequence()
setOriginalHeightField(field)
setOriginalWidthField(field)
to_dict()

VidiRest.objects.sequence module

class VidiRest.objects.sequence.VSSequence(json_object, replace_urls_dict=None, json_value_constant='value')

Bases: VSObject

Class representing a Vidispine sequence

Inheritance:
  • VSObject

Args:
  • None

Returns:
  • None

getCollection()

Gets collection name that the element derives from

Args:
  • None

Returns:
  • The name of the collection

getExtraData()

Gets the data of the element

Args:
  • None

Returns:
  • The data of the element

getFromCollection()

Returns true if the element derive from a collection

Args:
  • None

Returns:
  • True or False

getGroup()

Gets the group name that the element derives from

Args:
  • None

Returns:
  • The name of the group

getId()

Returns the id of the object

Args:
  • None

Returns:
  • The object id or an empty string if there is no id.

getLibrary()

Gets the library name that the element derives from

Args:
  • None

Returns:
  • The name of the library

getMatches()
getPermission()

Gets the permission of the element

Args:
  • None

Returns:
  • The permission of the element

getPriority()

Gets the priority of the element

Args:
  • None

Returns:
  • The priority of the element

getType()

Gets the type of the element

Args:
  • None

Returns:
  • The type of the element

getUsername()

Gets the user name the element belongs to

Args:
  • None

Returns:
  • The user name

isOwner()

Returns true if the user is also the owner of the item

Args:
  • None

Returns:
  • True or False

isSuperUser()

Returns true if the user is a super user

Args:
  • None

Returns:
  • True or False

VidiRest.objects.shape module

class VidiRest.objects.shape.VSAudioComponent(json_object, replace_urls_dict=None, json_value_constant='value')

Bases: VSComponentBase

This class represents the Vidispine audio component

Inheritance:
  • VSComponentBase

Args:
  • None

Returns:
  • None

getBitRate()

Get the bit rate

Args:
  • None

Returns:
  • The bit rate as a int or None if does not exists

getBlockAlign()

Gets the block align

Args:
  • None

Returns:
  • The string formatted block alagin

getChannels()

Gets the number of channels in this audio component

Args:
  • None

Returns:
  • The string formatted number of channels

getCodec()

Gets the name of the codec

Args:
  • None

Returns:
  • The name of the codec

getEssenceStreamId()

Gets the essence streamd id

Args:
  • None

Returns:
  • The string formatted stream id

getFrameSize()

Gets the frame size

Args:
  • None

Returns:
  • The string formatted frame size

getItemTrack()

Gets the item track

Args:
  • None

Returns:
  • The string formatted item track

getSampleFormat()

Gets the sample format

Args:
  • None

Returns:
  • The string formatted sample format

getSamplingRate()

Gets the sampling rate

Args:
  • None

Returns:
  • The string formatted sampling rate

class VidiRest.objects.shape.VSBinaryComponent(json_object, replace_urls_dict=None, json_value_constant='value')

Bases: VSComponentBase

This class represents the Vidispine binary component

Inheritance:
  • VSComponentBase

Args:
  • None

Returns:
  • None

class VidiRest.objects.shape.VSComponentBase(json_object, replace_urls_dict=None, json_value_constant='value')

Bases: VSObject

This class works as a base for all Vidispine shape component objects

Inheritance:
  • VSObject

Args:
  • None

Returns:
  • None

getBitRate()

Gets the bitrate of the component

Args: * None

Returns: * The string formatted resolution height

getDurationAsFloat()
getFiles(exclude_on_vs_archive=True)

Gets the files for this component

Args:
  • exclude_on_vs_archive - Should we also get files that are located on vidispine archive storages

Returns:
  • A list of VSFile objects

getId()

Gets the id of this component

Args:
  • None

Returns:
  • The component ID

getLength()

Gets the string formatted length of this component

Args:
  • None

Returns:
  • The length

getMetadata(key)

Gets component metadata

Args:
  • key - the key to do a lookup for

Returns:
  • The value responding to the key

getTimeBase()

Returns the component timebase.

  • Returns: A tuple (numerator, denominator)

class VidiRest.objects.shape.VSContainerComponent(json_object, replace_urls_dict=None, json_value_constant='value')

Bases: VSComponentBase

This class represents the Vidispine container component

Inheritance:
  • VSComponentBase

Args:
  • None

Returns:
  • None

getDuration()

Gets duration of this component

Args:
  • None

Returns:
  • Duration in seconds as floating point string

getFirstSMPTETimecode()

Returns the firstSMPTETimecode field

getFormat()

Gets the format of this component

Args:
  • None

Returns:
  • The format

getSamples()

Gets the samples of this component

Args:
  • None

Returns:
  • The samples

getStartTimecode()

Gets the start timecode if it is set

Args:
  • None

Returns:
  • The format

getTimeCodeTimeBase()

Gets the timebase for the timecode. Expressed as a tuple, (numerator, denominator)

Args:
  • None

Returns:
  • (numerator, denominator)

class VidiRest.objects.shape.VSShape(json_object, replace_urls_dict=None, json_value_constant='value')

Bases: VSObject

This class represents a Vidispine shape

Inheritance:
  • VSObject

Args:
  • None

Returns:
  • None

downloadable()

Check binary or containerComponent on whether the file has a HTTP method

Return:

True / False Boolean

getAllComponents()

Returns all components of this shape :return: list of all components in this shape

getAllFiles(exclude_on_vs_archive=True)

Get all unique files in all components of this shape. :param exclude_on_vs_archive: Should we also get files that are located on vidispine archive storages :return: List of VSFile objects

getAudioComponents()

Gets any possible audio components in the shape

Args:
  • None

Returns:
  • A list of VSAudioComponents

getBinaryComponents()
getContainerComponent()

Gets container component in the shape

Args:
  • None

Returns:
  • A VSContainerComponent object

getDisplayFormat()

Gets the display format

Args:
  • None

Returns:
  • The display format

getDisplayName()

Returns a name of this shape, suitable for displaying to the user

getDurationInFrames()
getEssenceVersion()

Returns the essence version of this shape.

Args:
  • none

Returns:
  • The current essence version of the shape

getFirstFileName()

Gets the first file name found in the shape

Args:
  • None

Returns:
  • The first file name

getId()

Returns the id of the object

Args:
  • None

Returns:
  • The object id or an empty string if there is no id.

getMetadata(key)

Gets shape metadata

Args:
  • key - the key to do a lookup for

Returns:
  • The value responding to the key

getMimeType()

Gets the shape mime type

Args:
  • None

Returns:
  • The mime type

getStorageNames()

Get storage names for the files

Return: * List of storages

getStorages()

Get storage ids for the files

Return * List of storages

getTag()

Gets the shape tag’s first name for the shape

Args:
  • None

Returns:
  • The shape tag name

getTags()

Gets the list of shape tag names for the shape (in all normal cases with just one entry)

Args:
  • None

Returns:
  • The shape tag name

getVideoComponents()

Gets any possible video components in the shape

Args:
  • None

Returns:
  • A list of VSVideoComponents

isClosed()
verifyIntegrity()

Verifies data integrity of shape components and files by checking SHA-1 hashes as well as comparing file sizes

class VidiRest.objects.shape.VSShapeTag(json_object, replace_urls_dict=None, json_value_constant='value')

Bases: VSObject

This class represents a Vidispine shape tag

Inheritance:
  • VSObject

Args:
  • None

Returns:
  • None

getAudioBitrate()

Gets the audio bitrate

Args:
  • None

Returns:
  • String formatted audio bitrate

getAudioChannelMapping()

Gets the channel mapping

Returns

A list of channel ids

Return type

list

getAudioChannels()

Gets the number of audio channels

Args:
  • None

Returns:
  • Number of audio channels

getAudioCodec()

Gets the audio codec name

Args:
  • None

Returns:
  • Audio codec

getAudioFramerate()

Gets the audio format rate

Args:
  • None

Returns:
  • Audio format rate

getAudioMixdown()

Gets the value of the portal_audio_mixdown setting

Args:
  • None

Returns:
  • Boolean

getAudioSettings()

Gets the audio settings for this shape tag

getDenominator()

Gets the video denominator.

Args:
  • None

Returns:
  • The string formatted video frame rate

getFormat()

Gets the shape tag format

Args:
  • None

Returns:
  • The string formatted shape tag format

getNumerator()

Gets the video denominator.

Args:
  • None

Returns:
  • The string formatted video frame rate

getPluginName()

Gets the name of the transcoder plugin responsible for this shape tag

getPosterResolution()

Gets the poster resolution

Args:
  • None

Returns:
  • The string formatted poster resolution: “widthxheight”

getPosterResolutionHeight()

Gets the poster resolution height

Args:
  • None

Returns:
  • The integer formatted poster resolution height

getPosterResolutionWidth()

Gets the poster resolution width

Args:
  • None

Returns:
  • The integer formatted poster resolution widht

getPresets()

Gets a possible preset tag

Args:
  • None

Returns:
  • The list of video presets

getScript()

Gets a possible java script set to the shape tag

Args:
  • None

Returns:
  • The java script as string

getThumbnailResolution()

Gets the thumbnail resolution

Args:
  • None

Returns:
  • The string formatted thumbnail resolution: “widthxheight”

getThumbnailResolutionHeight()

Gets the thumbnail resolution height

Args:
  • None

Returns:
  • The integer formatted thumbnail resolution widht

getThumbnailResolutionWidth()

Gets the thumbnail resolution width

Args:
  • None

Returns:
  • The integer formatted thumbnail resolution widht

getType()

Gets the shape tag type

Args:
  • None

Returns:
  • ‘video’, ‘audio’, or ‘image’

getVideoBitrate()

Gets the video bitrate

Args:
  • None

Returns:
  • Audio codec

getVideoCodec()

Gets the video codec name

Args:
  • None

Returns:
  • Video codec

getVideoFramerate()

Gets the video frame rate.

Args:
  • None

Returns:
  • The string formatted video frame rate

getVideoGopSize()

Gets the video gop size

Args:
  • None

Returns:
  • The string formatted gop size

getVideoMaxBFrames()

Gets the video max B frames

Args:
  • None

Returns:
  • The string formatted max B frames

getVideoPixelFormat()

Gets the video pixel format

Args:
  • None

Returns:
  • The string formatted video pixel format

getVideoPresets()

Gets the video preset

Args:
  • None

Returns:
  • The string formatted video preset

getVideoProfiles()

Gets the video profiles

Args:
  • None

Returns:
  • A list of the names of the video profiles

getVideoResolution()

Gets the video resolution

Args:
  • None

Returns:
  • The string formatted video resolution: “widthxheight”

getVideoResolutionHeight()

Gets the video resolution height

Args:
  • None

Returns:
  • The integer formatted height

getVideoResolutionWidth()

Gets the video resolution width

Args:
  • None

Returns:
  • The integer formatted width

getVideoScaling()

Gets the video scaling

Args:
  • None

Returns:
  • The string formatted video scaling: “widthxheight”

getVideoScalingDAR()

Gets the video scaling DAR

Args:
  • None

Returns:
  • The string formatted video scaling DAR: “widthxheight”

getVideoSettings()

Gets the video settings for this shape tag

isAudio()

Returns True if this is an audio shape tag

Args:
  • None

Returns:
  • True of False

isImage()

Returns True if this is an image shape tag

Args:
  • None

Returns:
  • True of False

isPlugin()

True if this shape tag is handled by a transcoder plugin

isVideo()

Returns True if this is a video shape tag

Args:
  • None

Returns:
  • True of False

setScript(script)

Sets a java script to the shape tag

Args:
  • The java script as string

Returns:
  • None

class VidiRest.objects.shape.VSVideoComponent(json_object, replace_urls_dict=None, json_value_constant='value')

Bases: VSComponentBase

This class represents the Vidispine video component

Inheritance:
  • VSComponentBase

Args:
  • None

Returns:
  • None

geMediaInfoPropertyBykey(key)
getAspectRatio(asString=True)

Gets the aspect ration

Args:
  • asString: if true, return as a string, otherwise a tuple

Returns:
  • The string formatted aspect ratio

getCodec()

Gets the codec name

Args:
  • None

Returns:
  • The codec name

getDisplayResolutionWidth()

Gets the display resolution width

Args:
  • None

Returns:
  • The string formatted display resolution width

getDurationTimecode()

Returns the duration as a Timecode object

getEssenceStreamId()

Gets the essence streamd id

Args:
  • None

Returns:
  • The string formatted stream id

getFieldOrder()

Gets the field order

Args:
  • None

Returns:
  • The field order

getFieldOrderInReadableFormat()

Returns a human readable representation of the field order

Args:
  • None

Returns:
  • The field order in human readable format

getFramerateAsFraction()

Returns the average framerate from the item in vidispine as a dict.

getFramesPerSeconds()

Gets the frames per second. Uses realBaseFrameRate if available, is not then averageFrameRate.

Args:
  • None

Returns:
  • The string formatted frames per second

getItemTrack()

Gets the item track

Args:
  • None

Returns:
  • The string formatted item track

getMediaInfo()

Gets the mediaInfo from vidispine for video component Args:

  • None

Returns
  • Dict containing media info

getPixelAspectRatio()

Gets the pixel aspect ratio

Args:
  • None

Returns:
  • The string formatted pixel aspect ratio

getPixelFormat()

Gets the pixel format

Args:
  • None

Returns:
  • The string formatted pixel format

getResolution(asString=True)

Gets the resolution

Args:
  • asString: If set to True, the resolution will be returned as a formatted string. Otherwise as a tuple. Default is True.

Returns:
  • The string formatted resolution “width x height” or a tuple (width, height)

getResolutionHeight()

Gets the resolution height

Args:
  • None

Returns:
  • The string formatted resolution height

getResolutionWidth()

Gets the resolution width

Args:
  • None

Returns:
  • The string formatted resolution width

getVideoBitRate()

Gets the video bit rate

Args:
  • None

Returns:
  • The string formatted resolution height

isDropframe()

Does this video components represent dropframe material?

Args:
  • None

Returns
  • True if the material is dropframe, false otherwise

isScanTypeProgressive()

Is the component scan type progressive or interlaced

Args:
  • None

Returns
  • True if progressive false if interlaced

VidiRest.objects.shape.getBestMediaFormat(value, arg, mimetype)

VidiRest.objects.storage module

class VidiRest.objects.storage.VSAutoImportRule(json_object, replace_urls_dict=None, json_value_constant='value')

Bases: VSObject

This class represents a Vidispine of auto import rule

Inheritance:
  • VSObject

Args:
  • None

Returns:
  • None

getExcludeFilters()

Gets the exclude filters for this auto import rule

Args:
  • None

Returns:
  • A list of exclude patterns

getJobMetadata()

Gets possible job metadata for the auto import rule

Args:
  • None

Returns:
  • A VSSimpleMetadataDocument

getMetadata()

Gets possible metadata set to this auto import rule

Args:
  • None

Returns:
  • A VSSimpleMetadataDocument

getMetadataGroup()

Gets the name of the main metadata group for this rule

getSettingsID()

Gets the settings id for this auto import rule

Args:
  • None

Returns:
  • The settings id

getStorage()

Gets the storage is set for the auto import rule

Args:
  • None

Returns:
  • The storage id

getTags()

Gets possible shape tags associated with the auto import rule

Args:
  • None

Returns:
  • A list of shape tag names

class VidiRest.objects.storage.VSAutoImportRules(json_object, replace_urls_dict=None, json_value_constant='value', storages=None)

Bases: VSObject

This class represents a list of Vidispine of auto import rules

Inheritance:
  • VSObject

Args:
  • None

Returns:
  • None

getRuleForStorage(storage_id)

Given a storage id, return the auto import rule for it

Args:
  • None

Returns:
  • The auto import rule structure for a specific storage

class VidiRest.objects.storage.VSFile(json_object, replace_urls_dict=None, json_value_constant='value')

Bases: VSObject

This class represents a Vidispine file object

Inheritance:
  • VSObject

Args:
  • None

Returns:
  • None

getFileExtension()

Gets the file extension

Args:
  • None

Returns:
  • Gets the extension of the file

getFileName()

Gets the filename component of the file

Args:
  • None

Returns:
  • The filename

getFullItemReference()

Return a list of all item ids and their shape ids that the file belongs to

Args:
  • None

Returns:
  • A list of dictionaries, reflecting the item id and all belonging shape ids

getHash()

Gets the file hash (SHA-1)

Args:
  • None

Returns:
  • The string formatted hash

getId()

Returns the id of the object

Args:
  • None

Returns:
  • The object id or an empty string if there is no id.

getItemIds()

Gets the list of item ids that the file belongs to

Args:
  • None

Returns:
  • A list of item ids

getPath()

Gets the path to the file

Args:
  • None

Returns:
  • The file path

getRealState()

Gets the state that the file is in

Args:
  • None

Returns:
  • The file state returned by Vidispine

getShapeIds(item_id)

Given a item id, get the list of shape ids of the item

Args:
  • item_id: The item id

Returns:
  • A list of shape ids belonging to that item

getSize()

Gets the file size

Args:
  • None

Returns:
  • The string formatted file size

getState()

Gets the formatted state that the file is in

Args:
  • None

Returns:
  • The file state. E.g. ‘IMPORTED’, ‘PROCESSING’, or ‘NOT_IMPORTED’

getStorage()

Gets the storage ID that the file exists on

Args:
  • None

Returns:
  • The storage ID as a string

getStorageId()

Gets the storage id that the file exists on

Args:
  • None

Returns:
  • The string formatted storage id

getStorageName()

Really gets the getStorageName

getTimestamp()

Gets the timestamp the file was created

Args:
  • None

Returns:
  • The timestamp

getURI(method)

Given a method, get the URI that matches the method

Args:
  • method: A string formatted method, e.g. ‘http’

Returns:
  • The URI matching the method

getURIs()

Gets a list of possible URIs to the file

Args:
  • None

Returns:
  • A list of URIs

goodForImport()

Checks if the file is good for importing. Checks if there are no items associated to the file and the state is not ‘MISSING’

Args:
  • None

Returns:
  • True or False

hasHttpMethod()

Check if a file is available with HTTP method.

Args:
  • None

Returns:
  • Bool

class VidiRest.objects.storage.VSStorage(json_object, replace_urls_dict=None, json_value_constant='value', is_auto_import=False)

Bases: VSObject

This class represents a Vidispine storage

Inheritance:
  • VSObject

Args:
  • json_object: the acutal JSON object received from Vidispine from a REST call

  • replace_urls_dict: A dictionary with URLs that is used to replace the nativ URLs from Vidispine. This can be used to proxy internal URLs for the end user. Default value is an empty dictioanry.

  • json_value_constant: Defines the JSON value constans. Can be ‘$’ or ‘value’ depending on which JSON library is used by Vidispine. Default value is ‘value’

  • is_auto_import: Defines if the storage is an auto import storage. Default is False.

Returns:
  • None

getAutoImportRule()

Gets the auto import rule from storage

Args:
  • None

Returns:
  • The auto import rule object

getCapAutoDetect()

Returns True if the capacity is set to auto detect

Args:
  • None

Returns:
  • True or False

getCapacity()

Gets the capacity of the storage

Args:
  • None

Returns:
  • The long formatted storage capacity

getCapacityFormatted()

Given a storage size, get the number in float format based on the unit. E.g. 2 340 000 -> 2.34

Args:
  • None

Returns:
  • The string formatted storage capacity

getCapacitySizeUnit()

Gets the capacity size unit. I.e. ‘tb’, ‘gb’, ‘mb’, ‘kb’, or ‘b’

Args:
  • None

Returns:
  • The capacity size unit

getExcludeFilter()

Gets the exclude filter associated with this storage

Args:
  • None

Returns:
  • The exlude filter as a string

getFileSystem()

Gets the storage’s file system

Args:
  • None

Returns:
  • The file system

getFreeCapacity()

Gets the free capacity

Args:
  • None

Returns:
  • The long formatted free capacity

getHighWaterMark()

Gets the high water mark of the storage

Args:
  • None

Returns:
  • The integer formatted high water mark

getHighWaterMarkFormatted()

Gets the high water mark of the storage formatted

Args:
  • None

Returns:
  • The float formatted high water mark formatted

getHighWaterMarkPercent()

Gets the high water mark of the storage in percent

Args:
  • None

Returns:
  • The float formatted high water mark in percent

getHighWaterMarkSizeUnit()

Gets the low water mark size unit

Args:
  • None

Returns:
  • The string formatted low water mark size unit

getId()

Returns the id of the object

Args:
  • None

Returns:
  • The object id or an empty string if there is no id.

getLowWaterMark()

Gets the low water mark of the storage

Args:
  • None

Returns:
  • The integer formatted low water mark

getLowWaterMarkFormatted()

Gets the low water mark of the storage formatted

Args:
  • None

Returns:
  • The float formatted low water mark formatted

getLowWaterMarkPercent()

Gets the low water mark of the storage in percent

Args:
  • None

Returns:
  • The float formatted low water mark in percent

getLowWaterMarkSizeUnit()

Gets the low water mark size unit

Args:
  • None

Returns:
  • The string formatted low water mark size unit

getMaximumBandwidth()

Get the maximum bandwidth of this storage

getMetadata()

Gets the metadata set for this storage

Args:
  • None

Returns:
  • A VSSimpleMetadataDocument object

getMetadataStorageName()

Gets the storage name from the metadata

Args:
  • None

Returns:
  • Storage name

getMethods()

Gets a list of available methods

Args:
  • None

Returns:
  • A list of VSStorageMethod objects

getNumFormatted(num)

Given a number, get the number in float format based on the unit. E.g. 2 340 000 -> 2.34

Args:
  • num: The storage size

Returns:
  • The float size number

getNumSizeUnit(num)

Gets the size unit. I.e. ‘tb’, ‘gb’, ‘mb’, ‘kb’, or ‘b’

Args:
  • None

Returns:
  • The size unit

getPriority()

Gets the current priority on the storage

Args:
  • None

Returns:
  • A string with the priority level or empty string if not set

getRefreshInterval()

Get the refresh interval of this storage

getScanInterval()

Gets the scan interval for this storage

Args:
  • None

Returns:
  • The integer formatted scan interval

getState()

Gets the state of the storage

Args:
  • None

Returns:
  • The storage state

getType()

Gets the type of the storage

Args:
  • None

Returns:
  • The vidispine storage type

getUsedSpace()

Gets the used space

Args:
  • None

Returns:
  • The long formatted used space

hasCapacity()

Returns true if the storage has a known capacity

isArchiveStorage()

Is this a storage used as a Vidispine archive storage

Args:
  • None

Returns:
  • Boolean that indicates if storage is a Vidispine archive storage

isAutoImport()

Returns True if this is an auto import storage

Args:
  • None

Returns:
  • True or False

isS3Storage()

Returns True if it is a storage with an s3 method otherwise False

setAutoImport(auto_import)

Sets the auto import tag for this storage to True or False

Args:
  • auto_import: True or False

Returns:
  • None

setAutoImportRule(rule)

Given a auto import rule structure, set the rule to the storage.

Args:
  • auto_import: The auto import rule. Example: {“rule”:[{“storage”:”VX-107”,”tag”:[“playout”,”lowres”],”metadata”:{},”jobmetadata”:{},”settingsId”:”VX-2”}]}

Returns:
  • None

showImportables()

Gets if the show importables tag is set or not for this storage

Args:
  • None

Returns:
  • True or False

class VidiRest.objects.storage.VSStorageGroup(json_object, replace_urls_dict=None, json_value_constant='value', storages=None)

Bases: VSObject

This class represents a Vidispine storage group

Inheritance:
  • VSObject

Args:
  • None

Returns:
  • None

getDescription()

Gets the description of the storage group

Args:
  • None

Returns:
  • The storage group description

getName()

Gets the name of the storage group

Args:
  • None

Returns:
  • The storage group name

getStorageNames()

Gets the list of storage names in this storage group

Args:
  • None

Returns:
  • A list of storage names

getStorages()

Gets list of all storages in the storage group :return:

setStorages(storages)

Sets the storages for this storage group

Args:
  • A list of storage ids

Returns:
  • None

class VidiRest.objects.storage.VSStorageMethod(json_object, replace_urls_dict=None, json_value_constant='value')

Bases: VSObject

This class represents a Vidispine storage method

Inheritance:
  • VSObject

Args:
  • None

Returns:
  • None

getBrowse()

Gets the browse method for this storage method

Args:
  • None

Returns:
  • The string formatted browse method

getFailureMessage()

Gets the possible failure message for this method

Args:
  • None

Returns:
  • The failure message

getFirstURI(parsed=True)

Gets the first URI available for this method

Args:
  • None

Returns:
  • The first URI

getId()

Returns the id of the object

Args:
  • None

Returns:
  • The object id or an empty string if there is no id.

getLastFailure()

Gets the last failure message for this method

Args:
  • None

Returns:
  • The last failure message

getLastSuccess()

Gets the last success message for this method

Args:
  • None

Returns:
  • The last success message

getRead()

Gets the read method for this storage method

Args:
  • None

Returns:
  • The string formatted read method

getType()

Gets the type of the method for this storage method

Args:
  • None

Returns:
  • The string formatted type of the method

getURIs()

Gets the URIs available for this method

Args:
  • None

Returns:
  • A list of URIs

getWrite()

Gets the write method for this storage method

Args:
  • None

Returns:
  • The string formatted write method

hasLocalAccess()

Checks if portal has local access, so we check if we can access the storage by using regular file system operations (so if the scheme is of the kind “file://”)

is_successful()

Check that last action was successfull :return: boolean

class VidiRest.objects.storage.VSStorageRule(json_object, replace_urls_dict=None, json_value_constant='value')

Bases: VSObject

This class represents a Vidispine storage rule

Inheritance:
  • VSObject

Args:
  • None

Returns:
  • None

getAppliesTo()

Returns a list of id’s and types for all entities that this rule apply to.

Args:
  • None

Returns:
  • A list of entity ids and type. E.g. [{‘id’:’VX-123’, ‘type’:’item’}]

getExcludedStorageGroups()

Gets any possible storage group excluded from this rule

Args:
  • None

Returns:
  • A list of storage groups

getExcludedStorageIDs()

Gets the storage ids of storages exluded from this rule

Args:
  • None

Returns:
  • A list of storage ids

getId()

Returns the id of the object

Args:
  • None

Returns:
  • The object id or an empty string if there is no id.

getPrecedence()

Gets the precendence in this rule

Args:
  • None

Returns:
  • The precedence

getPriorities()

Gets the priority list set to this storage rule

Args:
  • None

Returns:
  • A list of priorities

getStorageCount()

Gets the number of storages associated to this rule

Args:
  • None

Returns:
  • Number of storages

getStorageGroups()

Gets any possible storage group associated to this rule

Args:
  • None

Returns:
  • A list of storage groups

getStorageIDs()

Gets the storage ids of storages associated to this rule

Args:
  • None

Returns:
  • A list of storage ids

VidiRest.objects.user module

class VidiRest.objects.user.VSUser(*args, **kwargs)

Bases: VSObject

This class represents a list of Vidispine user

Inheritance:
  • VSObject

Args:
  • None

Returns:
  • None

getGroupList()

Gets the list of the groups that user belongs to

Args:
  • None

Returns:
  • A list of group names that the user belongs to

getName()

Gets the real name of the user, and if it’s not set, it will return the user name

Args:
  • None

Returns:
  • The user real name or user name

getRealName()

Gets the user real name

Args:
  • None

Returns:
  • User real name

getUserName()

Gets the user name

Args:
  • None

Returns:
  • User name

isDisabled()

Returns True if the user is disabled in the system

Args:
  • None

Returns:
  • True or False

isDisabledBecauseRepeatedCaseInsensitiveUsername(all_users=None)

Returns True if the user is disabled and there’s another user with the same name when settings.USERNAMES_CASE_INSENSITIVE is True.

This method stores the result of the function in _disabled_because_insensitive_name So if we use this function multiples times for a user, we just query the database once.

all_users parameters is a parameter having all users in Vidispine, so that when this function is evaluated for lots of users, we don’t need to get all the users on this function each time is called for a different user.

This is evaluated here and not in the UserProfile Model because sometimes that instance is missing for an user, while we always have a Vidispine user

Module contents