Jump to content

Steve Petterborg

  • Posts

  • Joined

  • Last visited

  • Days Won


Reputation Activity

  1. Like
    Steve Petterborg reacted to Henrik Norin in Creating new events using API   
    Hi Aline,
    You would need to create both the event and the related project and/or users within the same transaction, e.g:
    ce=session.create('CalendarEvent',{'name':'TEST_PIPELINE','start': arrow.get('2021-08-25'),'end': arrow.get('2021-08-31')}) user=session.query('User where username is "aline3d"').first() event = session.create('CalendarEventResource',{'calendar_event_id':ce['id'],'resource_id':user['id']}) session.commit()  
  2. Like
    Steve Petterborg got a reaction from Andrew Lawrence in Length of query result ?   
    Not every user or global API key is able to access all projects. In particular, if a Project is set to private access, then the relevant User or global API key would need to be explicitly granted access to that Project. Otherwise I would expect it to be filtered out of the results.
  3. Like
    Steve Petterborg reacted to PeterH in API Explorer GUI   
    I made a tool for exploring the API a while back (just remembered to post here after catching a few errors earlier this week), as I was a bit fed up of my old process which was like this:
    >>> user = session.query('User').first() >>> print(user.keys()) # Look for a key related to groups >>> print(user['memberships']) # Perhaps this, check if entity or list >>> print(user['memberships'][0].keys()) # It's a list, check what each item has available >>> print(user['memberships'][0]['group'].keys()) # I see group, what keys does that have >>> print(user['memberships'][0]['group']['name']) # Found what I needed (random example though, I've never actually needed this) >>> user_groups = [membership['group']['name'] for membership in user['memberships']]  
    I find myself loading it now whenever I'm coding something that I'm unfamiliar with, so just sharing here in case anyone else would find it useful.

  4. Like
    Steve Petterborg got a reaction from danimic in javascript api error when using autoConnectEvenHub:true   
    We've updated the docs to clarify that the Event Hub is not supported under Node. Please let us know if you encountered this error in some other environment.
  5. Like
    Steve Petterborg reacted to Yas Opisso in How to UNassign user from a task?   
    You essentially have to delete the user assignment, here's a function below that removes all users given a specific task_id, it might not be exactly what you need since you might only want to remove a specific user but this should point you in the right direction.
    # Assumes a session is already established def unassing_users_from_task(task_id): # Queries users assigned to a task users_assigned_to_tasks = session.query( 'select assignments.context_id from User ' 'where assignments any (context_id = "{0}")'.format(task_id) ) for user in users_assigned_to_tasks: assignments = user['assignments'] for assignment in assignments: if assignment['context_id'] == task_id: session.delete(assignment) # Remember to use session.commit() I would only do this if you had in fact removed an assignment. session.commit()  
  6. Like
    Steve Petterborg reacted to cb_ftrack in New Experimental Player - Versions are out of order   
    @Bryan FordneyFYI, I have noticed that when you add shots to a review, it seems dependent on the order you select them. I have to presort my reviews properly in the main Ftrack view, and then shift select a block of them, and they will get added in that order I've selected them.
  7. Thanks
    Steve Petterborg got a reaction from Vlad Skrypnyk in Correct query for all status from some scheme   
    Hi Vlad,
    The Python API has a convenience method on ProjectSchema objects
    project_schema = session.query( 'ProjectSchema where name is "{}"'.format( "foo" ) ).one() # This is optional, and only needed if you have per-type status overrides in your schema. task_type = session.query( 'Type where name is "{}"'.format( "bar" ) ) task_statuses = project_schema.get_statuses( schema='Task', type_id=task_type['id'], ) https://bitbucket.org/ftrack/ftrack-python-api/src/master/source/ftrack_api/entity/project_schema.py
    The function is implemented in the linked file, and you could get some inspiration from there if you wanted to reimplement it yourself instead.
  8. Like
    Steve Petterborg reacted to Patrick Coan in Subtasks? Project / Shot / Task / Task   
    Hi Kristin, does it work to create an object, like "Shot" and place your tasks in there?
  9. Thanks
    Steve Petterborg got a reaction from Ethan in Review experimental player URL lifetime   
    There's not an obvious (to me) way to override that, but if you used the legacy API to make your own TempData object, you can specify the expiry yourself. It sounds clunky, but you could duplicate a playlist created in the usual way, and make the copy long-lasting. I'll see whether STHLM has a better idea.
  10. Like
    Steve Petterborg got a reaction from PeterH in Get all objects from User Groups   
    Hey Peter,
    What you're running in to is the fact that populate() constructs a query using that attribute string, and we don't support typecasting in a projection. see https://bitbucket.org/ftrack/ftrack-python-api/src/23f582cd146e71f871ba8a17da30c0ad831de836/source/ftrack_api/session.py#lines-1070
    We do support passing a list, tuple or QueryResult, so my workaround would be something like the populate line in this snippet. The rest is just included to set up my example / test.
    shot = session.query('select children from Shot where children is_not None').first() session.populate(shot['children'][:], 'status') with session.auto_populating(False): print(shot['children'][0]['name']) print(shot['children'][0]['status']) I suppose the root cause of all this is that children maps to Contexts, which can include Projects, which themselves do not have statuses.
  11. Thanks
    Steve Petterborg reacted to PeterH in send custom notifications via ftrack_api   
    I'm coming in 2 years late, but I was attempting to do this myself and found some info which might help others:
    If api_user == target_user, then target_user will never receive any notification. It can only be found in the sent items of author_user. The browser notification will always be from api_user.  The note itself will correctly be from author_user.
  12. Like
    Steve Petterborg got a reaction from Nebukadhezer in Get all objects from User Groups   
    Hi Johannes,
    Towards the bottom of this page (search for "subclass") we show some examples of casting a result to a single type:
    In your case, I believe you query string would be:
    "AssetVersion where task.assignments.resource[User].memberships.group.name is {}"  
  13. Like
    Steve Petterborg reacted to Nebukadhezer in HDR/LOG 10bit Review-mp4   
    vp9 is possible at the moment make sure to use a mp4 container though... with webm as an extension it wont work.
    x265 I think is problematic as the browser support is still limited. We use log c jpgs in RV a lot so, having OCIO ideally in the browser would be great.
    Have been having the same dream to have log encoded media in the web too.
    While talking about VP9, we have not made the switch cause the encoding times with ffmpeg compared to x264 are ridiculously high... this was a year ago maybe....  
    I have not tried 10 bit...
  14. Like
    Steve Petterborg got a reaction from jen_at_floyd in How to make publish look like published by another user?   
    Hi Jen,
    You'll want to find the Event object which was created in response to the publish and change the user_id. Unlike the info panel, the activity feed didn't seem to refresh automatically for me, so make sure to reload the page when you make your change.
    event = session.query( 'Event where action is "asset.published"' ' and parent_id is "{}"'.format( asset_version['id']) ).one() event['user_id'] = cool_user['id'] session.commit()  
  15. Like
    Steve Petterborg got a reaction from laba Kumar Maharana in Unable to connect to the server   
    Is there more to the error? Can you post some more of the log? What are you doing when the error pops up? Can you load the Diagnostics page in Server Settings?
  • Create New...