def __init__(self,reporter, workflow,task, encrypt): super(AESExecutor, self).__init__(reporter, workflow, task) slist=LocalStoreList() self.srcasset=slist.getByUuid(task.attributes["srcStore"]).findAsset(task.attributes["srcAssetItem"]) self.targetstore=slist.getByUuid(task.attributes["destStore"]) self.destdir=self.targetstore.findAsset(self.task.attributes["destAssetItem"]) self.encrypt=encrypt if not os.path.exists(self.destdir): os.makedirs(self.destdir)
def __init__(self,reporter, workflow,task): super(ZipExecutor, self).__init__(reporter, workflow, task) slist=LocalStoreList() self.srcassetuid=task.attributes["srcAssetItem"] self.dstassetuid=task.attributes["srcAssetItem"] if task.attributes.has_key("destAssetItem"): self.dstassetuid=task.attributes["destAssetItem"] self.srcasset=slist.getByUuid(task.attributes["srcStore"]).findAsset(task.attributes["srcAssetItem"]) targetdir=slist.getByUuid(task.attributes["destStore"]).findAsset(self.dstassetuid) if not exists(targetdir): os.makedirs(targetdir) self.outfile=slist.getByUuid(task.attributes["destStore"]).findAssetFile(self.dstassetuid, "zip")
def __init__(self,reporter, workflow,task): super(RenderExecutor, self).__init__(reporter, workflow, task) slist=LocalStoreList() self.frames=1 self.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"]) self.targetdir=slist.getByUuid(task.attributes["destStore"]).findAsset(self.dstAsset) (self.ext, fps)=slist.getByUuid(task.attributes["destStore"]).decodeAssetType(task.attributes["destAssetItemType"]) if not os.path.exists(self.targetdir): os.makedirs(self.targetdir)
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 verify(doc): mng=XMLJobManager() slist=StoreList() llist=LocalStoreList() mng.registerPlugins() workflow=XMLWorkflow(doc.documentElement) for task in workflow.tasks: exc=getTaskExecutor(mng, task) if task.attributes.has_key("destStore"): store=llist.getByUuid(task.attributes["destStore"]) if store<>None: continue store=slist.getByUuid(task.attributes["destStore"]) if store==None: raise Exception("Unknown destination store") # oops, requested remote destination store and executor does not support it # change destination store to local one and add MOVE task after that if not exc.supportsRemoteDestination: task.element.setAttribute("destStore", task.attributes["srcStore"]) extra=doc.createElement("task") extra.setAttribute("guid", uuid4().get_hex()) extra.setAttribute("action", "MOVE") extra.setAttribute("srcStore", task.attributes["srcStore"]) if task.attributes.has_key("destAssetItem"): extra.setAttribute("srcAssetItem", task.attributes["destAssetItem"]) else: extra.setAttribute("srcAssetItem", task.attributes["srcAssetItem"]) extra.setAttribute("destStore", store.uuid) doc.documentElement.insertBefore(extra, task.element.nextSibling)
def __init__(self,reporter, workflow,task, move): super(CopyMoveExecutor, self).__init__(reporter, workflow, task) slist=LocalStoreList() self.move=move self.srcassetuid=task.attributes["srcAssetItem"] self.dstassetuid=task.attributes["srcAssetItem"] if task.attributes.has_key("destAssetItem"): self.dstassetuid=task.attributes["destAssetItem"] self.overwrite=False if task.attributes.has_key("overwrite"): self.overwrite=(task.attributes["overwrite"].lower()=="true") self.srcasset=slist.getByUuid(task.attributes["srcStore"]).findAsset(task.attributes["srcAssetItem"]) self.targetstore=slist.getByUuid(task.attributes["destStore"]) self.isLocal=True if self.targetstore==None: self.isLocal=False slist2=StoreList() self.targetstore=slist2.getByUuid(task.attributes["destStore"]) if self.targetstore==None: raise Exception("Unknown destination store") self.desthost=slist2.getDisk(self.targetstore.diskuuid).host
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 handleWatermark(this): fps=None if this.eparams.watermarkFile<>"": path=Config.CONFIGDIR+"/"+this.eparams.watermarkFile elif this.eparams.watermarkAsset<>"": slist=LocalStoreList() store=slist.getByUuid(this.eparams.watermarkStore) (ext, fps)=store.decodeAssetType(this.eparams.watermarkAssetType) path=getFFPath(store, this.eparams.watermarkAsset, this.eparams.watermarkAssetType) else: return [] if fps==None: return this.handleSingleWatermark(path) else: return this.handleAnimatedWatermark(path, fps)
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)
def __init__(self,reporter, workflow,task): super(DeleteExecutor, self).__init__(reporter, workflow, task) slist=LocalStoreList() self.srcasset=slist.getByUuid(task.attributes["srcStore"]).findAsset(task.attributes["srcAssetItem"])
def __init__(self,reporter, workflow,task): super(MediaInfoExecutor, self).__init__(reporter, workflow, task) slist=LocalStoreList() self.srcfile=slist.getByUuid(task.attributes["srcStore"]).findAssetFile(task.attributes["srcAssetItem"], task.attributes["srcAssetItemType"]) self.dstfile=slist.getByUuid(task.attributes["srcStore"]).findAssetFile(task.attributes["srcAssetItem"], "xml")