def receivedNews(self, msg): print >>sys.stderr, "NEWS" m = mnimsg.mnimsg(msg) (time, tops) = self.mp.gettimetopics(m.getselectors()+m.gettopics()) if time < 0: return elif time == 0: mydir = '../delivery' else: mydir = '../queue' nt = m.getiso8601timestamp(self.year) nt = nt.split('-')[0] if nt == self.t: self.seq = self.seq + 1 else: self.seq = 0 self.t = nt myname = nt+repr(self.seq)+'.xml' try: myfile = os.path.join(mydir, myname) fmyfile = open(myfile, 'wb') print "I'LL PUBLISH "+m.gettimestamp()+" "+stripHeadline(m.getheadline())+" to "+repr(tops)+" in "+repr(time)+" seconds to "+repr(myfile) mx = mniblogxml.mniblogxml(m,tops, self.year) fmyfile.write(mx.toxml()) fmyfile.close() except Exception, e: print "EXCEPTION IS "+repr(e)
def receivedNews(self, msg): #print >>sys.stderr, timeLog() + "NEWS" m = mnimsg.mnimsg(msg) time = 0 embargo = 0 death = 0 price = 0 if cfgGet("cfg.advanced"): (embargo, death, price, tops) = \ self.mp.gettopicdata(m.getselectors() + \ m.gettopics()) else: (time, tops) = \ self.mp.gettimetopics(m.getselectors() + \ m.gettopics()) print >>sys.stderr, self.name+" "+str(m.getselectors() + m.gettopics())+" "+str(time)+" "+str(tops) if time < 0 or embargo < 0 or len(tops) == 0: return elif time == 0: mydir = self.dirDelivery else: mydir = self.dirEmbargo xts = self.ts.getnameseq() myname = xts[0]+repr(xts[1])+'.xml' try: myfile = os.path.join(mydir, myname) fmyfile = open(myfile, 'wb') if(self.shouldLog): print timeLog() + "NEWS - " + self.name + \ " - " + myname + " - " + \ stripHeadline(m.getheadline()) logData() if cfgGet("cfg.advanced"): mx = mniblogxml.mniblogxml(m,tops,self.year,\ embargo,death,price) else: mx = mniblogxml.mniblogxml(m,tops,self.year) fmyfile.write(mx.toxml()) fmyfile.close() except Exception, e: print timeLog() + "EXCEPTION IS " + repr(e)
def receivedNews(self, msg): #print >>sys.stderr, "NEWS" m = mnimsg.mnimsg(msg) tt = m.getselectors() + m.gettopics() a0 = ('A0000000' in tt) if a0: tt.remove('A0000000') (time, tops) = self.mp.gettimetopics(tt) if time < 0 and not a0: return if time < 1: mydir = '../delivery' else: mydir = '../queue' nt = m.getiso8601timestamp(self.year) nt = nt.split('-')[0] if nt == self.t: self.seq = self.seq + 1 else: self.seq = 0 self.t = nt myname = nt+repr(self.seq)+'.xml' if (a0 and (len(tops) == 0)): tops = ['mainwire'] try: myfile = os.path.join(mydir, myname) fmyfile = open(myfile, 'wb') print stripHeadline(m.getheadline()) + "-" + str(tops) #print "I'LL PUBLISH "+m.gettimestamp()+" "+stripHeadline(m.getheadline())+" to "+repr(tops)+" in "+repr(time)+" seconds to "+repr(myfile) mx = mniblogxml.mniblogxml(m,tops, self.year) fmyfile.write(mx.toxml()) fmyfile.close() except Exception, e: print "EXCEPTION IS "+repr(e)