def run(self, a_dict_data): t_argv = ct_plu.argv(a_dict_data) t_sou_list = t_argv.get_sys_file() t_des_list = t_argv.get_sys_des_file() t_no_same_folder_des_list = [] try: #取出不是源和目标相同目录的目标列表 if len(t_sou_list) >= 1 and len(t_des_list) >= 1 and len( t_sou_list) == len(t_des_list): for i in range(len(t_sou_list)): sou_dir = os.path.dirname(t_sou_list[i]) des_dir = os.path.dirname(t_des_list[i]) if sou_dir != des_dir: t_no_same_folder_des_list.append(t_des_list[i]) #如果已经在的路径则报错 error = "" for path in t_no_same_folder_des_list: if os.path.exists(path): if error == "": error = path else: error = error + "\n" + path #最后要返回 if error != "": return self.ct_false("File exist:" + "\n" + error) else: return self.ct_true() except Exception, e: #print traceback.format_exc() return self.ct_false(traceback.format_exc())
def run(self, a_dict_data): t_argv = ct_plu.argv(a_dict_data) t_db = t_argv.get_sys_database() t_module = t_argv.get_sys_module() t_module_type = t_argv.get_sys_module_type() t_id_list = t_argv.get_sys_id() t_check_group_id = t_argv.get_filebox_key("allow_group_id") try: t_tw = tw() #如果是我的任务不检查 if self.is_my_task(t_tw, t_db, t_module, t_module_type, t_id_list[0]): return self.ct_true() #不是我的任务,但检查是否特别权限组执行 t_res = t_tw.con()._send("c_group", "is_in_group", {"check_group_id": t_check_group_id}) #最后要返回 if t_res == True: return self.ct_true() else: return self.ct_false("Unassigned, Can not drag in") except Exception, e: #print traceback.format_exc() return self.ct_false(e.message)
def run(self, a_dict_data): t_argv=ct_plu.argv(a_dict_data) t_db=t_argv.get_sys_database() t_module=t_argv.get_sys_module() t_module_type=t_argv.get_sys_module_type() t_id_list=t_argv.get_sys_id() t_check_pipeline_id=t_argv.get_filebox_key("pipeline_id") try: t_check_pipeline_id=unicode(t_check_pipeline_id) if t_check_pipeline_id.strip()=="": return self.ct_true() pipeline_id_list=t_check_pipeline_id.split(",") t_tw = tw() dic={"db":t_db, "module":t_module, "module_type":t_module_type, "task_id":t_id_list[0], "pipeline_id_array":pipeline_id_list} t_res=t_tw.con()._send("c_file","check_all_pipeline_finish", dic) #最后要返回 if t_res==True: return self.ct_true() else: return self.ct_false(t_res) except Exception,e: #print traceback.format_exc() return self.ct_false(e.message)
def run(self, a_dict_data): try: t_argv = ct_plu.argv(a_dict_data) t_tw = tw() t_action = t_argv.get_argv_key("action") if t_action == "drag_image_get_thumbnail": return self.drag_image_get_thumbnail(t_argv, t_tw) elif t_action == "drag_mov_get_thumbnail": return self.drag_mov_get_thumbnail(t_argv, t_tw) elif t_action == "image_stitching": return self.image_stitching(t_argv, t_tw) elif t_action == "drag_copy_file_to_folder_sign": return self.drag_copy_file_to_folder_sign(t_argv, t_tw) elif t_action == "drag_copy_file_to_filebox_sign": return self.drag_copy_file_to_filebox_sign(t_argv, t_tw) else: return self.ct_false(u"未查询到action对应插件!") except Exception, e: # print traceback.format_exc() return self.ct_false(traceback.format_exc())
def run(self, a_dict_data): t_argv=ct_plu.argv(a_dict_data) t_db=t_argv.get_sys_database() t_module=t_argv.get_sys_module() t_module_type=t_argv.get_sys_module_type() t_id_list=t_argv.get_sys_id() t_des_file_path_list=t_argv.get_sys_des_file() t_account_id=t_argv.get_filebox_key("account_id") if not isinstance(t_account_id, (unicode,str)): return self.ct_true() t_account_id_list=unicode(t_account_id).split(",") if len(t_des_file_path_list)==0: return self.ct_false("There are no files drag in") try: t_tw = tw() content="submit:" for path in t_des_file_path_list: content=content+"<br>"+path dic={"db":t_db, "module":t_module, "module_type":t_module_type, "task_id":t_id_list[0], "title":"", "content":content, "account_id_array":t_account_id_list} res=t_tw.con()._send("c_msg", "send_task", dic) #最后要返回 if res==True: return self.ct_true() else: return self.ct_false("Send msg to fail") except Exception,e: print traceback.format_exc() return self.ct_false(traceback.format_exc())
def run(self, a_dict_data): t_argv = ct_plu.argv(a_dict_data) t_db = t_argv.get_sys_database() t_module = t_argv.get_sys_module() t_module_type = t_argv.get_sys_module_type() t_id_list = t_argv.get_sys_id() t_check_group_id = t_argv.get_filebox_key("allow_group_id") try: t_tw = tw() #判断任务是否完成 if not self.is_task_finish(t_tw, t_db, t_module, t_module_type, t_id_list[0]): return self.ct_true() #完成的话。看是否有允许拖入权限 t_is_has_permission = t_tw.con()._send( "c_group", "is_in_group", {"check_group_id": t_check_group_id}) #最后要返回 if t_is_has_permission == True: return self.ct_true() else: return self.ct_false("Task finish, can not drag in") except Exception, e: print traceback.format_exc() return self.ct_false(traceback.format_exc())
def run(self, a_dict_data): t_argv = ct_plu.argv(a_dict_data) t_check_group_id = t_argv.get_filebox_key("allow_group_id") try: t_tw = tw() t_res = t_tw.con()._send("c_group", "is_in_group", {"check_group_id": t_check_group_id}) #最后要返回 if t_res == True: return self.ct_true() else: return self.ct_false("No Permission to drag in") except Exception, e: #print traceback.format_exc() return self.ct_false(traceback.format_exc())
def run(self, a_dict_data): t_argv = ct_plu.argv(a_dict_data) t_db = t_argv.get_sys_database() t_module = t_argv.get_sys_module() t_module_type = t_argv.get_sys_module_type() t_id_list = t_argv.get_sys_id() try: t_tw = tw() #判断任务是否完成 if self.is_task_finish(t_tw, t_db, t_module, t_module_type, t_id_list[0]): return self.ct_true({"is_can_submit": "N"}) return self.ct_true({"is_can_submit": "Y"}) except Exception, e: print traceback.format_exc() return self.ct_false(traceback.format_exc())
def run(self, a_dict_data): t_argv=ct_plu.argv(a_dict_data) t_db=t_argv.get_sys_database() t_module=t_argv.get_sys_module() t_module_type=t_argv.get_sys_module_type() t_id_list=t_argv.get_sys_id() t_filebox_id=t_argv.get_sys_filebox_id() t_sou_file_list=t_argv.get_sys_file() t_des_file_list=t_argv.get_sys_des_file() t_version_id=t_argv.get_version_id() t_drag_in_upload_to_server_action=t_argv.get_filebox_key("action") try: t_tw = tw() #取文件框信息 filebox_info=self.get_filebox_info(t_tw, t_db, t_module, t_module_type, t_id_list[0], t_filebox_id) if filebox_info==False or not filebox_info.has_key("server"): return self.ct_false("Get filebox info error") t_server=filebox_info["server"] #发送到queue t_action="upload" if unicode(","+t_drag_in_upload_to_server_action+",").find(",convert_before_upload,")!=-1: t_action="convert_movie_to_mp4" if unicode(","+t_drag_in_upload_to_server_action+",").find(",convert_image_before_upload,")!=-1: t_action="convert_image_to_image" if unicode(","+t_drag_in_upload_to_server_action+",").find(",sequence_output_video,")!=-1: t_action="convert_seq_image_to_mov" for i in range(len(t_sou_file_list)): t_name=os.path.basename(t_des_file_list[i]) upload_list=[{"sou":t_sou_file_list[i], "des":unicode(t_des_file_list[i]).replace(t_server, "/")}] t_dic={'name':t_name, 'task': [{"action":t_action, "is_contine":True, "data_list":upload_list, "db":t_db, "module":t_module, "module_type":t_module_type, "task_id":t_id_list[0], "version_id":t_version_id}]} t_tw.local_con._send("queue_widget", "add_task", {"task_data":t_dic}, "send") return self.ct_true() except Exception,e: #print traceback.format_exc() return self.ct_false(traceback.format_exc())
def run(self, a_dict_data): t_argv = ct_plu.argv(a_dict_data) t_db = t_argv.get_sys_database() t_module = t_argv.get_sys_module() t_module_type = t_argv.get_sys_module_type() t_id_list = t_argv.get_sys_id() t_des_file_path_list = t_argv.get_sys_des_file() try: if len(t_des_file_path_list) == 0: return self.ct_false("Send to first qc user failed") t_tw = tw() t_account_id_list = t_tw.con()._send("c_work_flow", "get_first_qc_with_task_id", { "db": t_db, "task_id": t_id_list[0] }) if t_account_id_list == False or isinstance( t_account_id_list, list) == False or len(t_account_id_list) == 0: return self.ct_true() content = "submit:" for path in t_des_file_path_list: content = content + "<br>" + path dic = { "db": t_db, "module": t_module, "module_type": t_module_type, "task_id": t_id_list[0], "title": "", "content": content, "account_id_array": t_account_id_list } res = t_tw.con()._send("c_msg", "send_task", dic) #最后要返回 if res == True: return self.ct_true() else: return self.ct_false("Send to first qc user failed") except Exception, e: print traceback.format_exc() return self.ct_false(traceback.format_exc())
t_server=filebox_info["server"] #发送到queue t_action="upload" if unicode(","+t_drag_in_upload_to_server_action+",").find(",convert_before_upload,")!=-1: t_action="convert_movie_to_mp4" if unicode(","+t_drag_in_upload_to_server_action+",").find(",convert_image_before_upload,")!=-1: t_action="convert_image_to_image" if unicode(","+t_drag_in_upload_to_server_action+",").find(",sequence_output_video,")!=-1: t_action="convert_seq_image_to_mov" for i in range(len(t_sou_file_list)): t_name=os.path.basename(t_des_file_list[i]) upload_list=[{"sou":t_sou_file_list[i], "des":unicode(t_des_file_list[i]).replace(t_server, "/")}] t_dic={'name':t_name, 'task': [{"action":t_action, "is_contine":True, "data_list":upload_list, "db":t_db, "module":t_module, "module_type":t_module_type, "task_id":t_id_list[0], "version_id":t_version_id}]} t_tw.local_con._send("queue_widget", "add_task", {"task_data":t_dic}, "send") return self.ct_true() except Exception,e: #print traceback.format_exc() return self.ct_false(traceback.format_exc()) if __name__ == "__main__": #调试数据,前提需要在拖入进程中右键菜单。发送到调试 t_debug_argv_dict=ct_plu.argv().get_debug_argv_dict() print ct_base().run(t_debug_argv_dict)
def run(self, a_dict_data): t_argv = ct_plu.argv(a_dict_data) t_db = t_argv.get_sys_database() t_module = t_argv.get_sys_module() t_module_type = t_argv.get_sys_module_type() t_id_list = t_argv.get_sys_id() t_filebox_id = t_argv.get_sys_filebox_id() t_sou_file_list = t_argv.get_sys_file() t_des_file_list = t_argv.get_sys_des_file() t_is_move_same = unicode( t_argv.get_filebox_key("is_move_same")).strip().lower() t_is_in_history_add_datetime = unicode( t_argv.get_filebox_key( "is_in_history_add_datetime")).strip().lower() t_is_in_history_add_version = unicode( t_argv.get_filebox_key( "is_in_history_add_version")).strip().lower() try: t_tw = tw() #如果源和目标是同一个目录,不做移动 if self.is_has_same_folder(t_sou_file_list, t_des_file_list): return self.ct_true() #取命名规则和路径 filebox_info = self.get_filebox_info(t_tw, t_db, t_module, t_module_type, t_id_list[0], t_filebox_id) if filebox_info == False or not filebox_info.has_key( "rule") or not filebox_info.has_key("path"): return self.ct_false("Get filebox info error") t_rule_view_list = filebox_info["rule_view"] t_path = filebox_info["path"] t_show_type = unicode(filebox_info["show_type"]).strip().lower() t_is_submit = unicode(filebox_info["is_submit"]).strip().lower() if not isinstance(t_rule_view_list, list): return self.ct_false("Get filebox rule error") #移动相同的文件 if t_is_move_same == "y": self.move_same_file_to_history(t_des_file_list, t_is_in_history_add_datetime, t_is_in_history_add_version, t_path) return self.ct_true() if t_is_submit == "y": #如果是提交检查,移动上次提交的文件 self.move_check_file_to_history(t_tw, t_db, t_module, t_module_type, t_id_list[0], t_is_in_history_add_datetime, t_is_in_history_add_version) else: #不是提交检查,移动符合命名规则的文件 self.move_all_file_to_history(t_show_type, t_rule_view_list, t_is_in_history_add_datetime, t_is_in_history_add_version, t_path) return self.ct_true() except Exception, e: #print traceback.format_exc() return self.ct_false(e.message)
def run(self, a_dict_data): t_argv = ct_plu.argv(a_dict_data) t_db = t_argv.get_sys_database() t_module = t_argv.get_sys_module() t_module_type = t_argv.get_sys_module_type() t_id_list = t_argv.get_sys_id() t_filebox_id = t_argv.get_sys_filebox_id() t_drop_file_list = t_argv.get_sys_file() #拖入进来的源文件 try: t_tw = tw() #取命名规则和路径 filebox_info = self.get_filebox_info(t_tw, t_db, t_module, t_module_type, t_id_list[0], t_filebox_id) if filebox_info == False or not filebox_info.has_key( "rule") or not filebox_info.has_key("path"): return self.ct_false("Get filebox info error") t_rule_list = filebox_info["rule"] t_path = filebox_info["path"] if not isinstance(t_rule_list, list): return self.ct_false("Get filebox rule error") #取出目录规则,用于提示 message_folder_rule = "" for temp_rule in t_rule_list: if unicode(temp_rule).find(".") == -1: message_folder_rule = message_folder_rule + "\n" + temp_rule #-----------------------------组成新的----------------------- sou_file_list = [] des_file_list = [] sou_dir_list = [] des_dir_list = [] total_sou_list = [] total_des_list = [] is_exist_error_filename = False #过滤出符合命名规则的文件 //文件是否存在命名规则错误 for temp_path in t_drop_file_list: t_filename = os.path.basename(temp_path) if os.path.isfile(temp_path): if not ct_lib.com().is_match_regexp_list( t_rule_list, t_filename): is_exist_error_filename = True sou_file_list.append(temp_path) des_file_list.append(t_path + "/" + t_filename) else: #检查文件夹 if not ct_lib.com().is_match_regexp_list( t_rule_list, t_filename): #目录规则错误 return self.ct_false("Folder rule is error \n" + message_folder_rule) sou_dir_list.append(temp_path) #不是遍历的,里面存储的就是文件夹的路径。。 des_dir_list.append(t_path + "/" + t_filename) #存在命名规则错误,进行更改 if is_exist_error_filename: #修改文件名,并返回目标文件列表 res = modify_filename(t_path, t_rule_list, sou_file_list).run() if res == []: return self.ct_false("Fail to modify the rules") #修改规则失败 des_file_list = res #把文件和文件夹的都放到新的列表中---- total_sou_list = total_sou_list + sou_file_list total_sou_list = total_sou_list + sou_dir_list total_des_list = total_des_list + des_file_list total_des_list = total_des_list + des_dir_list return self.ct_true({ "sou_list": total_sou_list, "des_list": total_des_list }) except Exception, e: #print traceback.format_exc() return self.ct_false(traceback.format_exc())