Jump to content

Philip

Members
  • Posts

    33
  • Joined

  • Last visited

  • Days Won

    1

Everything posted by Philip

  1. Shotgun has this, and I found it very useful indeed. It allowed us to make more complicated relationships between entities. Especially when paired with non project entities as well. (Which I don't think ftrack has?) An example of that would be, when we tracked materials as non project entities, we could associate our assets with the materials (that would happen at publish time) and then we know which assets in which projects depended upon certain materials. +1
  2. Yes Sorry: versionID = "4f1d2286-4f9c-4406-b1a4-b918dbfeb987" filename = "L:\\script_library\\temporary_files\\1470830134.mov" version = session.get('AssetVersion', versionID) job = session.encode_media(filename) job_data = json.loads(job['data']) for output in job_data['output']: component = session.get('FileComponent', output['component_id']) # Add component to version. component['version_id'] = version['id'] # Add thumbnail to the version. if output['format'] == 'image/jpeg': version['thumbnail_id'] = output['component_id'] session.commit() produces the following error for me: Traceback (most recent call last): File "C:/Users/Philips/Documents/source_code/test_project/ftrack/make_playable_media.py", line 36, in <module> session.commit() File "L:\script_library\pipeline\libs\3rd_party\production\ftrack_api\session.py", line 1159, in commit result = self._call(batch) File "L:\script_library\pipeline\libs\3rd_party\production\ftrack_api\session.py", line 1528, in _call raise ftrack_api.exception.ServerError(error_message) ftrack_api.exception.ServerError: Server reported error: ValidationError(FileComponent with id u'734a28f2-5fa3-11e6-b665-22000ab8015b' was not found in an a valid location, please make sure it is present in the ftrack.server location.) I've got around it for the time being by adding the following at the end, but this doesn't seem like a good solution: retry = True while retry: try: session.commit() retry = False except: pass
  3. Hi I followed the instructions, but when I commit (which is doesn't do in the example), it gives me an error. I think this is because the job hasn't finished. If I put an arbitrary `time.sleep(20)` then it works fine, because the job has already finished by then. It doesn't mention in the example that you need to wait for the job to finish before committing the attaching of the component to the version, and adding the thumbnail. How do I correctly wait for the job to finish? Thanks Phil
×
×
  • Create New...