+# :copyright: Copyright (c) 2018 ftrack
+'''Create a reviewable version and set the version's thumbnail as shot thumbnail.'''
+FILE_PATH = '/Users/lucas/Downloads/Frame count.mp4'
+ASSET_NAME = 'Test asset'
+session = ftrack_api.Session()
+# Get a random shot and create a new AssetVersion
+shot = session.query('Shot').first()
+asset_type = session.query('AssetType where name is "Upload"').one()
+asset = session.create('Asset', {
+version = session.create('AssetVersion', { 'asset': asset })
+job = version.encode_media(FILE_PATH)
+# Wait for job completion
+while job['status'] == 'running':
+ print 'Waiting for job completion'
+ job = session.query('select status from Job where id is "{}"'.format(job['id'])).one()
+shot['thumbnail_id'] = version['thumbnail_id']