Run an action to list review invite links
1 1

4 posts in this topic

Hi all,

I am trying to run an old action which used to work years ago and is really handy. it lists the review links for participants so I can mail them to them myself (wont get intercepted by spam)

I followed this:

  • Make sure you have installed the ftrack Connect desktop service.
  • Download you Action from our Code repository or community forum and save it on your computer.
  • Start Connect and click on the service menu and “Open plugin folder”.
  • Create new sub-folders inside the plugins folder with the name of your action, e.g. <ftrack-plugins-folder>/my-fancy-action/hook/.
  • Now place the action .py file inside the hook/ folder.
  • Quit and start Connect again to reload your new action.

 

but ftrack connect doesn't boot up as soon as I put the script in this folder. I am on os x, latest. 

 

import logging

import ftrack_api

logging.basicConfig(level=logging.INFO)

session = ftrack_api.Session()

identifier = 'review-session-list-invitees'

def discover(event):
    '''Return action for event.'''
    for selected_item in event['data'].get('selection', []):
        if selected_item['entityType'] == 'reviewsession':
            return {
                'items': [{
                    'label': 'List invitees',
                    'actionIdentifier': identifier
                }]
            }

session.event_hub.subscribe(
    'topic=ftrack.action.discover',
    discover
)

def launch(event):
    '''Launch *event*.'''
    items = []
    for selected_item in event['data'].get('selection', []):
        if selected_item['entityType'] == 'reviewsession':
            review_session = session.get(
                'ReviewSession', selected_item['entityId']
            )
            items.append({
                'type': 'label',
                'value': u'**Invitees for {0}**'.format(review_session['name'])
            })
            for invitee in review_session['review_session_invitees']:
                items.append({
                    'type': 'label',
                    'value': u'{0}: {1}/review/{2}'.format(
                        invitee['name'],
                        # Do not use private variable.
                        session._server_url,
                        invitee['id']
                    )
                })
    return {
        'items': items
    }

session.event_hub.subscribe(
    'topic=ftrack.action.launch and '
    'data.actionIdentifier="{0}"'.format(identifier),
    launch
)
session.event_hub.wait()

 

 

 

 

 

Share this post


Link to post
Share on other sites

Hi there,

Could you please have a look at the log for Connect?
And see what it says.
You can find it in the Connect menu,  under About/Open log directory.
Also, please try to run the script outside of Connect and see if it works.

Regards,
Johan

Share this post


Link to post
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
1 1