The basic idea is to write a time-judging function (postsequence_check) That compares the Transcode task commit time to the modified time of the file within the target folder to determine if the render was executed successfully, and then The Time judgment function (Postsequence_check) is injected into the Hiero via the postsequence hook function provided by Hiero.
The usage is simple, save as a script and refer to it in __init__. Talk was 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 a 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 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 are 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
Wrote a script that Hiero check the results of a task's rendering