def fillRecdFromNode( recd, el ): if (el.getAttributeNode(Constants.recdType) != None): typeInt = int(el.getAttribute(Constants.recdType)) recd.type = typeInt if (el.getAttributeNode(Constants.recdTitle) != None): recd.title = el.getAttribute(Constants.recdTitle) if (el.getAttributeNode(Constants.recdTime) != None): timeInt = int(el.getAttribute(Constants.recdTime)) recd.time = timeInt if (el.getAttributeNode(Constants.recdRecorderName) != None): recd.recorderName = el.getAttribute(Constants.recdRecorderName) if (el.getAttributeNode(Constants.recdTags) != None): recd.tags = el.getAttribute(Constants.recdTags) else: recd.tags = "" if (el.getAttributeNode(Constants.recdRecorderHash) != None): recd.recorderHash = el.getAttribute(Constants.recdRecorderHash) if (el.getAttributeNode(Constants.recdColorStroke) != None): try: colorStrokeHex = el.getAttribute(Constants.recdColorStroke) colorStroke = Color() colorStroke.init_hex(colorStrokeHex) recd.colorStroke = colorStroke except: record.Record.log.error("unable to load recd colorStroke") if (el.getAttributeNode(Constants.recdColorFill) != None): try: colorFillHex = el.getAttribute(Constants.recdColorFill) colorFill = Color() colorFill.init_hex( colorFillHex ) recd.colorFill = colorFill except: record.Record.log.error("unable to load recd colorFill") if (el.getAttributeNode(Constants.recdBuddy) != None): recd.buddy = (el.getAttribute(Constants.recdBuddy) == "True") if (el.getAttributeNode(Constants.recdMediaMd5) != None): recd.mediaMd5 = el.getAttribute(Constants.recdMediaMd5) if (el.getAttributeNode(Constants.recdThumbMd5) != None): recd.thumbMd5 = el.getAttribute(Constants.recdThumbMd5) if (el.getAttributeNode(Constants.recdMediaBytes) != None): recd.mediaBytes = el.getAttribute(Constants.recdMediaBytes) if (el.getAttributeNode(Constants.recdThumbBytes) != None): recd.thumbBytes = el.getAttribute(Constants.recdThumbBytes) bt = el.getAttributeNode(Constants.recdBase64Thumb) if (bt != None): try: thumbPath = os.path.join(Instance.instancePath, "datastoreThumb.jpg") thumbPath = utils.getUniqueFilepath( thumbPath, 0 ) thumbImg = utils.getPixbufFromString( bt.nodeValue ) thumbImg.save(thumbPath, "jpeg", {"quality":"85"} ) recd.thumbFilename = os.path.basename(thumbPath) record.Record.log.debug("saved thumbFilename") except: record.Record.log.error("unable to getRecdBase64Thumb") ai = el.getAttributeNode(Constants.recdAudioImage) if (not ai == None): try: audioImagePath = os.path.join(Instance.instancePath, "audioImage.png") audioImagePath = utils.getUniqueFilepath( audioImagePath, 0 ) audioImage = utils.getPixbufFromString( ai.nodeValue ) audioImage.save(audioImagePath, "png", {} ) recd.audioImageFilename = os.path.basename(audioImagePath) record.Record.log.debug("loaded audio image and set audioImageFilename") except: record.Record.log.error("unable to load audio image") datastoreNode = el.getAttributeNode(Constants.recdDatastoreId) if (datastoreNode != None): recd.datastoreId = datastoreNode.nodeValue return recd