Jump to content

Trying to make simple location…


Andriy Pogribniy

Recommended Posts

import functools
import logging
import ftrack_api
import ftrack_api.accessor.disk as _disk
import ftrack_api.structure.standard as _standard

logger = logging.getLogger('ftrack_user_location')

def configure_location(session, event):
    USER_DISK_PREFIX = 'C:/Users/andri/Desktop/Temp/'
    location = session.ensure('Location',{'name': 'Test_Location2'})
    location.accessor = _disk.DiskAccessor(prefix = USER_DISK_PREFIX)
    location.structure = _standard.StandardStructure()
    location.priority = 10
    logger.warning('Registering test location')

def register(api_object, **kw):
    if not isinstance(api_object, ftrack_api.Session):
        return
    api_object.event_hub.subscribe('topic=ftrack.api.session.configure-location',functools.partial(configure_location, api_object))

if __name__ == '__main__':
    logging.basicConfig(level = logging.INFO)
    session = ftrack_api.Session(server_url = 'https://inque.ftrackapp.com/', api_key = MY_API_KEY_HERE, api_user = MY_USER_NAME, auto_connect_event_hub = True)
    register(session)
    session.event_hub.wait()

And nothing happens.
What am I doing wrong?

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...