Jump to content

jiri.sindelar

Members
  • Posts

    4
  • Joined

  • Last visited

Posts posted by jiri.sindelar

  1. Hi,
    I am struggling with filtering notes. User supplies the project name, shot and task, with optional note label filtering and optional version filtering (for version notes).
    Maybe there is a way to directly query that? I do not know how to find out if note has particular label

    Thank you

     

    self.ftrack_label = self.ftrack_session.query(
                                'NoteLabel where name is "{}"'.format(label)
                            ).first()
    notes = []
    f_task = self.ftrack_session.query(
        'Task where name is {} and parent.name is {}'
        ' and project.full_name is {}'.format(task, shot,
    					  project)).first()
    if do_version:
        assets = self.ftrack_session.query(
    	'select asset.name, version from AssetVersion '
    	'where task_id is "{}" and asset.name is_not '
    	'none order by version desc'.format(
    	    f_task['id'])).all()
    
        version_gui = int(version)
        for one_asset in assets:
    	version_asset = int(one_asset['version'])
    	if version_gui == version_asset:
    	    for one_note in one_asset['notes']:
    		content = one_note['content']
    		_save = False
    		if do_label:
    		    l = one_note['note_label_links']
    		    if self.ftrack_label['id'] in l:
    			_save = True
    		else:
    		    _save = True
    		if _save:
    		    v = version_matching(content, version)
    		    if v is not None:
    			notes.append(content)
    else:
        for one_note in f_task['notes']:
    	_save = False
    	content = one_note['content']
    	if do_label:
    	    l = one_note['note_label_links']
    	    if self.ftrack_label['id'] in l:
    		_save = True
    	else:
    	    _save = True
    	if _save:
    	    v = version_matching(content, version)
    	    if v is not None:
    		notes.append(content)

     

×
×
  • Create New...