def get_mime_type(file_full_path): rootPath = get_prot_root() magicPath = os.path.join(rootPath, "share\\file\\magic") #print 'magic path: ',magicPath if not os.path.exists(magicPath): raise "Magic file lost" #print "magic path is", magicPath #os.environ["MAGIC"] = magicPath m = magic.Magic(magic_file=magicPath) res = m.from_file(file_full_path) return res
misc.ensureDir(other_tmp_file_path) inputTubeName = item["InputTubeName"] target_dir = item["TargetDir"] if self.is_processing_tube(inputTubeName): job.delete() return False t = FolderInfoArchiveThread(inputTubeName, self.storage_class(tmp_file_path, passwd=self.passwd, sync_folder = target_dir), self.collector_list, other_tmp_file_path) self.add_work_thread(inputTubeName, t) t.start() return True if __name__ == "__main__": #print 'starting fileListHandler' #workingDir = "d:/tmp/working" passwd = "123qwe" from localLibs.utils.misc import get_prot_root passwd_file = os.path.join(get_prot_root(), "passwd.config") if os.path.exists(passwd_file): f = open(passwd_file) passwd = f.read().replace("\r","").replace("\n", "") f.close() #print "passwd: ", passwd s = FolderInfoArchiveService(passwd = passwd) s.startServer()