def updateMetadata(self, session, metadata):
     taskPath, asset, comment = self.getUploadDetails(session)
     task, version = ftrack_utils.createVersion(session, taskPath, asset, comment)
     ftrack_utils.addMetadata(session, version, metadata)
     thumbnail = str(self.thumbnailEdit.text())
     if not thumbnail=='':
         ftrack_utils.attachThumbnail(thumbnail, task, asset, version)
     ftrack_utils.setTaskStatus(session, taskPath, version, str(self.statusDrop.currentText()))
 def newThreadUpload(self, session, inputFile, outfilemp4, outfilewebm, thumnbail, metadata):
     result = self.convertFiles(inputFile, outfilemp4, outfilewebm)
     if result:
         thumbresult = ftrack_utils.createThumbnail(outfilemp4, thumnbail)
         taskPath, asset, comment = self.getUploadDetails(session)
         version = ftrack_utils.createAndPublishVersion(session, taskPath, comment, asset,
                                             outfilemp4, outfilewebm, thumnbail,
                                             self.frameIn, self.frameOut, self.framerate)
         ftrack_utils.setTaskStatus(session, taskPath, version, str(self.statusDrop.currentText()))
         ftrack_utils.addMetadata(session, version, metadata)
     self.deleteFiles(outfilemp4, outfilewebm, thumnbail)
 def newThreadJpg(self, inputFile, session, metadata):
     ext = os.path.splitext(inputFile)[1]
     if (ext == '.jpg') or (ext == '.jpeg'):
         outfilejpg = inputFile
     else:
         outfilejpg =  os.path.splitext(inputFile)[0] + '.jpg'
         result = ftrack_utils.convertToJpg(inputFile, outfilejpg)
     taskPath, asset, comment = self.getUploadDetails(session)
     version = ftrack_utils.publishImage(session, taskPath, comment, asset, outfilejpg)
     ftrack_utils.setTaskStatus(session, taskPath, version, str(self.statusDrop.currentText()))
     ftrack_utils.addMetadata(session, version, metadata)
     self.uploadButton.setEnabled(True)
     self.uploadButton.setText('Publish')
     self.uploadComplete.emit('Publish Complete!')