写了一个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.\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

时间: 2024-07-29 04:04:54

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

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

初步学习nodejs,业余用node写个一个自动创建目录和文件的小脚本,希望对需要的人有所帮助,如果有bug或者更好的优化方案,也请批评与指正,谢谢,代码如下: 1 var fs = require('fs'); 2 var tel = [ 3 "1/2/4/6/a.tpl.html", 4 "1/2/4/7/9/c.tpl.html", 5 "1/3/5/8/b.tpl.html"]; 6 var demo = function (mulu)

今天写了一个批量检查ip是否ping得通的脚本,备忘

脚本内容如下,需要配合ip.txt使用.ip.txt里写上需要检查的ip for i in `cat ./ip.txt` do { ping -c 1 $i >/dev/null 2>&1 if [ ! $? -eq 0 ] then echo date >>./error_ip.txt echo $i >>./error_ip.txt echo >>./error_ip.txt fi }& done wait

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

最近偶然接触到一点点的php开发,要用到mysql数据库,由于mysql和php版本的关系,php5里面连接函数有mysql_connect(),mysqli_connect()两种,php7中又使用了mysqli()对象,想到以后上一些其他项目时有可能需要调试这些问题,随手写了个小的php脚本,用来检测当前php与mysql的连接状态和可以使用的连接函数,代码如下: <?php header("Content-type:text/html;charset=utf-8"); $s

写的一个oracle安装前的准备的脚本,大家可以拿去修改修改使用

#!/bin/bash # echo "拷贝文件:"# read -p "please input the server you share your os installation media and oracle software:" server # mkdir /installyationMedia# scp [email protected]${server}:/iso/* /installationMedia# if [ -e /installation

wg_pagenation 1.0 自己写的一个分页插件_基于Jquery

前言: 现在这个分页插件也不少,感觉缺点什么,所以自己就写了一个,喜欢的人就拿去用......有bug和建议可以回复,我有空就修改和答复..... 感谢我的基友,刘总...他主要给本插件写配套主题css; 特点: 整合ajax可以异步和后台交互数据,定制化选项多.和Jquery的pagenation比较类似,但是功能更多,选择性更多. 当前版本:1.0 完成日期:20150815 效果图: White.css的效果图: default.css效果图: 上图上向下的箭头表示的是每一个可选择和更改的

利用html5的本地存储写的一个购物车

好久没有写博客园了,很多知识没有记录下来:可惜: 这几天在开发微信,也写了一个订餐平台的微网站,里面需要写一个购物车: 这里主要是把商品的部分信息以json格式保存在sessionstorage中,还有商店信息也是: 以json格式保存有什么好处呢,轻量级的传输,大概是这样吧!另外,如果我们把商品信息分开存储,就会导致有多条的sessionstorage项,那以后实现在两家商店同时购物的话,就不可能区分每家商店的商品了: 如果代码是自己写的,就有版权,这么说.对吧,是在软件工程师书上看到的: 不

如何正确地写好一个界面

写界面可以说是每位移动应用开发者的基本功,也是一位合格移动应用开发者绕不过去的坎.但就如不是每一位开发者都能够成为合格的开发者一样,本人在 不同的团队中发现,甚少有人能够编写出合格的UI代码:而非常奇怪的是,在很多的开发者论坛上看到我们移动开发者更多关注于某个控件或者是动画,但却很少 看到深入剖析UI机制,指导UI开发的文章. 由于界面涉及到的方面实在过于广泛,本文不可能事无巨细,一一道来,所以本文先立足于点,深入剖析iOS UI系统中不被重视却非常重要的机制,帮助本文读者对iOS的UI系统有整

写了一个RenderInBackground的脚本

某部门领导需要一个nuke中批量渲染的工具,而nuke中的render in background功能恰恰可以多个渲染任务同时执行,于是我考虑使用这个方法来实现. 调 试过程中发现renderinbackground对内存的管理是堪忧的,所以我添加了控制多任务渲染时内存消耗的参数.这个功能写起来很快,写完之后还 得考虑artist的使用习惯,把这个功能做成一个单独的节点放在工具栏里实在不是一个明智之举,artist会嫌麻烦,所以我决定把这个功能集成到 write节点上. 这是最终执行结果: wr

去年某比赛写的一个策划(一)

项目目的: 我们主题营销项目的目的是 1)推广YYY品牌, 2)含沙射影打击竞争对手品牌 3)针对目前正在如火如荼的XXXX大战,给公司助力 . 项目分三阶段 1.第一阶段 1) 项目主角:AZ 环境:星际安全大厦. 反派角色:幻影旅团(名称出自<全职猎人>),成员为破坏宇宙和平的反动黑客分子, 主要矛盾: AZ负责维护整个宇宙星际的安全 幻影旅团的破坏分子们(参考威震天等)没事就破坏宇宙和平人类安全 2)第一阶段任务 战队负责,制作 AZ及星际安全大厦和幻影旅团的飞船,飞船上部透明可以看见幻