print("file:", f) try: with ftnimport.session(db) as sess: #fo = open(f, "rb") import_file(sess, f, None, node, False) #fo.close() #os.unlink(f) os.rename(f, f + "-" + str(time.time())) #destinations.update(sess.touched_addresses()) except Exception as e: print("error on file %s" % repr(f)) fx = open(f + ".status", "w") fx.write(traceback.format_exc()) fx.close() for f in glob.glob(pnode_dir + "/pwd-in/*.[Tt][Ii][Cc]"): print("Tic file", f) try: ftntic.import_tic(db, f, node) except Exception as e: print("error on file %s" % repr(f)) try: os.rename(f, f + ".bad") except: pass fx = open(f + ".status", "w") fx.write(traceback.format_exc()) fx.close()
for l in open("post_s.dat"): ts, t, fn = l.rstrip().split("\t") print (ts, t, fn) if t=="del": print ("delete", fn, "and info and desc") if os.path.exists(fn): os.unlink(fn) if os.path.exists(fn+".desc"): os.unlink(fn+".desc") if os.path.exists(fn+".info"): os.unlink(fn+".info") elif t=="tic": print ("tic=", fn) try: ftntic.import_tic(db, fn, import_utime=ts, skip_access_check=True) except ftntic.DupPost: print ("dup detected") elif t=="farea": print ("post from fecho", fn) if not os.path.exists(fn) and not fechoes_started: continue else: fechoes_started = True if os.path.exists(fn+".info"): tic = read_info(fn+".info") else: tic = {}
if not ismsg(f) and not ispkt(f) and not isbundle(f): continue print("file:", f) try: with ftnimport.session(db) as sess: #fo = open(f, "rb") import_file(sess, f, None, node, False) #fo.close() #os.unlink(f) os.rename(f, f+"-"+str(time.time())) #destinations.update(sess.touched_addresses()) except Exception as e: print("error on file %s"%repr(f)) fx=open(f+".status", "w") fx.write(traceback.format_exc()) fx.close() for f in glob.glob(pnode_dir+"/pwd-in/*.[Tt][Ii][Cc]"): print ("Tic file", f) try: ftntic.import_tic(db, f, node) except Exception as e: print("error on file %s"%repr(f)) os.rename(f, f+".bad") fx=open(f+".status", "w") fx.write(traceback.format_exc()) fx.close()