Package qb :: Package backend :: Module afterEffectsLogParser
[hide private]
[frames] | no frames]

Source Code for Module qb.backend.afterEffectsLogParser

 1  #====================================== 
 2  #  $Revision: #3 $ 
 3  #  $Change: 15708 $ 
 4  #====================================== 
 5  import sys 
 6   
 7  import qb.backend.logParser 
 8  import qb.backend.utils as backendUtils 
 9   
10 -class AERenderLogParser(qb.backend.logParser.LogParser):
11 ''' 12 This LogParser class is for AfterEffects sequence renders. 13 '''
14 - def calcProgress(self, progressMatchStr, qbTokens):
15 ''' 16 Calculate the internal progress of an AfterEffects sequence render. 17 18 AfterEffects progress output does not include the frame number, but rather the 1-based index 19 of the frame in the chunk. 20 21 eg: if rendering a 5 frame chunk from frames 6-10, the output will contain: 22 23 PROGRESS: 0:00:09:05 (1): 0 Seconds 24 PROGRESS: 0:00:09:05 (2): 0 Seconds 25 PROGRESS: 0:00:09:05 (3): 0 Seconds 26 PROGRESS: 0:00:09:05 (4): 0 Seconds 27 PROGRESS: 0:00:09:05 (5): 0 Seconds 28 29 So this method finds the AE frame number (1-5 in this case), then determines how many frames 30 are in the chunk, and then calculates the completion value for the chunk. 31 32 @param progressMatchStr: the value used to derive the progress within the chunk. It is 33 simply the progress percentage integer matched in the application output. 34 35 @type progressMatchStr: C{str} 36 37 @param qbTokens: a dictionary containing all the QB_FRAME* values to aid in calculation the 38 in-chunk progress. 39 40 @type qbTokens: C{dict} 41 42 @return: The amount of work complete for the item, expressed as a float between 0 and 1.0, 1.0 being completely done. 43 @rtype: C{float} 44 ''' 45 progress = 0.0 46 chunkLen = len(qb.genframes(qbTokens['QB_FRAME_RANGE'])) 47 48 try: 49 progress = '%0.2f' % (float(progressMatchStr) / chunkLen,) 50 except ValueError: 51 backendUtils.flushPrint('WARNING: the logParser %s did not extract a valid frame number: "%s"' % (self.__class__.__name__, progressMatchStr), fhList=sys.stderr) 52 backendUtils.flushPrint(backendUtils.formatExc(), fhList=[sys.stderr]) 53 54 return progress
55