def uploadToFtrack(self, taskid, playblast, currentFile, metadata, startFrame, endFrame, instance): session = ftrack_utils2.startSession() task = ftrack_utils2.getTask(session, taskid, currentFile) ftrack_utils2.addMetadata(session, task, metadata) ftrack_utils2.copyToApprovals(playblast, task['project']) outfilemp4, outfilewebm, thumbnail, metadata = ftrack_utils2.prepMediaFiles( playblast) result = ftrack_utils2.convertFiles(playblast, outfilemp4, outfilewebm, thumbnail) if result: asset = ftrack_utils2.getAsset(session, task, 'ReviewAsset') status = ftrack_utils2.getStatus(session, 'Pending Internal Review') try: ftrack_utils2.createAndPublishVersion( session, task, asset, status, 'Upload for Internal Review', thumbnail, playblast, outfilemp4, outfilewebm, metadata, startFrame, endFrame, 24) ftrack_utils2.deleteFiles(outfilemp4, outfilewebm, thumbnail) self.log.info("Movie Upload Successful") except Exception: self.log.error("Error during movie upload") ftrack_utils2.syncToJHB(playblast) else: self.log.error("Error during movie conversion")
def getTask(): nukeFile = nuke.scriptName() if 'FTRACK_TASKID' in os.environ: taskid = os.environ['FTRACK_TASKID'] else: taskid = None task = ftrack_utils2.getTask(_session, taskid, nukeFile) return task
def getTask(): nukeFile = nuke.scriptName() if 'FTRACK_TASKID' in os.environ: taskid = os.environ['FTRACK_TASKID'] else: taskid = None task = ftrack_utils2.getTask(_session, taskid, nukeFile) return task
def uploadToFtrack(): node = None nukeFile = nuke.scriptName() for write in nuke.allNodes('Write'): if write.name() == 'Write_mov': node = write break if node and node.knob('uploadToFtrack').value() and not \ nukeFile.endswith('.autosave'): print "Submitting to Dailies" outputFile = writeNodeManager.getOutputFile() if 'FTRACK_TASKID' in os.environ: taskid = os.environ['FTRACK_TASKID'] else: taskid = None task = ftrack_utils2.getTask(_session, taskid, nukeFile) node.knob('uploadToFtrack').setValue(False) if task: taskMeta = {'filename': nukeFile} fps = int(task['project']['custom_attributes']['fps']) ftrack_utils2.addMetadata(_session, task, taskMeta) ftrack_utils2.copyToApprovals(outputFile, task['project']) outfilemp4, outfilewebm, thumbnail, metadata = ftrack_utils2.prepMediaFiles( outputFile) print "Starting conversion..." result = ftrack_utils2.convertFiles(outputFile, outfilemp4, outfilewebm, thumbnail) if result: print "File conversion complete. Starting upload." asset = ftrack_utils2.getAsset(_session, task, 'ReviewAsset') status = ftrack_utils2.getStatus(_session, 'Pending Internal Review') ff = int(nuke.tcl('frames first')) lf = int(nuke.tcl('frames last')) try: ftrack_utils2.createAndPublishVersion( _session, task, asset, status, 'Upload for Internal Review', thumbnail, outputFile, outfilemp4, outfilewebm, metadata, ff, lf, fps) print 'cleaning up temporary files...' ftrack_utils2.deleteFiles(outfilemp4, outfilewebm, thumbnail) print 'Upload Complete!' except Exception: print "Error while uploading movie" ftrack_utils2.syncToJHB(outputFile) else: nuke.message( "Error in submitting to ftrack. The project details might be incorrect." )
def getShotInfo(self, *args): taskid = None filename = self.getCurrentMayaFile() if 'FTRACK_TASKID' in os.environ: taskid = os.environ['FTRACK_TASKID'] self.task = ftrack_utils2.getTask(self.session, taskid, filename) if self.task: projectName = self.task['project']['name'] self.shotName = self.task['parent']['name'] taskName = self.task['name'] username = ftrack_utils2.getUsername(self.task) try: self.version = 'v' + ftrack_utils2.version_get(filename, 'v')[1] except ValueError: self.version = 'v00' shotInfo = '{0} | {1} | {2} | {3} | {4}'.format( projectName, self.shotName, taskName, self.version, username) else: shotInfo = 'No valid task found' return shotInfo
def getShot(self, session, filename): taskid = None if 'FTRACK_TASKID' in os.environ: taskid = os.environ['FTRACK_TASKID'] task = ftrack_utils2.getTask(session, taskid, filename) return task['parent']
def getShot(self, session, filename): taskid = None if 'FTRACK_TASKID' in os.environ: taskid = os.environ['FTRACK_TASKID'] task = ftrack_utils2.getTask(session, taskid, filename) return task['parent']
def createMov(outdir, filename, taskid): session = ftrack_utils2.startANewSession() # If taskid is not valid, then don't try and figure it out from filename as it can # be problematic. Only upload if there is a valid taskid. task = ftrack_utils2.getTask(session, taskid, '') extractDir = '' imgSeq = glob.glob(outdir) imgSeq.sort() size = prores_utils.getImageSize(imgSeq[0]) # if exr, extract rgb channel if imgSeq[0].endswith('.exr'): print 'Extracting RGB channel from EXR image sequence...' extractDir = prores_utils.extractRGB(imgSeq) imgSeq = glob.glob(os.path.join(extractDir, '*')) imgSeq.sort() # make movie print 'Making movie...' movFile = prores_utils.makeMovie(imgSeq[0]) movFilename = os.path.split(movFile)[-1] parentDir = os.path.dirname(outdir) print 'Created: %s' % movFile # copy movFile to out filename location print 'Copying to location: %s' % parentDir try: shutil.copy(movFile, parentDir) except shutil.Error: logging.warning('Files are the same. Skipping copy') movFile = os.path.join(parentDir, movFilename) if task: print 'Valid task found!' artist = ftrack_utils2.getUsername(task) date = ftrack_utils2.getDate() try: version = 'v' + ftrack_utils2.version_get(filename, 'v')[1] except: version = 'v01' shotInfo = '{0} | {1} | {2} | {3} | {4}'.format(task['project']['name'], task['parent']['name'], task['name'], version, artist) if len(imgSeq) == 0: return slate = prores_utils.makeSlate(size, imgSeq[0], shotInfo, date) print 'Making slate movie' slateMov = prores_utils.makeSlateMovie(movFile, slate) logging.debug('Removing tmp files') if os.path.exists(slate): os.remove(slate) if os.path.exists(movFile): os.remove(movFile) movFile = slateMov logging.debug('Removing tmp exr files') if os.path.exists(extractDir): shutil.rmtree(extractDir) print 'Final movie file: %s' % movFile return movFile, task