基本思路是写了一个时间判断函数(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.\n
      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

写了一个hiero检查任务渲染结果的脚本的更多相关文章

  1. 初步学习nodejs,业余用node写个一个自动创建目录和文件的小脚本,希望对需要的人有所帮助

    初步学习nodejs,业余用node写个一个自动创建目录和文件的小脚本,希望对需要的人有所帮助,如果有bug或者更好的优化方案,也请批评与指正,谢谢,代码如下: var fs = require('f ...

  2. 写了一个hiero中添加自定义Token的脚本

    Hiero自带Token往往不够用,shotname中自带版本号的情况下要升级版本会很麻烦,比如Shot_0001_v001这样一个序列名,要升级为Shot_0001_v002就必须把_v001之前的 ...

  3. 随手写的一个检测php连接mysql的小脚本

    最近偶然接触到一点点的php开发,要用到mysql数据库,由于mysql和php版本的关系,php5里面连接函数有mysql_connect(),mysqli_connect()两种,php7中又使用 ...

  4. python 拼写检查代码(怎样写一个拼写检查器)

    原文:http://norvig.com/spell-correct.html 翻译:http://blog.youxu.info/spell-correct.html 怎样写一个拼写检查器 Pete ...

  5. 如何写一个拼写检查器-by Peter Norvig

    本文原著:Peter Norvig  中文翻译:徐宥 上个星期, 我的两个朋友 Dean 和 Bill 分别告诉我说他们对 Google 的快速高质量的拼写检查工具感到惊奇. 比如说在搜索的时候键入 ...

  6. 闲来无事,用Java的软引用写了一个山寨的缓存

    闲来无事,用Java的软引用写了一个山寨的缓存 博客分类: java基础 众所周知java中的引用分为 StrongReference.SoftReference.WeakReference.Phan ...

  7. Pluto - iOS 上一个高性能的排版渲染引擎

    WeTest 导读 Pluto 是 iOS 上的一个排版渲染引擎,通过 JSON/JS 文件可以很方便地描述界面元素,开发效率很高,并且在流畅度,内存等方便有保证.pluto.oa.com 上有更多详 ...

  8. 自己写的一个Vue

    下面这里是我自己写的一个小型的vue,原理就是proxy: //Proxy天生没有prototype,因此要加上,不然extends会报错 Proxy.prototype = Proxy.protot ...

  9. 自己写的一个Solr搜索实例,增删改查+高亮+分页

    今天个人coding的模块测试,所以闲暇之余继续研究solr,然后顺带写了一个实例,随便搞的,solr真心不熟,期待认识热爱搜索的朋友,共同进步. 1.配置schema.xml文件[solr\coll ...

随机推荐

  1. 位图(bitmap)—— C语言实现

    高级数据结构及应用 -- 使用 bitmap 进行字符串去重 位图应当具备的置一,清零,以及判断三大功能: #define BITS_PER_WORD 32 #define MASK 0x1f #de ...

  2. win7快捷方式图标修复

    test.bat ///////////////////////////////////////////////////////////////////////// rem 关闭Windows外壳程序 ...

  3. Java中的面向对象II

    既然要创建一个对象那么就需要有一个类,下面介绍类的构建. 一.类的两个元素: 1.字段 字段也就是类变量,每一个类变量都是类的成员. <1.>类变量访问指定通常是私有的(private)或 ...

  4. pytorch实现rnn并且对mnist进行分类

    1.RNN简介 rnn,相比很多人都已经听腻,但是真正用代码操练起来,其中还是有很多细节值得琢磨. 虽然大家都在说,我还是要强调一次,rnn实际上是处理的是序列问题,与之形成对比的是cnn,cnn不能 ...

  5. Unity 3D光源-Point Light点光源详解/灯泡、模拟灯光效果教程

    Unity4大光源之点光源 本文提供全流程,中文翻译. Chinar 坚持将简单的生活方式,带给世人!(拥有更好的阅读体验 -- 高分辨率用户请根据需求调整网页缩放比例) Chinar -- 心分享. ...

  6. django安装命令

    通过pip安装Django   ==指定版本号 pip install Django==2.0.2 查看djangoshifou安装成功:1.进入python ,2.import   django 查 ...

  7. 修改select样式

    CSS就可以解决,原理是将浏览器默认的下拉框样式清除,然后应用上自己的,再附一张向右对齐小箭头的图片即可. select { /*Chrome和Firefox里面的边框是不一样的,所以复写了一下*/ ...

  8. Win-Lin双系统重装Windows找回Linux启动

    第一系统Windows,第二系统Linux:Ubuntu18.10: 1. 重新安装Windows系统后,使用Ubuntu的安装光盘,或启动U盘启动电脑:2. 选择:Try Ubuntu ;3. 进入 ...

  9. 被卡住的2个问题:1.输入url不执行后台的java方法 2.改了jsp页面,再次请求还是以前的那个页面

    1.问题 一个子项目,它的java代码都是打包到磁盘这个文件夹  D://commlib java代码改了之后,也是打包到这个文件夹里,刷新就可看见改了的. 要想子项目能运行,必须在主项目中从/com ...

  10. Cassandra -- Cassandra 3.0版本安装

    ============================================================ 服务器信息 搭建三节点的Cassandra群集: SERVER1: 192.1 ...