zoukankan      html  css  js  c++  java
  • 写了一个hiero检查任务渲染结果的脚本

    基本思路是写了一个时间判断函数(postSequence_check)来对比transcode任务提交时间和目标文件夹内文件的修改时间来确定渲染是否成功执行,然后通过Hiero提供的postSequence钩子函数将时间判断函数(postSequence_check)注入进Hiero。

    用法很简单,保存为一个脚本,并在__init__中引用即可。
     
    Talk is cheap,show you the code:
     
    ###################################################################################################################################################################
     
    import hiero.core,hiero.exporters
    import sys
    import os,datetime
    import time
     
    #GLOBAL_NAMELIST=[]

    def updateItem_new (self, originalItem, localtime):
        #print sys._getframe().f_code.co_name

        global GLOBAL_LOCALTIME,GLOBAL_CLASS_TYPE
        GLOBAL_LOCALTIME = time.mktime(localtime)
        GLOBAL_CLASS_TYPE = self
        

        """updateItem - This is called by the processor prior to taskStart, crucially on the main thread.
          This gives the task an opportunity to modify the original item on the main thread, rather than the clone."""
        #if isinstance(self._item, (Sequence,TrackItem)):
        #if isinstance(self._item, Clip):

        timestamp = self.timeStampString(localtime)
        tag = hiero.core.Tag("Transcode " + timestamp, "icons:Nuke.png")
        tag.metadata().setValue("tag.path", self.resolvedExportPath())
        tag.metadata().setValue("tag.localtime", str(localtime))
        # Right now dont add the time to the metadata
        # We would rather store the integer time than the stringified time stamp
        #tag.setValue("time", timestamp)

        # No point in adding script path if we're not planning on keeping the script
        if self._preset.properties()["keepNukeScript"]:
          tag.metadata().setValue("tag.script", self._scriptfile)

        start, end = self.outputRange()
        tag.metadata().setValue("tag.startframe", str(start))
        tag.metadata().setValue("tag.duration", str(end-start+1))
        
        frameoffset = self._startFrame if self._startFrame else 0
        if hiero.core.isVideoFileExtension(os.path.splitext(self.resolvedExportPath())[1].lower()):
          frameoffset = 0
        tag.metadata().setValue("tag.frameoffset", str(frameoffset))
        
        if self._cutHandles:
          tag.metadata().setValue("tag.handles", str(self._cutHandles))

        self._tag_guid = tag.guid()

        originalItem.addTag(tag)

        # The guid of the tag attached to the trackItem is different from the tag instace we created
        # Get the last tag in the list and store its guid
        self._tag_guid = originalItem.tags()[-1].guid()
        
    hiero.exporters.FnTranscodeExporter.TranscodeExporter.updateItem = updateItem_new


    ######################################################################################################
    ######################################################################################################
    ######################################################################################################


    def postSequence_check(self):

        #print sys._getframe().f_code.co_name
        
        #print self.__class__

        #print self._filebase

        if isinstance(self,hiero.exporters.FnTranscodeExporter.TranscodeExporter):
            #print "yeah!"
            #print self._root
            #print self._shotPath
            #print self._filebase
            #print self._version
            #print self._track
            #print self.outputRange()
            #print self.properties()
            #print initDictionary

            #GLOBAL_NAMELIST.append(self._filebase)

            base_dir = self._root
            base_dir = "/".join(base_dir.split('/')[0:-1])
            print self._filebase
            list = []
            timestamplist = []
            list = os.listdir(base_dir)  

            if len(list) > 0:
                for i in range(0, len(list)):  
                    path = os.path.join(base_dir,list[i])  
                    if os.path.isfile(path):  
                        path = os.path.join(base_dir, list[i])  
                        if os.path.isdir(path):  
                            continue  
                        timestamp = os.path.getmtime(path)  
                        timestamplist.append(timestamp)
            
                #print GLOBAL_LOCALTIME,min(timestamplist)

                if GLOBAL_LOCALTIME > min(timestamplist):
                    print "(VHQ) This transcode task has some problem:" + self._filebase
                else:
                    print '(VHQ) This transcode task is OK!'
            else:
                print "(VHQ) This transcode task has some problem:" + self._filebase
        else:
            base_dir = self._filebase
            #base_dir = "/".join(base_dir.split('/')[0:-1])
            print base_dir
            print str(self.__class__).strip('<').strip('>').strip("'").split('.')[-1] + ' is not transcode render task!'

    hiero.core.FnExporterBase.TaskBase.postSequence = postSequence_check



  • 相关阅读:
    jQuery属性操作,attr 和 prop的区别。笔记记录
    li 自身样式不显示?使用 overflow:hidden 导致li 前面点,圈等样式不见情况处理
    jQuery 最新版类库 和 常用的类库[jquery-1.12.3,jquery-1.7.2]下载
    Excel 中如何让下拉菜单显示汉字,但是值是数字
    Uncaught TypeError: $(...).on is not a function
    全选,全不选,反选的逻辑思路
    Linux 解决 vsftpd 读取目录列表失败的问题。
    SQL Sever 2012数据库从下载到安装完成【一步一图,带上脑子即可】
    【闲暇研究】某问道,游戏的整合记录
    Tomcat 启动后出现乱码的解决办法。
  • 原文地址:https://www.cnblogs.com/hksac/p/4867953.html
Copyright © 2011-2022 走看看