コード例 #1
0
    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")
コード例 #2
0
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."
            )
コード例 #3
0
 def uploadToFtrack(self, filename, mayaFile, comment):
     if self.task:
         taskMeta = {'filename': mayaFile}
         self.movieUploadUpdate.emit(10, 'Updating metadata...')
         ftrack_utils2.addMetadata(self.session, self.task, taskMeta)
         self.movieUploadUpdate.emit(15, 'Prepping media files...')
         ftrack_utils2.copyToApprovals(filename, self.task['project'])
         outfilemp4, outfilewebm, thumbnail, metadata = ftrack_utils2.prepMediaFiles(
             filename)
         self.movieUploadUpdate.emit(20, 'Starting file conversion...')
         ff, lf = ftrack_utils2.getFrameLength(filename)
         result = ftrack_utils2.convertFiles(filename, outfilemp4,
                                             outfilewebm, thumbnail)
         if result:
             self.movieUploadUpdate.emit(45, 'File conversion complete.')
             self.movieUploadUpdate.emit(50, 'Starting file upload...')
             asset = ftrack_utils2.getAsset(self.session, self.task,
                                            'ReviewAsset')
             status = ftrack_utils2.getStatus(self.session,
                                              'Pending Internal Review')
             try:
                 ftrack_utils2.createAndPublishVersion(
                     self.session, self.task, asset, status, comment,
                     thumbnail, filename, outfilemp4, outfilewebm, metadata,
                     ff, lf, 24, True)
                 self.movieUploadUpdate.emit(
                     95, 'cleaning up temporary files...')
                 ftrack_utils2.deleteFiles(outfilemp4, outfilewebm,
                                           thumbnail)
                 self.movieUploadUpdate.emit(100, 'Upload Complete!')
             except Exception:
                 self.movieUploadFail.emit(
                     'Upload Failed: Error uploading to ftrack.')
             ftrack_utils2.syncToJHB(filename)
         else:
             self.movieUploadFail.emit(
                 'Upload Failed: Error during file conversion.')
     else:
         self.movieUploadFail.emit('Upload Failed: No Valid Task Found')
コード例 #4
0
def uploadToFtrack(task, movFile):
    session = ftrack_utils2.startANewSession()
    logging.info( "Encoding Media Files...")
    ftrack_utils2.copyToApprovals(movFile, task['project'])
    outfilemp4, outfilewebm, thumbnail, metadata = ftrack_utils2.prepMediaFiles(movFile)
    logging.info( 'Starting file conversion...')
    ff, lf = ftrack_utils2.getFrameLength(movFile)
    result = ftrack_utils2.convertFiles(movFile, outfilemp4, outfilewebm, thumbnail)
    if result:
        logging.info( 'File conversion complete.')
        logging.info( 'Starting file upload...')
        asset = ftrack_utils2.getAsset(session, task, 'ReviewAsset')
        status = ftrack_utils2.getStatus(session, 'In Progress')
        try:
            ftrack_utils2.createAndPublishVersion(session, task, asset,
                                                  status, 'Upload for Internal Review',
                                                  thumbnail, movFile, outfilemp4,
                                                  outfilewebm, metadata, ff, lf, 24)
            logging.debug( 'cleaning up temporary files...')
            ftrack_utils2.deleteFiles(outfilemp4, outfilewebm, thumbnail)
            logging.info( 'Upload Complete!')
        except Exception, e:
            logging.error( 'Upload Failed: Error uploading to ftrack.')
            logging.error(e)