def __init__(self,reporter, workflow,task): super(ThumbsExecutor, self).__init__(reporter, workflow, task) elist=EncodersList() self.eparams=elist.getByUuid(task.attributes["encoder"]) if self.eparams==None: raise Exception("No encoder with guid "+task.attributes["encoder"]) if self.eparams.type<>"ffmpeg_0612": raise Exception("Unknown encoder type "+self.eparams.type) slist=LocalStoreList() self.frames=1 self.destAsset=task.attributes["srcAssetItem"] if task.attributes.has_key("destAssetItem"): self.destAsset=task.attributes["destAssetItem"] self.srcfile=slist.getByUuid(task.attributes["srcStore"]).findAssetFile(task.attributes["srcAssetItem"], task.attributes["srcAssetItemType"]) self.targetdir=slist.getByUuid(task.attributes["destStore"]).findAsset(self.destAsset) if not os.path.exists(self.targetdir): os.makedirs(self.targetdir)
def __init__(self,reporter, workflow,task): super(EncoderExecutor, self).__init__(reporter, workflow, task) elist=EncodersList() self.eparams=elist.getByUuid(task.attributes["encoder"]) if self.eparams==None: raise Exception("No encoder with guid "+task.attributes["encoder"]) if self.eparams.type=="ffmpeg_0612": self.encoder=FFmpegEncoder(self) else: raise Exception("Unknown encoder type "+self.eparams.type) slist=LocalStoreList() self.frames=1 self.overwrite=False if task.attributes.has_key("overwrite"): self.overwrite=(task.attributes["overwrite"].lower()=="true") dstAsset=task.attributes["srcAssetItem"] if task.attributes.has_key("destAssetItem"): dstAsset=task.attributes["destAssetItem"] srcstore=slist.getByUuid(task.attributes["srcStore"]) (ext, self.srcFps)=srcstore.decodeAssetType(task.attributes["srcAssetItemType"]) self.srcfile=getFFPath(srcstore, task.attributes["srcAssetItem"], task.attributes["srcAssetItemType"]) targetdir=slist.getByUuid(task.attributes["destStore"]).findAsset(dstAsset) if not os.path.exists(targetdir): os.makedirs(targetdir) self.outfile=slist.getByUuid(task.attributes["destStore"]).findAssetFile(dstAsset, self.eparams.outputtype)
def __init__(self,reporter, workflow,task): super(ImgRotateExecutor, self).__init__(reporter, workflow, task) elist=EncodersList() self.eparams=elist.getByUuid(task.attributes["encoder"]) if self.eparams==None: raise Exception("No encoder with guid "+task.attributes["encoder"]) slist=LocalStoreList() dstAsset=task.attributes["srcAssetItem"] if task.attributes.has_key("destAssetItem"): dstAsset=task.attributes["destAssetItem"] self.srcfile=slist.getByUuid(task.attributes["srcStore"]).findAssetFile(task.attributes["srcAssetItem"], task.attributes["srcAssetItemType"]) targetdir=slist.getByUuid(task.attributes["destStore"]).findAsset(dstAsset) if not os.path.exists(targetdir): os.makedirs(targetdir) self.outfile=slist.getByUuid(task.attributes["destStore"]).findAssetFile(dstAsset, self.eparams.outputtype) type=task.attributes["direction"] if type=="CCW90" or type=="CW270": self.type=Image.ROTATE_90 elif type=="CCW180" or type=="CW180": self.type=Image.ROTATE_180 elif type=="CCW270" or type=="CW90": self.type=Image.ROTATE_270 elif type=="VFLIP": self.type=Image.FLIP_TOP_BOTTOM elif type=="HFLIP": self.type=Image.FLIP_LEFT_RIGHT else: raise Exception("Wrong direction")
def __init__(self,reporter, workflow,task): super(ImgResizeExecutor, self).__init__(reporter, workflow, task) elist=EncodersList() self.eparams=elist.getByUuid(task.attributes["encoder"]) if self.eparams==None: raise Exception("No encoder with guid "+task.attributes["encoder"]) if self.eparams.type<>"PIL": raise Exception("Unknown encoder type "+self.eparams.type) slist=LocalStoreList() self.frames=1 dstAsset=task.attributes["srcAssetItem"] if task.attributes.has_key("destAssetItem"): dstAsset=task.attributes["destAssetItem"] self.srcfile=slist.getByUuid(task.attributes["srcStore"]).findAssetFile(task.attributes["srcAssetItem"], task.attributes["srcAssetItemType"]) targetdir=slist.getByUuid(task.attributes["destStore"]).findAsset(dstAsset) if not os.path.exists(targetdir): os.makedirs(targetdir) self.outfile=slist.getByUuid(task.attributes["destStore"]).findAssetFile(dstAsset, self.eparams.outputtype) self.watermarkFile=None if self.eparams.watermarkFile<>"": self.watermarkFile=Config.CONFIGDIR+"/"+self.eparams.watermarkFile elif self.eparams.watermarkAsset<>"": slist=LocalStoreList() store=slist.getByUuid(self.eparams.watermarkStore) self.watermarkFile=store.findAssetFile(self.eparams.watermarkAsset, self.eparams.watermarkAssetType)