Jump to content

Tom Mikota

Members
  • Posts

    14
  • Joined

  • Last visited

  • Days Won

    1

Everything posted by Tom Mikota

  1. Good points Yas, and yeah i'm finding that i am needing to control the version numbers at times, at least now i've got the version up happening on the end of Ftrack. I like your explanation of first() and one() as well, i'm still brute forcing my way thought some things as i get a larger overview. On the asset_version - that's a leftover from a test i was doing, forgot to delete it lol.
  2. OK i got this figured out, and yes it was dumb lol. Expressing my thoughts in a written form really helped me debug this one. This is my final code for these tests just in case anyone else runs into this. I just had to add a simple query (which i was already doing in my code but for some reason couldn't get it working until now) for checking to see if the Asset already existed. Once you have the asset Ftrack handles the version numbers. Which is exactly what you're saying, but something about the mutiple components flying around got me confused. Thanks for your patience all! session = ftrack_api.Session(server_url=server_url, api_key=api_key, api_user=api_user, auto_connect_event_hub=True) server_location = session.query('Location where name is "ftrack.server"').first() path = r'D:\VFX\FRIDAY_ROOT\testco\render\cgl_unittest\shots\020\0100\plate\tmiko\000.001\high\Capture.PNG' preview_path = r'D:\VFX\FRIDAY_ROOT\testco\render\cgl_unittest\shots\020\0200\plate\tmiko\000.001\high\.preview\Capture.jpg' thumb_path = r'D:\VFX\FRIDAY_ROOT\testco\render\cgl_unittest\shots\020\0200\plate\tmiko\000.001\high\.thumb\Capture.jpg' task = session.get('Task', 'dfa65df9-d955-4d4e-9658-e2bf8c11a10c') asset_parent = task['parent'] asset = session.query('Asset where name is "{0}" and parent.id is "{1}"'.format(task['name'], asset_parent['id'])).one() asset_type = session.query('AssetType where name is "Geometry"').one() if not asset: asset = session.create('Asset', { 'name': task['name'], 'type': asset_type, 'parent': asset_parent }) session.commit() asset_version = session.query('AssetVersion where asset_id is %s' % asset['id']).first() asset_version = session.create('AssetVersion', { 'asset': asset, 'task': task }) print asset_version['id'], 'asset_version_id' session.commit() asset_version.create_component(path=preview_path, data={ 'name': 'ftrackreview-image', }, location=server_location ) asset_version.create_component(path=thumb_path, data={ 'name': 'thumbnail' }, location=server_location ) session.commit()
  3. I feel kind of dumb on this one, i've spent days on this, figured out hacks to work around the duplicate entry problem, and now i'm back to it trying to figure it out properly. I'm assuming there's just a fundamental thing i'm not seeing because i have a different paradigm in my head for what's going on under the hood. But i'm not sure what it is.
  4. That link is what i've based all my code off of. I"ve restructured my code for the purposes of this conversation to look as identical to the docs as possible. I have the same result. I can run this code once, but get "duplicate entry" errors after that. My question is - what is ftrack expecting as a trigger that i'm uploading a new 'version' and therefore starts incrementing on the version numbers. I would assume based off this conversation that i don't change anything on the create('assetversion') code. task = session.get('Task', 'dfa65df9-d955-4d4e-9658-e2bf8c11a10c') asset_parent = task['parent'] asset_type = session.query('AssetType where name is "Geometry"').one() asset = session.create('Asset', { 'name': task['name'], 'type': asset_type, 'parent': asset_parent }) asset_version = session.create('AssetVersion', { 'asset': asset, 'task': task }) session.commit() asset_version.create_component(path=preview_path, data={ 'name': 'ftrackreview-image', }, location='auto' ) asset_version.create_component(path=thumb_path, data={ 'name': 'thumbnail' }, location='auto' ) session.commit()
  5. When i attempt to create a second AssetVersion and connect it to an Existing Asset i get a "duplicate entry" error: self.version_data = self.ftrack.create('AssetVersion', { 'asset': self.task_asset, 'task': self.task_asset['parent'], }) This is the way i'm currently doing it. Adding "version" to this doesn't change me getting the error. This works fine the first time i run it and create the initial "assetVersion" but after that it gives me an error, so i've been getting around it in other ways (creating an Asset for each AssetVersion) but i'd love to do it the proper "ftrack" way, as i'm running into some hurdles with this methodology.
  6. Let's say i wanted to just use components (i'm ensuring all media is a properly formatted .mp4 files with an accompanything thumbnail that i control) and didn't want to use the encode() function. Is there a way to find/remove old components? This is something that'd be super useful for me.
  7. How do i define version numbers within the ftrack API? This is the code that's creating the "asset" of the thumbnail below. self.task_asset = self.ftrack.create('Asset', { 'name': self.version, 'type': asset_type, 'parent': self.entity_data }) Right now however, i'm just creating a new "Asset" for every version and giving it a version number where "name" is. Basically what i'm wanting to do is create a shot 000_0500, and this would be 'taskName v23' in my ideal world. I just couldn't ever get the version number to change so i'm doing it this way. I've tried using Assets, AssetVesions, etc... I have everything 'working' in terms of uploading quicktimes, image previews, thumbnails etc... but there's definitely something that's not right in what i'm doing with either the way i'm conceptualizing Assets or AssetVersions, or components or something. would love to know the proper way of controlling the number in v1 below! Thanks
  8. Yup, that was it! Thanks man, that's hilarious, i didn't notice it until working on this ftrack plugin, so it seemed like it was specific to this. Nope, just my own config code for the app, that I WROTE like 2 years ago lol.
  9. Perfect this is exactly what i'm looking to do thanks @Lorenzo Angeli
  10. I'm wondering how to mute this kind of feed from the ftrack session: 2019-07-17 11:37:48,561 DEBUG Checking for entity in cache with key ('Status', ['a0bc2444-15e2-11e1-b21a-0019bb4983d8']) "C:\Users\tmiko\AppData\Roaming\Python\Python27\site-packages\ftrack_api\session.py:967" 2019-07-17 11:37:48,561 DEBUG Retrieved existing entity from cache: <Status(a0bc2444-15e2-11e1-b21a-0019bb4983d8)> at 582088240 "C:\Users\tmiko\AppData\Roaming\Python\Python27\site-packages\ftrack_api\session.py:974" 2019-07-17 11:37:48,561 DEBUG Cache not updated with merged entity as no differences detected. "C:\Users\tmiko\AppData\Roaming\Python\Python27\site-packages\ftrack_api\session.py:998" 2019-07-17 11:37:48,561 DEBUG Merging potential new data into attached entity for attribute task_status. "C:\Users\tmiko\AppData\Roaming\Python\Python27\site-packages\ftrack_api\attribute.py:36" 2019-07-17 11:37:48,561 DEBUG Merging remote value for attribute <ftrack_api.attribute.ReferenceAttribute(task_status) object at 571977800>. "C:\Users\tmiko\AppData\Roaming\Python\Python27\site-packages\ftrack_api\attribute.py:73" 2019-07-17 11:37:48,561 DEBUG Merging entity into session: <Status(a0bc3f24-15e2-11e1-b21a-0019bb4983d8)> at 582088408 "C:\Users\tmiko\AppData\Roaming\Python\Python27\site-packages\ftrack_api\session.py:852" 2019-07-17 11:37:48,561 DEBUG Entity not already processed for key ('Status', ['a0bc3f24-15e2-11e1-b21a-0019bb4983d8']). "C:\Users\tmiko\AppData\Roaming\Python\Python27\site-packages\ftrack_api\session.py:962" What's odd to me is that i don't get it when i just run command line tests. I do get it when i'm running from my custom pyside GUIs. I'm guessing i just set something somewhere that i'm not aware of.
  11. So i've been using an ffmpeg script to create high quality h264 versions of everything before i upload and that works fine every time. I tried a bunch of different things before that. (let me know if you want the script) I'm super interested in the "proper" Prores Workflow though. Soon i'll be creating those for editorial purpose, but i hadn't thought about actually uploading them. I was planning to just make an h264 as well as a ProRes from existing CG frames. Would love to know workflows/strategies people are using. Right now i'm using "encode" simply becaqse it creates the thumbnail for me. But i think i'll likely switch over to just uploading the thumb myself so i avoid all "in server" processing. Is that an option? I found the "encode" example on here and it worked so i used it. But I'd love to just upload something in the correct format for it to play directly, and upload the thumbnail myself as to require 0 actual encoding on the server. Would love to know the "correct" workflow for that.
  12. So here's some more information just if anybody is interested: This code is searching for a sequence that doesn't exist: seqs = session.query('Sequence where name is "{0}" and project.id is "{1}"'.format('060', project_data['id'])).first() .first() returns None seqs = session.query('Sequence where name is "{0}" and project.id is "{1}"'.format('060', project_data['id'])).one() .one() returns: Traceback (most recent call last): File "C:/Users/tmiko/PycharmProjects/cglumberjack/src/plugins/project_management/ftrack/ftrack_unit_tests/ftrack_tests.py", line 16, in <module> seqs = session.query('Sequence where name is "{0}" and project.id is "{1}"'.format('060', project_data['id'])).one() File "C:\Users\tmiko\AppData\Roaming\Python\Python27\site-packages\ftrack_api\query.py", line 167, in one raise ftrack_api.exception.NoResultFoundError() ftrack_api.exception.NoResultFoundError: Expected result, but no result was found. This is the one that is screwing me up - so i'll avoid using this .all() returns: [] So that's a good option as well. If i don't have anything telling ftrack what to return i get a QueryResult object This at least demystifies why i'm getting different results.
  13. Ok I'm learning more about this already. QueryResult happens when i fail to put .one(), first(), or all() on the end of my query. This is going to make a huge difference moving forward. Going through and fixing some of these right now and tightening up my code. Still curious as to if there's another way other than querying and then creating based off the results. But this is getting cleaner!
  14. I want to create a project (or Sequence, or Shot, or AssetVersion, etc....) but right now i'm using all kinds of different ways of checking to see if something exists before i create it. I'm guessing there's some simple way of doing this that i'm just not aware of. For instance. To Create a Project Currently I'm doing something like this: project_data = session.query('Project where status is active and name is %s' % 'cgl_unittest2').first() print project_data if not project_data: project_data = session.create('Project', { 'name': 'cgl_unittest2', 'full_name': 'cgl_unittest2', 'project_schema': project_schema }) Problem is when unsuccessful these queries return: None, QueryResult, or sometimes they return an error. So i'm creating all kinds of workarounds for the fact that there is often different results returned depending on the type i'm querying. is there some kind of 'safe' flag on the create() function or some other way of checking to see if something exists before creating it?
×
×
  • Create New...