# :coding: utf-8# :copyright: Copyright (c) 2018 ftrack'''Create a reviewable version and set the version's thumbnail as shot thumbnail.'''importftrack_apiimporttimeFILE_PATH='/Users/lucas/Downloads/Frame count.mp4'ASSET_NAME='Test asset'session=ftrack_api.Session()# Get a random shot and create a new AssetVersionshot=session.query('Shot').first()asset_type=session.query('AssetType where name is "Upload"').one()asset=session.create('Asset',{'name':ASSET_NAME,'type':asset_type,'parent':shot})version=session.create('AssetVersion',{'asset':asset})session.commit()job=version.encode_media(FILE_PATH)# Wait for job completionwhilejob['status']=='running':print'Waiting for job completion'time.sleep(5)job=session.query('select status from Job where id is "{}"'.format(job['id'])).one()# Set shot thumbnailshot['thumbnail_id']=version['thumbnail_id']session.commit()
Comments (0)
HTTPSSSH
You can clone a snippet to your computer for local editing.
Learn more.