Libraries

Interface Library

class portal.vidispine.ilibrary.LibraryHelper(user=None, runas=None, *args, **kwargs)

This is an interface to the helper classes provided by VidiREST

addEntryToLibraryACL(library_id, entry_document)

Add an item ACL entry to a library

Args:
  • library_id: A library ID.

  • entry_document: A pyxb ACL entry document.

Returns:
  • Newly created entry ID

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

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

createOrModifyLibraryStorageRule(lib_id, storagerule_document, tag_name=None)

Creates or modifies a storage rule for a shape tag

Args:
  • lib_id: ID of the library

  • storagerule_document: A pyxb storage rule preset document

  • tag_name: Shape tag name to be associated with the rule. Optional.

Returns:
  • A VSStorageRule object

Signals raised:
  • Pre modify: sender=self.__class__, instance=lib_id, method=”createOrModifyLibraryStorageRule”, storagerule_document=storagerule_document, tag_name=tag_name

  • Post modify: sender=self.__class__, instance=lib_id, method=”createOrModifyLibraryStorageRule”

export(library_id, uri=None, tag_name=None, metadataprojection=None, jobmetadata=None, query=None, *args)

Exports a library

Args:
  • library_id: Id of the library.

  • uri: uri to the export place

  • tag_name: Optional tag name to export

  • metadataprojection: metadataprojection if metadata is being included

  • jobmetadata: Optional metadata to be sent to the job

  • query: Optional query to be sent to the export function

Returns:
  • Export result

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

  • Post export: sender=self.__class__, instance=library_id, method=”exportLibrary”

getLibraryACL(library_id)

Gets the library ACL from Vidispine.

Args:
  • library_id: Id of the library.

Returns:
  • A VSACL object representing the item ACL

getLibraryStorageRule(lib_id, tag_name)

Get the storage rule for a specific library

Args:
  • lib_id: ID of the library

  • tag_name: Name of a shape tag associated with this rule

Returns:
  • A VSStorageRule object

getLibraryStorageRules(lib_id)

Get the storage rule for a specific library

Args:
  • lib_id: ID of the library

Returns:
  • A list of VSStorageRule objects

removeLibraryACLEntry(library_id, access_id)

Removes an ACL entry from a library

Args:
  • library_id: An library ID.

  • access_id: An ACL entry ID.

Returns:
  • None

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

  • Post delete: sender=self.__class__, instance=library_id, method=”removeLibraryACLEntry”

removeLibraryStorageRule(lib_id, shape_tag=None)

Removes the storage rule for a specific library

Args:
  • lib_id: ID of the library

  • shape_tag: The name of the shape tag. Optional variable. If not set, the GENERIC storage rule will be removed.

Returns:
  • None

Signals raised:
  • Pre delete: sender=self.__class__, instance=lib_id, method=”removeLibraryStorageRule”

  • Post delete: sender=self.__class__, instance=lib_id, method=”removeLibraryStorageRule”

setStorageRule(library_id, storagerule_doc, tag=None)

Set a rule to a storage

Args:
  • library_id: A library ID.

  • storagerule_doc: A pyxb storage rule document.

Returns:
  • Newly created entry ID

Signals raised:
  • Pre modify: sender=self.__class__, instance=library_id, method=”setStorageRule”, storagerule_doc=storagerule_doc, tag=tag

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

portal.vidispine.ilibrary.getMetadataElementsFromLibrary(lib_id, metadatagroup, user)

Returns (metadataelements, searchCriteria, textQuery) for a library.

portal.vidispine.ilibrary.get_datetime_now_server_tz()

Get current time as a datetime-object with timezone set to settings.TIME_ZONE. As a separate function so that this can easily mocked in testing.

Returns

datetime object

portal.vidispine.ilibrary.get_purgeable_items(grace_period)

Retrieves all the items that should be permanently deleted, however at most 1000 items. Double checks the “portal_deleted” value from each resulting VSItem and logs a WARNING if it does not match.

Parameters

grace_period – Grace period in hours (from portal.conf, default is 24)

Returns

A list of VSItem-objects