def process(self, context, instance): # sourcePath = os.path.normpath(instance.data.get('extractDir')) # assert sourcePath version = context.data['version'] version = 'v' + str(version).zfill(3) self.log.debug(version) taskid = context.data('ftrackData')['Task']['id'] self.log.debug(taskid) task = ftrack.Task(taskid) ftrack_data = context.data['ftrackData'] if 'Asset_Build' not in ftrack_data.keys(): templates = [ 'shot.publish.file' ] else: templates = [ 'asset.publish.file' ] self.log.debug(templates) publishFile = ft_pathUtils.getPathsYaml(task, templateList=templates, version=version, object_name=instance.data['variation']) publishFile = publishFile[0] instance.data['publishFile'] = publishFile
def process(self, instance): extractedPaths = [v for k,v in instance.data.items() if k.startswith('outputPath')] componentPath = '' for sourcePath in extractedPaths: # sourcePath = os.path.normpath(instance.data('outputPath')) version = instance.context.data('version') version = 'v' + str(version).zfill(3) taskid = instance.context.data('ftrackData')['Task']['id'] ftrack_data = instance.context.data['ftrackData'] if 'Asset_Build' in ftrack_data.keys(): templates = [ 'asset.publish.scene' ] else: templates = [ 'shot.publish.scene' ] self.log.debug(templates) root = instance.context.data('ftrackData')['Project']['root'] self.log.debug(root) publishFile = ft_pathUtils.getPathsYaml(taskid, templateList=templates, version=version, root=root) path, extension = os.path.splitext(publishFile[0]) sourceFile, source_ext = os.path.splitext(sourcePath) publishFile = path + source_ext self.log.info('Moving preview from location: {}'.format(sourcePath)) self.log.info('Moving preview to location: {}'.format(publishFile)) shutil.move(sourcePath, publishFile) if '.mov' not in componentPath: componentPath = publishFile if componentPath: self.log.debug('Component Path: {}'.format(componentPath)) components = instance.data['ftrackComponents'].copy() components['review']['path'] = componentPath instance.data['ftrackComponents'] = components self.log.debug('Components: {}'.format(instance.data['ftrackComponents']))
def process(self, context): if 'new_scene' in context: return if context.has_data('version'): sourcePath = context.data('currentFile') new_file = pyblish_utils.version_up(sourcePath) version = ''.join(pyblish_utils.version_get(new_file, 'v')) taskid = context.data('ftrackData')['Task']['id'] ftrack_data = context.data['ftrackData'] if 'Asset_Build' not in ftrack_data.keys(): templates = [ 'shot.work.scene' ] else: templates = [ 'asset.work.scene' ] root = context.data('ftrackData')['Project']['root'] self.log.debug(root) new_workFile = ft_pathUtils.getPathsYaml(taskid, templateList=templates, version=version, root=root)[0] ################################################################# self.log.info('New workfile version created: \ {}'.format(new_workFile)) self.log.info('Next time you opens this task, \ start working on the version up file') shutil.copy(sourcePath, new_workFile) context.set_data('versionUpFile', value=new_workFile) else: raise pyblish.api.ValidationError( "Can't find versioned up filename in context. \ workfile probably doesn't have a version.")
def process(self, instance, context): if instance.has_data('outputPath'): sourcePath = os.path.normpath(instance.data('outputPath')) version = context.data('version') version = 'v' + str(version).zfill(3) taskid = context.data('ftrackData')['Task']['id'] ftrack_data = context.data['ftrackData'] if 'Asset_Build' in ftrack_data.keys(): templates = [ 'asset.publish.file' ] else: templates = [ 'shot.publish.file' ] self.log.debug(templates) root = context.data('ftrackData')['Project']['root'] self.log.debug(root) publishFile = ft_pathUtils.getPathsYaml(taskid, templateList=templates, version=version, root=root) path, extension = os.path.splitext(publishFile[0]) publishFile = path + ".mov" self.log.info('Moving preview from location: {}'.format(sourcePath)) self.log.info('Moving preview to location: {}'.format(publishFile)) shutil.move(sourcePath, publishFile) # ftrack data components = instance.data('ftrackComponents') components['preview']['path'] = publishFile instance.set_data('ftrackComponents', value=components) else: self.log.warning('preview wasn\'t created so it can\'t be published')
def process(self, instance): version = instance.context.data['version'] version = 'v' + str(version).zfill(3) self.log.debug(version) taskid = instance.context.data('ftrackData')['Task']['id'] self.log.debug(taskid) root = instance.context.data('ftrackData')['Project']['root'] self.log.debug(root) ftrack_data = instance.context.data['ftrackData'] if 'Asset_Build' not in ftrack_data.keys(): templates = [ 'shot.publish.item' ] else: templates = [ 'asset.publish.item' ] subset = '' if instance.data.get('subset'): subset = instance.data['subset'] kwargs = { 'family': instance.data['family'], 'item': instance.data['item'], 'version': version, 'subset': subset, } self.log.debug(templates) self.log.debug(kwargs) publishFile = ft_pathUtils.getPathsYaml(taskid, templateList=templates, root=root, **kwargs ) self.log.debug('paths returned: {}'.format(publishFile)) publishFile = publishFile[0] instance.data['publishFile'] = publishFile self.log.debug('saving publishFile to instance: {}'.format(publishFile))
def process(self, instance): # Get Target Path version = instance.context.data('version') version = 'v' + str(version).zfill(3) taskid = instance.context.data('ftrackData')['Task']['id'] root = instance.context.data('ftrackData')['Project']['root'] self.log.debug(root) ftrack_data = instance.context.data['ftrackData'] if 'Asset_Build' in ftrack_data.keys(): templates = [ 'asset.cam.file' ] else: templates = [ 'shot.cam.file' ] publishFile = ft_pathUtils.getPathsYaml(taskid, templateList=templates, version=version, item='cam' root=root)[0] self.log.debug(publishFile) # Get source Path extractedPaths = [v for k,v in instance.data.items() if k.startswith('outputPath')] for path in extractedPaths: sourcePath = path self.log.debug(sourcePath) filename, ext = os.path.splitext(sourcePath) publishFile = os.path.splitext(publishFile)[0] + ext self.log.info('Copying camera to location: {}'.format(publishFile)) shutil.copy(sourcePath, publishFile)
def process(self, context, instance): if context.has_data("version"): sourcePath = context.data("currentFile") new_file = pyblish_utils.version_up(sourcePath) version = "".join(pyblish_utils.version_get(new_file, "v")) taskid = context.data("ftrackData")["Task"]["id"] ftrack_data = context.data["ftrackData"] if "Asset_Build" not in ftrack_data.keys(): templates = ["shot.work.file"] else: templates = ["asset.work.file"] root = context.data("ftrackData")["Project"]["root"] self.log.debug(root) new_workFile = ft_pathUtils.getPathsYaml(taskid, templateList=templates, version=version, root=root)[0] ################################################################# self.log.info( "New workfile version created: \ {}".format( new_workFile ) ) self.log.info( "Next time you opens this task, \ start working on the version up file" ) shutil.copy(sourcePath, new_workFile) context.set_data("versionUpFile", value=new_workFile) else: raise pyblish.api.ValidationError( "Can't find versioned up filename in context. \ workfile probably doesn't have a version." )
def process(self, instance): version = instance.context.data['version'] version = 'v' + str(version).zfill(3) self.log.debug(version) taskid = instance.context.data('ftrackData')['Task']['id'] self.log.debug(taskid) ftrack_data = instance.context.data['ftrackData'] if 'Asset_Build' not in ftrack_data.keys(): templates = [ 'shot.publish.scene' ] else: templates = [ 'asset.publish.scene' ] self.log.debug(templates) root = instance.context.data('ftrackData')['Project']['root'] self.log.debug(root) publishFiles = ft_pathUtils.getPathsYaml(taskid, templateList=templates, version=version, root=root) publishFile = publishFiles[0] publishFolder = os.path.dirname(publishFile) self.log.debug(publishFile) if os.path.exists(publishFolder): instance.context.set_data('publishFile', value=publishFile) instance.context.set_data('deadlineInput', value=publishFile) self.log.debug('Setting publishFile: {}'.format(publishFile)) else: name = instance msg = 'Publish directory for %s doesn\'t exists' % name raise ValueError(msg)
def process(self, context, instance): version = context.data['version'] version = 'v' + str(version).zfill(3) self.log.debug(version) taskid = context.data('ftrackData')['Task']['id'] self.log.debug(taskid) root = context.data('ftrackData')['Project']['root'] self.log.debug(root) ftrack_data = context.data['ftrackData'] if 'Asset_Build' not in ftrack_data.keys(): templates = [ 'shot.publish.file' ] else: templates = [ 'asset.publish.file' ] object_name = None if instance.data.get('variation'): object_name = instance.data['variation'] self.log.debug(templates) publishFile = ft_pathUtils.getPathsYaml(taskid, templateList=templates, version=version, object_name=object_name root=root) publishFile = publishFile[0] instance.data['publishFile'] = publishFile self.log.debug('saving publishFile to instance: {}'.format(publishFile)) # ftrack data components = instance.data['ftrackComponents'] self.log.debug(str(components)) components[instance.data['variation']]['path'] = publishFile self.log.debug(str(components)) instance.data['ftrackComponents'] = components
def process(self, context, instance): if context.has_data('version'): version = context.data['version'] version = 'v' + str(version).zfill(3) self.log.debug(version) taskid = context.data('ftrackData')['Task']['id'] self.log.debug(taskid) root = context.data('ftrackData')['Project']['root'] self.log.debug(root) ftrack_data = context.data['ftrackData'] if 'Asset_Build' in ftrack_data.keys(): templates = [ 'asset.work.file' ] else: templates = [ 'shot.work.file' ] self.log.debug(templates) new_workFile = ft_pathUtils.getPathsYaml(taskid, templateList=templates, version=version, root=root)[0] context.data['workfile'] = new_workFile self.log.info('New workfile path prepared: \ {}'.format(new_workFile)) else: raise pyblish.api.ValidationError( "Can't find versioned up filename in context. \ workfile probably doesn't have a version.")
def process(self, instance): version = instance.context.data['version'] version = 'v' + str(version).zfill(3) self.log.debug(version) taskid = instance.context.data('ftrackData')['Task']['id'] self.log.debug(taskid) root = instance.context.data('ftrackData')['Project']['root'] self.log.debug(root) ftrack_data = instance.context.data['ftrackData'] if 'Asset_Build' in ftrack_data.keys(): templates = [ ] else: templates = [ 'shot.abccache.file' ] item = instance.data['name'] self.log.debug(templates) publishFile = ft_pathUtils.getPathsYaml(taskid, templateList=templates, version=version, item=item, root=root) publishFile = publishFile[0] instance.data['publishFile'] = publishFile self.log.debug('saving publishFile to instance: {}'.format(publishFile)) # ftrack data components = instance.data['ftrackComponents'] self.log.debug(str(components)) components[item]['path'] = publishFile self.log.debug(str(components)) instance.data['ftrackComponents'] = components
def process(self, instance, context): if instance.has_data('outputPath'): sourcePath = os.path.normpath(instance.data('outputPath')) version = context.data('version') version = 'v' + str(version).zfill(3) taskid = context.data('ftrackData')['Task']['id'] task = ftrack.Task(taskid) parents = task.getParents() # Prepare data for parent filtering parenttypes = [] for parent in parents: try: parenttypes.append(parent.get('objecttypename')) except: pass # choose correct template if 'Episode' in parenttypes: templates = [ 'tv-ep-preview-file', ] elif 'Sequence' in parenttypes: templates = [ 'tv-sq-preview-file', ] publishFile = ft_pathUtils.getPaths(task, templates, version) publishFile = os.path.normpath(publishFile[templates[0]]) projectName = task.getProject().getName() if projectName not in ['rad', 'drm']: if 'Asset Build' not in parenttypes: templates = [ 'shot.publish.file' ] else: templates = [ 'asset.publish.file' ] self.log.debug(templates) publishFile = ft_pathUtils.getPathsYaml(task, templateList=templates, version=version) path, extension = os.path.splitext(publishFile[0]) publishFile = path + ".mov" self.log.info('Moving preview from location: {}'.format(sourcePath)) self.log.info('Moving preview to location: {}'.format(publishFile)) shutil.move(sourcePath, publishFile) # ftrack data components = instance.data('ftrackComponents') components['preview']['path'] = publishFile instance.set_data('ftrackComponents', value=components) else: self.log.warning('preview wasn\'t created so it can\'t be published')