raul1st2002 Posted June 1, 2016 Report Share Posted June 1, 2016 Hi, I wonder how can I make an AssetVersion reviewable with the new API. I read the forum and found the old api has a makeReviewable method: ftrack.Review.makeReviewable(version, filePath) But I cannot find a similar one in the new API. I also tried manually adding a custom component with a name of 'ftrackreview-image' (which I found in a reviewable version published using ftrack connect). That doesn't work. Is this possible to do this without import the old api? Thank you for your help! Ding Link to comment Share on other sites More sharing options...
Mattias Lagergren Posted June 2, 2016 Report Share Posted June 2, 2016 Hey, here is an example of how to encode media with our new api: http://ftrack-python-api.rtd.ftrack.com/en/stable/example/encode_media.html Link to comment Share on other sites More sharing options...
raul1st2002 Posted June 2, 2016 Author Report Share Posted June 2, 2016 Thank you Mattias. I actually followed this section: http://ftrack.rtd.ftrack.com/en/3.3.25/developing/reviewing/publishing_components_for_review.html That solved my problem. It will be great if those two api docs can be combined. It's confusing when having two docs covering different aspects of the same api. Link to comment Share on other sites More sharing options...
Philip Posted August 10, 2016 Report Share Posted August 10, 2016 Hi On 02/06/2016 at 9:17 AM, Mattias Lagergren said: Hey, here is an example of how to encode media with our new api: http://ftrack-python-api.rtd.ftrack.com/en/stable/example/encode_media.html 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 Link to comment Share on other sites More sharing options...
Mattias Lagergren Posted August 11, 2016 Report Share Posted August 11, 2016 20 hours ago, Philip said: I followed the instructions, but when I commit (which is doesn't do in the example), it gives me an error. Could you send a minimal reproducible example of this code when it fails? It makes it easier for me to help and debug. Link to comment Share on other sites More sharing options...
Philip Posted August 11, 2016 Report Share Posted August 11, 2016 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 Link to comment Share on other sites More sharing options...
Mattias Lagergren Posted August 11, 2016 Report Share Posted August 11, 2016 Aha, yes - correct - and the example is broken! So what happens in the backend is that the service use will asynchronously encode the media. When that is done the new component will be added to the server location. When the example was written it was possible to set a component as thumbnail even though it did not exist in server location. That has changed and we're now verifying this. We will discuss here and see what the best approach is and then update the example. Thank you for making us aware of this! Link to comment Share on other sites More sharing options...
Flavien Posted September 2, 2019 Report Share Posted September 2, 2019 Three years later I've the same problem, that's normal ? Link to comment Share on other sites More sharing options...
JPrydz Posted September 5, 2019 Report Share Posted September 5, 2019 Hi Flavien, Could you elaborate on what's going wrong? Are you getting problem with thumbnail_id? The example has been changed. Regards, Johan Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.