ftrack_api.accessor.disk

class ftrack_api.accessor.disk.DiskAccessor(prefix, **kw)[source]

Provide disk access to a location.

Expect resource identifiers to refer to relative filesystem paths.

__init__(prefix, **kw)[source]

Initialise location accessor.

prefix specifies the base folder for the disk based structure and will be prepended to any path. It should be specified in the syntax of the current OS.

list(resource_identifier)[source]

Return list of entries in resource_identifier container.

Each entry in the returned list should be a valid resource identifier.

Raise AccessorResourceNotFoundError if resource_identifier does not exist or AccessorResourceInvalidError if resource_identifier is not a container.

exists(resource_identifier)[source]

Return if resource_identifier is valid and exists in location.

is_file(resource_identifier)[source]

Return whether resource_identifier refers to a file.

is_container(resource_identifier)[source]

Return whether resource_identifier refers to a container.

is_sequence(resource_identifier)[source]

Return whether resource_identifier refers to a file sequence.

open(resource_identifier, mode='rb')[source]

Return Data for resource_identifier.

remove(resource_identifier)[source]

Remove resource_identifier.

Raise AccessorResourceNotFoundError if resource_identifier does not exist.

make_container(resource_identifier, recursive=True)[source]

Make a container at resource_identifier.

If recursive is True, also make any intermediate containers.

get_container(resource_identifier)[source]

Return resource_identifier of container for resource_identifier.

Raise AccessorParentResourceNotFoundError if container of resource_identifier could not be determined.

get_filesystem_path(resource_identifier)[source]

Return filesystem path for resource_identifier.

For example:

>>> accessor = DiskAccessor('my.location', '/mountpoint')
>>> print accessor.get_filesystem_path('test.txt')
/mountpoint/test.txt
>>> print accessor.get_filesystem_path('/mountpoint/test.txt')
/mountpoint/test.txt

Raise ftrack_api.exception.AccessorFilesystemPathError if filesystem path could not be determined from resource_identifier.

get_url(resource_identifier)

Return URL for resource_identifier.

Raise AccessorFilesystemPathError if URL could not be determined from resource_identifier or AccessorUnsupportedOperationError if retrieving URL is not supported by this accessor.

remove_container(resource_identifier)

Remove container at resource_identifier.

ftrack_api.accessor.disk.error_handler(**kw)[source]

Conform raised OSError/IOError exception to appropriate FTrack error.